Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error Establishing Socket

 
Hope Zhu
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a stand alone app to connect to a remote SQL server db. It worked fine until I changed the database URL to "jdbc:microsoft:sqlserver://10.XXX.XXX.XX\\ENGINE:1433;DatabaseName=TEST". I keep getting "SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket" whenever I call DriverManager.getConnection. I don't know if it's because of "\\" in url. I am stuck here, can someone please help.
Thanks in advance.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64844
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Hope",
We're pleased to have you here with us in the JDBC forum, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.
In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.
Thanks!
bear
Forum Bartender
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The most obvious question is: can you ping the remote machine?
The second most obvious is: is there a database server running on that machine?
 
Hope Zhu
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear,
Thanks for reminding me to add my last name. But I can't change my first name. You may think "Hope" is obviously fictitious, but it has been my English name for more than 10 years.
Hope
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64844
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Hope" is absolutely fine, Hope. It was the lack of a last name that triggered the reminder.
thanks for complying!
bear
 
Hope Zhu
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David,
Thanks for your prompt reply. To your questions, my answer is:
Yes, I can ping the remote machine and I am 100% sure there is a SQL server database running on that machine. Actually I can connect to that database from my machine via Enterprise Manager if a server alias has been created for that server.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure your database URL is correct. I don't use sqlserver very often, but from searching around it looks like the format should be more like:

I'm not sure what 'ENGINE' refers to, but try:

My guess is that ENGINE is the machine name, and you only need the IP or the name, not both.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A handy way to debug JDBC URL problems without needing to recompile is to use a Java Database client like Squirrel SQL. You can put in your connection details to see if it works, ad just try again if it doesn't.
You can get Squirrel (for free) here
 
Hope Zhu
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot, David! You are correct, I was given a wrong server name.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic