-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: setFirstResult causes Exception on SQL Server 2005
PostPosted: Tue Jun 03, 2008 5:45 pm 
Newbie

Joined: Tue Jun 03, 2008 5:24 pm
Posts: 2
Hi there,

I have a strange problem here, when I try to setFirstResult any value other than 0 , I get an exception from the SQL Server.


The following code runs without any problem
Code:
em.createQuery("SELECT x FROM Article x ORDER BY x.ID")
            .setFirstResult(0)
            .setMaxResults(10);



but if I set the first result anything else than zero

Code:
em.createQuery("SELECT x FROM Article x ORDER BY x.ID")
            .setFirstResult(1)
            .setMaxResults(10);


then I get the following exception

Code:
Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 1 (""): Data type 0x38 is unknown.



Hibernate version
hibernate-3.2.6
hibernate-annotations-3.3.1
hibernate-entitymanager-3.3.2

MsSQL Driver
Microsoft SQL Server 2000 Driver for JDBC Service Pack 2 Version 2.2.0037

DB
MsSQL Server 2005 (9.00.1399.06)


Does anyone of you guys have an idea?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 04, 2008 11:06 am 
Newbie

Joined: Tue Jun 03, 2008 5:24 pm
Posts: 2
i ve found out the solution on my own, after I have realized that the JDBC driver that I have been using is the JDBC driver for SQL Server 2000.

Summary:
MS Sql Server 2000 JDBC driver does not work with SQL Server 2005.
For those who is getting similar exceptions, I strongly recommend them to download the latest JDBC driver here:

http://msdn.microsoft.com/en-us/data/aa937724.aspx

cheers


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.