jdbc 3 « SQL « Java Database Q&A





1. SQL check constraint    coderanch.com

Hi It is only about SQL (DDL) and to be more specific - about PostgreSQL. I have to create a table coordinates with rows: x integer, y integer, id integer, data_set integer. And I allso must specify that in one data_set, there is no dublicated set of coordinates. My first attempt was like that: CREATE TABLE coordinates ( x INTEGER NOT ...

2. Invoking a SQL and stored procedure    coderanch.com

3. sql auto increment question    coderanch.com

4. SQL Doubt    coderanch.com

Originally posted by Cosmos Ja: I have problem with a sql query, it's returming ORA-01858: a non-numeric character was found where a numeric was expected How can I resolve this? period_name is a Date field select distinct to_char(period_name,'MON-YY') period_name from GL_SITE where period_name >= '01/JAN/2005' and period_name <= to_char(sysdate,'DD/MON/YYYY') order by to_date(period_name,'MON-YY') desc '01/JAN/2005' is not a date, it's a string, ...

6. sql question    coderanch.com

I have TABLE1 with columns 1A 1B 1C(PK) TABLE2 with columns 2A 2B 2C(PK) TABLE3 with columns 3A 3B 3C(PK) TABLE4 with columns 1C 2C 3C 4D my sql = select TABLE1.1A, TABLE1.1B, TABLE1.1C, TABLE2.2A, TABLE2.2B, TABLE2.2C, TABLE3.3A, TABLE3.3B, TABLE3.3C from TABLE1 TABLE1, TABLE2 TABLE2, TABLE3 TABLE3, TABLE4 TABLE4 where ( TABLE4.1C = TABLE1.1C AND TABLE4.2C = TABLE2.2C AND TABLE4.3C = ...

7. SQL question    coderanch.com

8. java.sql.batchupdateexception    coderanch.com

9. Old style SQL vs new style SQL    coderanch.com

In an effort to simplify the sql referenced here, we've come up with this: SELECT * FROM SCADMIN.assignmentm1 assignmentm1, SCADMIN.contactsm1 contactsm1, SCADMIN.contactsm1 contactsm2, SCADMIN.devicem1 devicem1, SCADMIN.incidentsm1 incidentsm1, SCADMIN.operatorm1 operatorm1, SCADMIN.operatorm1 operatorm2, SCADMIN.psm1 psm1, SCADMIN.probsummarym2 psm2, SCADMIN.screlationm1 screlationm1 WHERE psm1.number = screlationm1.source AND screlationm1.depend = incidentsm1.incident_id AND incidentsm1.affected_item = devicem1.logical_name AND psm1.assignee_name = operatorm1.name AND operatorm1.full_name = contactsm1.contact_name AND psm1.assignment = assignmentm1.name ...





12. java.sql.*    coderanch.com

Hello, In my web application I am using MySql as back-end. One of the column type in my table is BLOB. I am fetching some values in Blob of JSP tag and then passing those in sql query. But I am getting initialization error. Because as per java.sql.* package Blob is an interface. So that object cant be created for that. ...

13. relating to my sql    coderanch.com

14. java.sql.Wrapper in Java6. Why?    coderanch.com

15. SQL LOCK    coderanch.com

Yes, it sounds like you have diagnosed this correctly (I had to ask - people oftem mistakenly assume something is a lock without checking ). You say the process that is causing the block is in the waiting state? Of the top of my head, I think this means that SQL Server is waiting for the client to do something, rather ...

16. Accessing SQL Object type    coderanch.com

Just thought of sharing that the following approach served my purpose. I had a structure and within the structure they were simple attributes and some were Table types. try { Connection con = getConnection(); CallableStatement call = con.prepareCall("BEGIN mypackage.myprocedure(?,?,?, ?,?,?,?,?); END; "); call.setString(1, "T"); .... .... // This is the structure call.registerOutParameter(5, Types.STRUCT, sql_type_name); .... .... call.execute(); STRUCT person = (STRUCT) ...





17. Long concatenated SQL stmts    coderanch.com

We have clients that like searching and creating reports on many different fields. So, arbiraty example,a STUDENT, might be searched using: born after, before, between major, minor gpa honors, ss#, birthdate, lastname etc, etc The sql stmt is usually just concatenated with each additional field SQL = SQL + (another search criteria) It works, and we have made the process "standard", ...

18. Stopping embedded sql    coderanch.com

Hi, I have a simple search form with just a text field and a submit button. I'm using the MVC pattern and I want to be able to stop users from embedding SQL into the search field and possible harming the database. For example, they may enter something like 'jones; DELETE * FROM Users;' into the field and submit. The controller ...

19. sql    coderanch.com

Hi, In my database i have user table contains user_id,password,email. To insert a new row i am checking for the email.if email already exists i am generating error message the email already exist. Here my problem is i am interacting db twice. 1.select query returns true if user exists 2.insert data if select query returns false. But i want this should ...

20. javax.sql    coderanch.com

21. SQL Recursion Question    coderanch.com

I could use some help figuring out the sql for a problem. Currently, there are 2 tables: Domain, which has columns domainID, and parentDomainID. ParentDomainID references another Domain record. EndUser, which has a column parentDomainID. I have a procedure where I am looping over domainIDs (variable @currentDomainID). I need to do now is update all EndUser records that are in the ...

22. SQL question    coderanch.com

Hi, Suppose i have 4 tables t1, t2, t3, t4. The below query will fetch me a resultset i am interested in: Select * from t1, t2, t3, t4 where t1.trade = t2.trade and t2.date = t1.date and t2.trade = t3.trade and t3.date = t1.date and t3.trade = t4.trade and t4.date = t1.date ( i have simplified the conditions in this ...

23. calling a SQL function within my java code could somebody tell me what I did wrong?    coderanch.com

System.out.println("in "); Connection conn = DbAccess.getConnection(); CallableStatement cs =null; String block = new String(); try { cs = conn.prepareCall("{? = call WAOE_PKG.CHECK_IP_BLOCKING(?)}"); cs.registerOutParameter(1,Types.VARCHAR); cs.setString(1,"'"+ip+"'"); cs.execute(); block = cs.getString(1); } catch (SQLException ex) { WAUtility.logError("IPFilter -- isFilter", ex.toString()); } finally { try { cs.close(); } catch (SQLException ex) { WAUtility.logError("IPFilter -- isFilter", ex.toString()); } DbAccess.closeConnection(conn); }

24. SQL beginner need help    coderanch.com

25. Viewing Stored Procedure in SQL plus    coderanch.com

26. How to Use Condition in SQL    coderanch.com

Hi, Here this query gives location of first occurance of letter 'A' in the name. select (posstr(t1.NAME,'A')) as Location, t1.Name from vista.VFZPVACCOUNTANT t1 ------------ OUTPUT ------------------ LOCATION NAME ----------- -------------------------- 0 test 14 Kuhn Handels AG ------------------------------------- ------------------------------------- I want to select only "Non Zero" location records. Means There should be atleast one 'A' or 'a' in the name. So that ...

28. problem regarding sql connectivity    coderanch.com

- We have SQL Server DataBase Running. - That Server has 2 Lines. One is from Bharati & Other is from VSNL(means two different Vendors). - At a time only one Line is Working. both line has it'sown static IP Address. - Two lines are their for emergency. means if one line goes down then other will start. - so that ...

29. Parameterized sql    coderanch.com

30. Need help with SQL    coderanch.com

Hi Ranchers, I have a requirement where I am supposed to obtain a string of data from Cobol,extract values from the string, make records from these and pass it back to asp. Now the issue is that I do not want to create a table or a temp global table to store the variables I create from the string. I want ...

31. Regarding the SQL querry generation    coderanch.com

Hi In my project I have to construct queries and write them into sql files through java and they will be read by another program which will be executing the script line by line,but the problem has come while generating the sql file... Now I am generating the sql file with insert statements like this "insert into service_template_device (service_template_id, dev_type_id) select ...

32. SQL VIEW..    coderanch.com

purely sql question, I know a view is a virtual table created based on the select statement, and if a view is updated,the underlying table values are updated too. My question is, is the the view always 'fresh'? Meaning, if the underlying tables are modified, is the view data automatically modified? I really appreciate your time on this. This is the ...

33. SQL statment into a method    coderanch.com

I have a repeated resultset object that I use alot to execute a statement that fetches max id from a table. I was wondering if I can put it in a method and call the method each time I need the max id? The repeated part is: Resultset rs = statement.executeQuery("select max(id) from TableMain"); rs.next(); Here is an example of what ...

34. Head First SQL.    coderanch.com

35. head first sql    coderanch.com

36. Head First SQL - Level and scope of the book ?    coderanch.com

Hi authors, I'm completely new to SQL. I've not had any experience before, with any DB. Hence I was wondering - this book is for people who already know SQL, or begins from ground up ? Also, what database does it use to teach SQL ? I heard that different databases (e.g. Oracle, MySQL, PostgreSQL) implement SQL a bit differently. Finally, ...

37. new to sql    coderanch.com

38. which DB is used in Head First Sql?    coderanch.com

This book is for you if 1. You are new to SQL. Do you want to learn, understand, and remember how to create tables, databases, and write queries using the best and most recent standards? 2. You know SQL, but you would like a refresher, and never quite understood normal forms and one-to-many and left outer joins, this book can help ...

39. Head First SQL - High Performace SQL    coderanch.com

Hello authors, I really want to write SQL statements with high performance. Can you explain how well this book, in guiding us to write best SQL statements with high performance? This is necessary for writing ERP applications. thanking you in advance. [ October 15, 2007: Message edited by: Thuwaragan Sundaramoorthy ] [ October 15, 2007: Message edited by: Thuwaragan Sundaramoorthy ] ...

40. Head First Sql - What is the market target    coderanch.com

I don't like the sample Chapter1 very much. It uses too much pages to explain what RMDB is and some basic SQLs. As a developer, everyone has some knowledge of database. I think it's a waste to apply Head First style to the simple questions. I like the interview with Mr. Null. That's the style I like: making hard question simple ...

41. which DB is targeted in Head First SQL?    coderanch.com

42. Head First SQL: .NET or Java?    coderanch.com

Hi Lynn, I browse through the Table Of Content of Head First SQL, never go through the detailed Content yet. But one thing I wish to clarify with you is, is this book for Java programmer or .NET developer, or both? Talking about SQL, I wish to ask you another question, which is regarding the Merged Application between mobile device and ...

43. Head First SQL - Normal Forms?    coderanch.com

44. Book distribution for HF SQL    coderanch.com

Distribution is tricky, because we (the publisher) aren't in control. We sell our books through sales channels, and then stores make them available according to all the laws of the land. I'm not sure about import laws and the like for Romania, but your best bet would be to ask your local book store to order the book; they can usually ...

45. Developer point of difference for Head First SQL?    coderanch.com

looks like a decent book and if it's going along the same lines of the other Head-First guides it should be pretty easy to take onboard the info. I found all the other ones, especially the JAVA guide, very well written and enjoyed the puzzles that forced you to really learn the material, big help. How hard was it to put ...

47. Comments on "Head First SQL"    coderanch.com

48. Head First SQL - Math concepts    coderanch.com

52. Head First SQL - Standard SQL    coderanch.com

I'm a fairly new SQL user since I spent most of my time working on embedded systems up to now. I have, in the last 6 months, worked on both SQL server and Oracle DB's. I am finding that the "flavors" of SQL can be quite different, especially when it comes to performance. Does the book address the performance information associated ...

54. What do you think will become the next coming SQL trends ?    coderanch.com

Hi Lynn, Over the years we have seen a bunch of technologies and tools related to database modeling/development such as stored procedures, triggers, views, datawarehousing, geografical data gathering, fine grained cubes, OLAP, MOLAP, HOLAP ... bla bla bla ... which are very helpful for us on these days. Even considering the recent days, there is still so much effort to become ...

55. HF SQL and Normalizing    coderanch.com

Ken, This is a point of high contention. It is certainly safer to have a primary key as an arbitrary number. Some people use business values. With that approach, there is the risk that something may change. For example, a person's social security number seems unique. But what happens if there was a typo or mistake?

56. Head First + SQL    coderanch.com

From what I've read in Lynn's responses, the book is focused on SQL, not JDBC and certainly not something as specific as setting up container-managed connection pooling in Tomcat. That, however, is a topic that has been discussed often in our Tomcat forum. Search through that forum and you should find lots of good info.

58. Head First SQL: which database    coderanch.com

59. Why do I need SQL when I have Excel?    coderanch.com

I am a school teacher who spends a lot of his time manipulating pupil data in Excel. I've already had an excellent experience with HF Java, and am now happily programming little apps, so I know the HF style really works (in fact it's something I try to emulate in my teaching). I've read the sample first chapter and although it ...

60. Head First SQL    coderanch.com

61. Head First SQL - Embedded & Dynamic SQL    coderanch.com

62. Head First SQL - Relational Algebra & Calculus    coderanch.com

HI Lynn Beighley, Do you link in your book SQL to Relational Algebra and/or Relational Calculus? Do you think it is important to understand those 2 topics in order to better grasp SQL? Also, one of the operators of Relational Algebra, namely 'divideby', has not been implemented in SQL. Do you think it should be? Thank you, Mihai Fonoage [ October ...

63. Head First SQL: developers or DB admins?    coderanch.com

Hiya Lynn, I was wondering what sort of level your book is aimed at? The previous HF books take you all the way from beginner to certified so is this new tome in the same mould? Is there a specific certification which the book is aimed at as several somewhat proprietary standards exist for the various DBs on the market. Would ...

64. HFSQL - Need another HF Advanced SQL from Lynn    coderanch.com

Hi Lynn, I like to have this book because, I want to encourage my friends to read this kind of books. This is an innovation under SQL book series. Good job! Anyway we need another book from you explaining the advanced and complex topics under SQL. I believe, you will draw that for the advanced users. Thanking you in advance. /thuwa ...

65. HF SQL - Refresher course on SQL    coderanch.com

Hi Lynn Beighley, The first thing which came to my mind when i saw the book promotions mail and saw "Head First" in the title, was the urge to go and buy the book. I am a great fan of the Head First series and i have all the books published until now in my proud collection I went through the ...

66. HF SQL- SQL Refresher?    coderanch.com

Well, I know SQL well enough to get work done, What I need is a book which I can refer to and find quickly what I need (I know the concepts, just tell me how to do it). I know few books will have a primary aim like that, but does HF-SQL has a refresher/Good summary sections for its chapters so ...

67. sql certification    coderanch.com

68. what does Head First SQL focus    coderanch.com

69. Does HF SQL cover anything on Object Oriented SQL    coderanch.com

It might be out of scope according to title of the book but object oriented SQL make more sense since real SQL remain behind the scene.. any thoughts or chapter devoted in this book? (would be nice to know what to read next after this book or have Head First Object Oriented SQL as next in series) Thanks, Ken

70. Does HF SQL Covers Advaced SQL?    coderanch.com

71. Head First SQL: specific relational database system?    coderanch.com

Lynn, I had a couple of questions about your book. You mentioned in another post you do address some complex topics, but I had some specific questions. Do you address the following topics: procedural SQL, triggers, and user permissions (I know that's a wide range of topics). Also, do you address working with any specific relational database system? Many have their ...

72. Head First SQL - SQL Books you recommend    coderanch.com

Of course I have a bias towards O'Reilly books. While I don't know if I'd call it an advanced book, precisely, one that I find especially useful is: SQL in a Nutshell Two others that get into theory and are well written: Database in Depth by C.J. Date which gets into the fundamentals of what "relational" is and The Art of ...

73. HF SQL - Normalization?    coderanch.com

74. Head First SQL: no-mans land    coderanch.com

Hi Lynn, Database professionals and software developers often still don't understand each other... In HF-SQL, do you give a hint of the issues there are between applications and data? I like the term no-mans land... Martin Fowler uses it for the authors in his foreword to Refactoring Databases, they both worked in the field between applications and data: no-mans land Kind ...

75. HF SQL Eratta    coderanch.com

76. Head First SQL: Suggested level of experience?    coderanch.com

Hi Kevin, I believe so. The things I find I forget after a long absence include joins, and I expect to be using my own book to refresh me after a year or more away. Plus there (hopefully) are topics you didn't encounter before that might be useful, perhaps grants and roles.

78. Winners: Head First SQL    coderanch.com

Lynn, The above post is on behalf of the book promo team. Now as myself and as one of the moderators of this forum: I can't believe how many posts we had about your book. The level of excitement was overwhelming. Good luck on book sales. I can tell we have lots of interested people here! Even though I already know ...

79. DELETE SQL Question    coderanch.com

80. Escape characters for variables in sql    coderanch.com

HI All, I am trying to execute a query on Oracle db. I am unable to substitute my variables in the sql statement. The sql is: select prod_type_nm from prod_type_dim where (prod_type_nm like ':INTNL_DEST%' OR prod_type_nm Like ':INTNL_DOMESTIC_DEST%' ); :INTNL_DEST and :INTNL_DOMESTIC_DEST are the variables which should be replaced. However this sql does not work, when I execute it using hardcoded ...

81. encrypted username breaks sql    coderanch.com

Hi guys i have a slight problem with some of the chars used in encryption. When a user tries to create an account in my system, the system encrypts the username/password before putting it into the DB. When the user tries to log in, the system encrypts the username/password used to log in and tries to find a matching encyption in ...

82. sql_handle_env failed    coderanch.com

83. static vs dynamic sql    coderanch.com

84. sl314.util.sql.ConnectionPool    coderanch.com

Hi! I tried to activate an example Web application with a PointBase database but failed. The example needs a java class named ConnectionPool, but I can't find the associated files. Below is the code for InitializeConnectionPool.java: package sl314.web; // Servlet imports import javax.servlet.ServletContextListener; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContext; // Support classes import sl314.util.NamingService; [B]import sl314.util.sql.ConnectionPool[/B]; import java.sql.SQLException; /** * This listenter is ...

85. java.sql.BatchUpdateException    coderanch.com

hi friends I am using EJB Message Driven bean datas were received in very fastest way(per min 200 msg) in the onMessage() in bean call.I am adding the msgs to the vector and passed to the other class.That class is doing all the database Operation.for this scenario i am using PreparedStatement and batchUpdation.In this class i am getting BatchException.I have attched ...

88. SQL XML bulk loading using JAVA    coderanch.com

89. Newbie jdbc sql problem    coderanch.com

This code is intended to pull records from one SQL db and insert them into another, unrelated SQL db. The first part of this, down to "Done Reading!" println, works fine. In the 2nd sql statement, I continually get a sql error that B_PASS is an invalid object name in the FROM statement, even though it worked fine in the first ...

90. My SQL connectionproblem    coderanch.com

Hi, I am connecting to My SQL database using the below code. But am getting an exception below. Class.forName("com.mysql.jdbc.Driver");//works fine System.out.println("My SQL driver loaded: "); Connection conn = DriverManager.getConnection ("jdbc:mysql://10.1.5.23:3306/mysql", "root", "root"); System.out.println("Connected to My SQL database........ "); Exception is >>>>>>>> com.mysql.jdbc.CommunicationsException: Communications link failure Last packet sent to the server was 0 ms ago. Please help. Thanks, Mats.

91. Newbie SQL tutorial    coderanch.com

92. PL / SQL BLOCK EXECUTION    coderanch.com

I have written a PL SQL block of code and tried to execute it with a /. My SQL file had a space before the / and it resulted in syntax error. The same file worked in another environment. I am not sure if both the environments are having same version for oracle client. My questions are -- Is it a ...

93. 2 Phase Commit[My SQL]    coderanch.com

Hi, I have a question. I am trying to learn how 2 phase commit works between 2 different resources, database and message queue. I am using MySql 5.1 trial version for that. DO I need to make some changes to mysql database inorder to make it work for a 2 phase commit. Any documentation will help Thanks Asgar

94. JDBC supported SQL functions    coderanch.com

95. DTD->SQL    coderanch.com

Hi guys : There has to be a tool out there somewhere for converting a well formed XML document to a robust relational schema (preferably MySQL), but I can't find one. Basically, I want to auto generate tables with relationships from the structure of an XML document, and also auto generate tools for importing data from that document into the database ...

96. SQL Having Clause    coderanch.com

97. SQL validation!    coderanch.com

I have a requirement wherein i wish to allow my customer to specify sql query by himself (assuming the fact that customer is say half sql-sensitive). He should be able to save a query and later run the same query if needed. I wish to validate the query without hitting db. Is there any sql-syntax-checker api available? [ November 11, 2008: ...

98. SQL subquery performs too slowly    coderanch.com

I have the following scenario: I need to find all customers who bought at least two certain books. As an example I want to find all users who bought "Sql Book" and "Java Book". For that I've got the following query: SELECT UserId FROM test WHERE boughtBooks = 'Java Book' AND UserId IN (SELECT UserId FROM test WHERE boughtBooks ='Sql Book') ...

99. java code inside sql functions?    coderanch.com

100. SQL Database Structure    coderanch.com

Hi there, I hope it's OK to ask a purely SQL question here (I am using Java in the application as a whole). I want to create lots of lists of strings in various different categories and store them in a mySQL database. I thought the way I'd do it is have just one table, and then have a column for ...