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.
"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
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
Joined: May 11, 2004
Posts: 32
posted
0
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
"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
Joined: May 11, 2004
Posts: 32
posted
0
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.
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
Joined: May 11, 2004
Posts: 32
posted
0
Thanks a lot, David! You are correct, I was given a wrong server name.