开发者

Simple select not working on JDBC SQL Server?

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
                  开发者_Python百科  .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 ?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