Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error connecting to MSSQL Server from Hibernate

 
Sushma Sharma
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI All,

I am newbie to Hibernate and i m trying one of tutorials. problem is that I am getting the following error when I run my application



I have specified all the details needed to connect to MS SQL Server in hibernate.cfg.xml and hibernate.properties both. below is the code for both

hibernate.cfg.xml



hibernate.proerties


Please tell me what am I doing wrong....
Any suggestions are welcome

Regards

Sushma
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have a login defined in MSSQL called 'Administrator' which requires no password? This seems unlikely, since as far as I'm aware you can't define a login with no password.
 
Sushma Sharma
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, my username id Administrator and it doesn't have a password. Actually, its my windows password and I am using the windows login for MS SQL Server also.... is that a problem? I am able to connect to MS SQL Server. I am not sure why I am getting

java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket


Is this because of password is empty?
I'll try creating some other user and try with that...
 
Pavan Tummala
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jdbc:microsoft:sqlserver://localhost:1433;=master;selectMethod=cursor

typo???
 
Hiroshi Tominaga
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Did you check if the SQL servers has the 1433 port available?
Try the following command: telnet <serverName> 1433

Check in the sqlServer if the TCP/IP protocol is enable.
Check if the Database is started.
Check for the domain of the Database, if you are in the same domain.


best regards
 
samdeep aarzoo
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
telnet <serverName> 1433
what is the use of this command at telenet

i write this on console
and i got only cursor blinks what does this show
what is the use of this command
and what we are checking through this
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sushma Sharma:
yes, my username id Administrator and it doesn't have a password. Actually, its my windows password and I am using the windows login for MS SQL Server also.... is that a problem?

Yes it is a problem. You need to change the authentication method your MSSQL instance uses to "SQL Server and Windows" and connect to it with a database account, rather than using Windows integrated authentication.
 
Sham Grandhe
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey use the below link to change your SQL Server Login setting from window authentication to SQL Server and Window Authentication

http://www-1.ibm.com/support/docview.wss?uid=swg21119906

this might help your resolve the SQL Server Error 18452
 
Sham Grandhe
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by sandeep mittal:
telnet <serverName> 1433
what is the use of this command at telenet

i write this on console
and i got only cursor blinks what does this show
what is the use of this command
and what we are checking through this


waw check the above mentioned steps you should be able to resolve the issue.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please pay attention to the date of posts. It is very unlikely that Sushma Sharma is still waiting for an answer to a question they posted almost three years ago.

Also:

Yes it is a problem. You need to change the authentication method your MSSQL instance uses to "SQL Server and Windows" and connect to it with a database account, rather than using Windows integrated authentication

This is not true any more. Most SQL Server JDBC drivers support NTLM these days.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic