-->
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: help hibernate+sql server 2005
PostPosted: Fri Apr 30, 2010 10:03 am 
Newbie

Joined: Fri Aug 14, 2009 9:35 am
Posts: 3
I try to connect to sql server 2005 with hibernate but it seem it has a problem, I wrote .cfg.xml file but it shown me an error about hibernate.proprties, I undersood that these two ways to connect with hibernate, then I wrote the hibernate.proprties file:

hibernate.connection.username=USER-8E1B173EC4\User
hibernate.connection.password=
hibernate.connection.url=jdbc:jtds:sqlserver://localhost:1433;DatabaseName=Babies
hibernate.connection.driver_class=net.sourceforge.jtds.jdbc.Driver
hibernate.dialect=org.hibernate.dialect.SQLServerDialect

the hibernate .cfg.xml file:

<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC

"-//Hibernate/Hibernate Mapping DTD 3.0//EN"

"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:jtds:sqlserver://localhost:1433;DatabaseName=Babies</property>
<property name="hibernate.connection.username">USER-8E1B173EC4\User</property>
<property name="hibernate.connection.password"></property>
<property name="dialect">org.hibernate.dialect.SQLServerDialect</property>
<!-- Mapping files -->
<property name="show_sql">true</property>
<mapping resource="Test.hbm.xml?"/>
</session-factory>
</hibernate-configuration>

and then I have this error:

java.sql.SQLException: Network error IOException: Connection refused: connect

this is the same error when I tried to connect to sql server through java code directly, and the same error message then.

what is worng here? someone has a guide that explain how to connect the sql server through hibernate step by step, because I didn't found in the net.
I use the jTDS driver 1.2.5

thanks for the help!


Top
 Profile  
 
 Post subject: Re: help hibernate+sql server 2005
PostPosted: Sun May 02, 2010 6:41 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
check port and credentials to access your database without hibernate: database is refusing connection, doesn't look like a hibernate problem, unless you misspelled credentials / jdbc url

_________________
Sanne
http://in.relation.to/


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.