-->
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.  [ 1 post ] 
Author Message
 Post subject: Hibernate3 connection to SQL server 2005
PostPosted: Fri Aug 07, 2009 2:48 am 
Newbie

Joined: Fri Aug 07, 2009 2:38 am
Posts: 1
Hi

I am using hibernate3.jar and sqljdbc.jar for connecting to SQL server 2005. Both the jars are present in my application WEB-INF folder.

In hibernate.cfg.xml, the configuration is as follows:-
Code:
   
              <session-factory>
      <property name="connection.useUnicode">true</property>
      <property name="connection.characterEncoding">UTF-8</property>
      <property name="connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
      <property name="connection.url">jdbc:sqlserver://localhost/test</property>
      <property name="connection.username">sa</property>
      <property name="connection.password">password</property>
      <property name="dialect">org.hibernate.dialect.SQLServerDialect</property>
      <property name="currrent_session_context_class">thread</property>
      <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
      <mapping resource="com/nec/cdas/bean/hbm/User.hbm.xml"/>
   </session-factory>


When I run the application, not being able to connect to the DB, getting the following error:-
Quote:
opening new JDBC connection
12:05:48,862 WARN SettingsFactory:109 - Could not obtain connection metadata
com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host has failed. java.net.UnknownHostException:


Using the same username/password, I can connect to the DB 'test' using other programs. Where am I wrong?

Thanx,
rash2002


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

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.