-->
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.  [ 18 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Does Hibernate 2.0 support MSDE?
PostPosted: Fri Oct 22, 2004 2:18 am 
Newbie

Joined: Fri Oct 22, 2004 2:10 am
Posts: 6
Hibernate version: 2.0

Mapping documents: NA

Code between sessionFactory.openSession() and session.close(): NA

Full stack trace of any exception that occurs:
19-Oct-2004 15:44:31,671 DEBUG Convert string '30' to class 'int'
19-Oct-2004 15:44:31,671 DEBUG Using converter org.apache.commons.beanutils.converters.IntegerConverter@130633a
19-Oct-2004 15:44:31,718 DEBUG Registering Catalina:type=Manager,path=/adminclient,host=localhost
19-Oct-2004 15:44:31,718 DEBUG Force random number initialization starting
19-Oct-2004 15:44:31,718 DEBUG Getting message digest component for algorithm MD5
19-Oct-2004 15:44:31,718 DEBUG Completed getting message digest component
19-Oct-2004 15:44:31,718 DEBUG getDigest() 0
19-Oct-2004 15:44:31,718 DEBUG Force random number initialization completed
19-Oct-2004 15:44:31,718 DEBUG Start: Loading persisted sessions
19-Oct-2004 15:44:31,718 DEBUG Loading persisted sessions from SESSIONS.ser
19-Oct-2004 15:44:31,718 DEBUG No persisted data file found
19-Oct-2004 15:44:39,562 DEBUG Creating a new instance
19-Oct-2004 15:44:40,796 ERROR [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
19-Oct-2004 15:44:40,796 ERROR [Microsoft][SQLServer 2000 Driver for JDBC]Connection refused: connect
19-Oct-2004 15:44:40,812 ERROR Cannot open connection
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSConnection.<init>(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)
at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:140)
at net.sf.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:95)
at net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:278)
at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3264)
at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3244)
at net.sf.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:40)
at net.sf.hibernate.transaction.JDBCTransactionFactory.beginTransaction(JDBCTransactionFactory.java:19)
at net.sf.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:2195).....


Name and version of the database you are using: MSDE

The generated SQL (show_sql=true): TRUE

Debug level Hibernate log excerpt: DEBUG


I got this error when i try to connect to MSDE, can someone help? I did tried the same piece of code on MS SQL Enterprise Manager and it works fine. Does anyone know if Hibernate is able to support MSDE?


TIA
:)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 22, 2004 3:51 am 
Expert
Expert

Joined: Thu Sep 04, 2003 8:23 am
Posts: 368
It seems you cannot connect to your db

I use hibernate 2.1 with msde without trouble.

Use free and fast jtds driver instead of the ms driver

seb


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 22, 2004 5:27 am 
Newbie

Joined: Fri Oct 22, 2004 2:10 am
Posts: 6
Oic ic.... but in the default hibernate.properties file it says this:

## jTDS (not supported!)
#hibernate.connection.driver_class net.sourceforge.jtds.jdbc.Driver
#hibernate.connection.url jdbc:jtds:sqlserver://1E1/test;SelectMethod=cursor
#hibernate.jdbc.use_scrollable_resultset false

So does that mean I can't use that driver for Hibernate 2.0? Does your Hibernate 2.1 default hibernate.properties file contain these lines too?


TIA
:)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 22, 2004 5:42 am 
Expert
Expert

Joined: Thu Sep 04, 2003 8:23 am
Posts: 368
Since hibernate 2.0 there is new versions of jtds
jtds 0.9 supports JDBC 3.0. It is the fastest driver for sql server and is fully compatible with hibernate (as far as I am concerned)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 22, 2004 9:31 am 
jTDS Developer
jTDS Developer

Joined: Tue Feb 24, 2004 5:36 pm
Posts: 70
Location: Bucharest, Romania
Starsky,

