-->
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.  [ 5 posts ] 
Author Message
 Post subject: SQL Server 2000 with JTDS
PostPosted: Wed Jun 23, 2004 2:38 am 
Newbie

Joined: Wed Jun 23, 2004 2:30 am
Posts: 1
I am trying to use hibernate with MS Sql Server 2000, and I am using the JTDS driving recommended on the Hibernate Documentation.

I have having trouble to insert row to the database, here is the relative xml parts in the mapping.xml and hibernate.cfg

<id name="departmentId" type="int">
<column name="departmentId" sql-type="INTEGER" not-null="true"/>
<generator class="native">
</generator>
</id>


<property name="connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>
<property name="connection.url">jdbc:jtds:sqlserver://xxx.xxx.xxx.xxx:1433/somedb;user=DBA;password=abc</property>
<property name="connection.username">DBA</property>
<property name="connection.password">abc</property>
<property name="dialect">net.sf.hibernate.dialect.SQLServerDialect</property>

when i do an insert it gives me:
java.sql.SQLException: Was expecting a result set
at net.sourceforge.jtds.jdbc.PreparedStatement_base.executeQuery(PreparedStatement_base.java:260)
at com.mchange.v2.c3p0.impl.C3P0PreparedStatement.executeQuery(C3P0PreparedStatement.java:188)
at com.mchange.v2.c3p0.impl.C3P0PooledConnection$2.executeQuery(C3P0PooledConnection.java:473)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:508)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:432)
at net.sf.hibernate.impl.ScheduledIdentityInsertion.execute(ScheduledIdentityInsertion.java:29)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:906)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:839)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:757)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:720)


p.s. where can i find documentation on the proper way to set up with SQL Server...?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 28, 2004 12:37 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Can you test wo C3p0?

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 28, 2004 12:37 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
FYI I use jTDS 0.7.1 on SQLServer 7 and Weblogic pool wo any issue

_________________
Emmanuel


Top
 Profile  
 
 Post subject: Re: SQL Server 2000 with JTDS
PostPosted: Wed Jul 07, 2004 11:54 am 
Newbie

Joined: Tue Jun 29, 2004 10:14 am
Posts: 11
klayton wrote:
I am trying to use hibernate with MS Sql Server 2000, and I am using the JTDS driving recommended on the Hibernate Documentation.

I have having trouble to insert row to the database, here is the relative xml parts in the mapping.xml and hibernate.cfg

when i do an insert it gives me:
java.sql.SQLException: Was expecting a result set
at net.sourceforge.jtds.jdbc.PreparedStatement_base.executeQuery(PreparedStatement_base.java:260)
at com.mchange.v2.c3p0.impl.C3P0PreparedStatement.executeQuery(C3P0PreparedStatement.java:188)
at com.mchange.v2.c3p0.impl.C3P0PooledConnection$2.executeQuery(C3P0PooledConnection.java:473)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:508)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:432)
at net.sf.hibernate.impl.ScheduledIdentityInsertion.execute(ScheduledIdentityInsertion.java:29)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:906)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:839)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:757)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:720)


p.s. where can i find documentation on the proper way to set up with SQL Server...?


You need to set:

hibernate.jdbc.use_get_generated_keys true

in your hibernate.properties. select @@identity does not seemk to work with jTDS.

Gary Evesson


Top
 Profile  
 
 Post subject: Same problem
PostPosted: Thu Sep 09, 2004 1:09 pm 
Newbie

Joined: Thu Sep 02, 2004 10:02 pm
Posts: 3
I had the same problem and we upgraded hibernate to version 2.1.6 and everything worked fine for us.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.