on 02-16-2005 9:04 PM
I'm trying to execute the following prepared statement:
-
pStmnt = connection.prepareStatement("select col1 from table1 where col2 = ?");
pStmnt.setLong(1, 45L);
//col 2 is a 'bigint' on the MSSQL 2000 database, hence setLong.
Resultset rs = pStmnt.executeQuery();
-
I do not get any exceptions, but just an empty resultset. I've verified that the query does return some rows if run from another tool.
If I were to go against an 'int' column or a 'varchar' column as part of the 'where' clause, the query runs just fine!!!
Could there be anything wrong with the 'bigint' type?!
I'm trying to run this on an EP6 SP2 iView.
thanks and your help is always appreciated,
Biju.
Hi Biju,
simply put
pStmnt.setLong(1, 45);
because:
PreparedStatement.setLong(1, 45) will assign the value 45 to the first parameter as a Java long. The driver will convert 45 to a JDBC BIGINT in order to send it to the database. Which JDBC type the driver sends to the database is determined by the standard mapping from Java types to JDBC types.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.