Click here to Skip to main content
15,949,741 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everybody, i have a problem with hibernate configuration with sql server. I don't know what is exactly the connection string is? So below is my "hibernate.cfg.xml". Please take a look at it and give me some solutions

HTML
<session-factory name="HelloHibernate">
  <property name="hibernate.connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
  <property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
  <property name="hibernate.connection.url">
  jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=dbhellohibernate;username=sa;password=admin
  </property>  
  <!-- Mapping file -->
 	<mapping resource="nguyenle/hello/Message.hbm.xml"/>
 </session-factory>


But when run the test program i have this error: some of them are "could not open a connection"

Please help me, because i'm just a novice with hibernate
Posted

1 solution

which version of MS SQL do you use? and which OS?

With Win 7 SP1(64bit) it's recommended to use MS SQL 2008 R2 - the other version doesn't work.

other suggestions:
Are Username and PW correct?
can you get a ping response from localhost?
 
Share this answer
 
Comments
nguyenle.it 2-Nov-11 11:30am    
I'm using Ms Sql server 2005 and in win 7(32bit), but it have the error like above

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900