Skip to Content
avatar image
Former Member

MSSQL DB, bigint, preparedStatement

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,


Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Feb 21, 2005 at 11:10 AM

    Hi Biju,

    simply put

    pStmnt.setLong(1, 45);


    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.

    Add comment
    10|10000 characters needed characters exceeded