To get things straight from the start, I am a jTDS developer (just so that I won't be accused of advertising for jTDS). The "not supported" notice has dissapeared starting with Hibernate 2.1.6 or so, jTDS is now the recommended driver for SQL Server, along with the commercial ones (which are really expensive).

However, there are a couple of problems with the properties file. I have pointed these out in another thread but none of the Hibernate developers seemed interested in fixing them. First, it's the "SelectMethod=cursor" addition to the URL; that's Microsoft specific, it has no effect whatsoever on jTDS, i.e. you won't need that. Second, in Hibernate 3.0alpha the "not supported" notice reappeared (probably because 3.0 branched off 2.1 before the notice was taken off. Any Hibernate developers around that can remedy these issues?

Alin.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 22, 2004 10:43 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Yup - please provide a patch for the properties file and i'll apply it :)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 22, 2004 11:07 am 
jTDS Developer
jTDS Developer

Joined: Tue Feb 24, 2004 5:36 pm
Posts: 70
Location: Bucharest, Romania
Max,

Thanks for offering to do this. I already modified my local hibernate.properties file and I don't have the original one to make a diff against, but the idea is this: replace the jTDS configuration block below

Code:
## jTDS (not supported!)
#hibernate.connection.driver_class net.sourceforge.jtds.jdbc.Driver
#hibernate.connection.url jdbc:jtds:sqlserver://1E1/test;SelectMethod=cursor
#hibernate.jdbc.use_scrollable_resultset false

with

Code:
## jTDS
#hibernate.connection.driver_class net.sourceforge.jtds.jdbc.Driver
#hibernate.connection.url jdbc:jtds:sqlserver://1E1/test

Thanks,
Alin.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 22, 2004 11:09 am 
jTDS Developer
jTDS Developer

Joined: Tue Feb 24, 2004 5:36 pm
Posts: 70
Location: Bucharest, Romania
Just in case you are wondering, the hibernate.jdbc.use_scrollable_resultset false is no longer necessary, because jTDS implements full scrollable ResultSet support. I forgot to mention this.

Alin.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 23, 2004 3:28 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
ok - if you can provide me with a jTds version number so i can write

# jTds (since version x.xx)

AND you add this to the JIRA (otherwise there is a risk of me forgetting the patch)

TIA!

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 03, 2004 11:24 pm 
Newbie

Joined: Fri Oct 22, 2004 2:10 am
Posts: 6
I included jtds-0.9 jar into the lib folder of Hibernate, but still i cant connect to MSDE through Hibernate2.0. It still gives me this error msg:

04-Nov-2004 11:05:27,451 ERROR Network error IOException: Connection refused: connect
04-Nov-2004 11:05:27,451 ERROR Network error IOException: Connection refused: connect
04-Nov-2004 11:05:27,471 ERROR Cannot open connection
java.sql.SQLException: Network error IOException: Connection refused: connect
at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:307)
at net.sourceforge.jtds.jdbc.ConnectionJDBC3.<init>(ConnectionJDBC3.java:50)
at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:145)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:140)
at net.sf.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:101)
at net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:286)
at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3326)
at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3286)
at net.sf.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:40)
at net.sf.hibernate.transaction.JDBCTransactionFactory.beginTransaction(JDBCTransactionFactory.java:19)
at net.sf.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:2231)......




I'm using a xml file for my hibernate properties. It looks like this:

<?xml version='1.0' encoding='utf-8'?>

<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

<hibernate-configuration>

<!-- a SessionFactory instance listed as /jndi/name -->
<!-- <session-factory name="java:comp/env/hibernate/SessionFactory">-->

<session-factory>
<!-- properties -->
<property name="hibernate.connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:jtds:sqlserver://localhost/test</property>
<property name="hibernate.connection.username">test123</property>
<property name="hibernate.connection.password">test123</property>
<property name="hibernate.connection.pool.size">10</property>
<property name="hibernate.connection.cache.size">10</property>
<property name="show_sql">false</property>
<property name="use_outer_join">true</property>

<!-- mapping files -->
.....
.....

</session-factory>

</hibernate-configuration>


Is this correct?? Or did I miss out something?? :(


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 04, 2004 2:39 am 
Newbie

Joined: Fri Oct 22, 2004 2:10 am
Posts: 6
Opps... sorry for the previous meg, managed to solved it becuase I realised that the MSDE TCP/IP port is not enabled... ;)

But now i get this error msg instead:



04-Nov-2004 14:32:54,965 ERROR could not read a hi value
java.sql.SQLException: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR.
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:367)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2217)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:1696)
at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:522)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:274)
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:634)
at net.sf.hibernate.id.TableGenerator.generate(TableGenerator.java:93)
at net.sf.hibernate.id.TableHiLoGenerator.generate(TableHiLoGenerator.java:59)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:747)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:720)




Hmmm... anyone has any idea how to solve this? Seems to me that i might need to set some "things" for the jTDS driver.

TIA
:)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 04, 2004 9:04 pm 
Newbie

Joined: Fri Oct 22, 2004 2:10 am
Posts: 6
Problem solved! :)

Found the answer on another forum. I have to include the dialect back in order for it to work.


Many thanks to those who have replied earlier. :)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 05, 2004 2:56 am 
jTDS Developer
jTDS Developer

Joined: Tue Feb 24, 2004 5:36 pm
Posts: 70
Location: Bucharest, Romania
max wrote:
ok - if you can provide me with a jTds version number so i can write

# jTds (since version x.xx)

AND you add this to the JIRA (otherwise there is a risk of me forgetting the patch)

TIA!


Max,

Sorry that it's taken me so long, but I was quite busy at first, then when I tried to change the email address behind this account it got inactivated so I could no longer post.

The supported jTDS version should be 0.9 (or later). Should I still add the issue to JIRA?

Thanks,
Alin.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 05, 2004 7:14 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
yes please

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 05, 2004 9:21 am 
jTDS Developer
jTDS Developer

Joined: Tue Feb 24, 2004 5:36 pm
Posts: 70
Location: Bucharest, Romania
Ok, I created a new JIRA issue, HB-1298. Thanks for taking care of it.

Alin.


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

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.