Hi All,
I ran the following program with sqljdbc4.jar in the class path. 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 class path, it was retrieving data for DEMO. The SQL statement which includes "like" keyword in which the bound value does not contain a % fails to return data with sqljdbc4.jar.
Class.forName("com.microsoft.sqlserver.jdbc.SQLSer verDriver");
Connection con = DriverManager.getConnection("jdbc:sqlserver://SERVER23:5000;databaseName=TESTDB", "SYSADM", "SYSADM");
String sqlSele = "SELECT * FROM EMPLOYEE WHERE EMPNAME like ?" ;
PreparedStatement sts = con.prepareStatement(sqlSele);
sts.setString(1, "DEMO" );
ResultSet rs = sts.executeQuery();
while(rs.next())
{
System.out.println("EMPNAME IS '" + rs.getString("EMPNAME") + "'");
}
}
catch(Exception e)
{
System.out.println(e);
e.printStackTrace();
}
But the program retrieves the data when an % is appended at the end of DEMO as "sts.setString(1, "DEMO%" );"
Can someone help me out from this issue.