views:

30

answers:

1

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

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 SQL Server Management Studio - query works properly i.e. it gives non-zero rows, Are there any SQL Server specific change I need to do ?

+1  A: 

Don't see anything wrong here, i'd look at how you get your Connection object. Perhaps your database url, is pointing to the wrong schema -- perhaps the default one, not your database.

MeBigFatGuy