Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes JDBC and the fly likes Binding in Prepared Statement is not working with Microsoft SQL Server JDBC Driver sqljdbc4.jar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Binding in Prepared Statement is not working with Microsoft SQL Server JDBC Driver sqljdbc4.jar" Watch "Binding in Prepared Statement is not working with Microsoft SQL Server JDBC Driver sqljdbc4.jar" New topic
Author

Binding in Prepared Statement is not working with Microsoft SQL Server JDBC Driver sqljdbc4.jar

Charan Teja Sri Rama
Greenhorn

Joined: Dec 23, 2011
Posts: 3
I ran the following program with sqljdbc4.jar in the classpath. There is data in the EMPLOYEE table for the employee name DEMO but the following program is not retrieving data for DEMO. When the same program was run with Merlia.jar in the classpath, it was retrieving data for DEMO.

Did anyone faced these types of issues with sqljdbc4.jar?Are there any flaws in thesqljdbc4.jar?
Can someone help me out from this issue.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

The JDBC specs don't say what the result of toString() on a ResultSet should be, so drivers are free to implement that method in any way at all. So it shouldn't be surprising to find that different drivers have different implementations of it.

If you want to discuss "flaws", I would say that using a ResultSet in that way is a bad idea. Stick to the way you saw in the tutorials.
Charan Teja Sri Rama
Greenhorn

Joined: Dec 23, 2011
Posts: 3
I have used the rs.getString(1) in the system.out.print statement but even then there is no output observed on the console. The problem may be with the setString() method.
Can you send me the program where ResultSet is not used.
 
 
subject: Binding in Prepared Statement is not working with Microsoft SQL Server JDBC Driver sqljdbc4.jar