This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi, I have a doubt. Suppose there is a column which consists of Int data (let us take as 7). Now i want this number from table directly in the program. I have tried doing with ResultSet and PreparedStatement but i failed. I should be able to assign it to a variable," example it should look like num = 7". Now How Can I Achieve This. Please Help! Thanks & Regards. [ June 10, 2008: Message edited by: Bear Bibeault ]
If you can check the javadocs, the rs.getRow() method returns the current row number.Say when you execute your query "SELECT COUNT(*) FROM addissue WHERE rollno = 1201" the OUTPUT will be 7.So there is only one row in the output so you are getting the result as one.I am not pretty sure but have you tried with rs.getInt(1).I think it should work.
Joined: May 29, 2008
Hi, paul can you please say me why i should not use jdbcdbc drivers is there any prblems in future please give me your suggestion Thanks for answering my questions and more over the problem is solved now by using rs.getInt(colNum)
The JDBC-ODBC Bridge driver is recommended only for experimental use or when no other alternative is available.
As far as I am aware the only database that does not have a JDBC driver is Access. Other than that a proper vendor provided driver is far better. Trust me, swapping to a proper driver will save you various headaches in the future! [ June 10, 2008: Message edited by: Paul Sturrock ]