Simple select not working on JDBC MSSQL ?

Posted by Xinus on Stack Overflow See other posts from Stack Overflow or by Xinus
Published on 2010-04-29T04:59:07Z Indexed on 2010/04/29 5:27 UTC
Read the original article Hit count: 408

Filed under:
|

I am trying to move project which was using MySQL database to the one that uses MSSQL 2008, But the select that was working in mysql is no longer working in MSSQL

PreparedStatement statement = connection
                    .prepareStatement("select u.user_firstname,u.user_lastname from user_details u, login l where l.username=? and l.login_user = u.user_id");
statement.setString(1, userName);
ResultSet resultSet = (ResultSet) statement.executeQuery();

It always gives me empty resultset even when there are values corresponding to that username, When I run query using MSSQL management studio - query works properly i.e. it gives non-zero rows, Are there any MSSQL specific change I need to do ?

© Stack Overflow or respective owner

Related posts about jdbc

Related posts about mssql