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 ]
(NB: why are you using the JDBC-ODBC bridge? Is it Access you are using?) [ June 10, 2008: Message edited by: Paul Sturrock ]
akhilesh pandey
Greenhorn
Joined: Jun 03, 2008
Posts: 17
posted
0
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.
adeeb alexander
Ranch Hand
Joined: May 29, 2008
Posts: 267
posted
0
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 ]
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.