This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Building Blockchain Apps and have Michael Yuan on-line!
See this thread for details.
Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

Error Establishing Socket

 
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.
 
Marshal
Posts: 67366
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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
 
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
Marshal
Posts: 67366
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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.
 
He got surgery to replace his foot with a pig. He said it was because of this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!