This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JDBC and the fly likes cannot connect to MS SQLServer from other computer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "cannot connect to MS SQLServer from other computer" Watch "cannot connect to MS SQLServer from other computer" New topic
Author

cannot connect to MS SQLServer from other computer

bertin kiek
Greenhorn

Joined: Jan 12, 2012
Posts: 3
Hi,

I created a Java program (java 6) that uses a JDBC connector (sqljdbc4.jar) to connect to SQLServer (Express) on another server. The program runs fine when it runs it on my development laptop (started from Eclipse). When I deploy the program to another computer it does not work. When I start it, as soon as it tries to get results from the database (exactly the same database), nothing happens anymore.


Checked the database, queried on sys.sysprocesses. I see one process (for my application) but not blocking. I see some strange things there, hostprocess is 0 (all other enries have a number there and net_address is 000000000000 all other enties have a hexadecimale number, sql_handle also 0, all entries have a number there.

If I kill this process in the database, then the program continues working (with an error message about a connection reset).

So why does it work from one computer and not from another.

Regards Bertin
Nam Ha Minh
Ranch Hand

Joined: Oct 31, 2011
Posts: 498

It's hard for me to tell where the problem might be at, without any errors/exceptions detailed.


PM Me If You Want to get Urgent Help on Java Programming
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Yes, indeed. A stack trace would be the thing to look at. Otherwise the problem could be almost anything -- you didn't deploy the driver jar along with the application, you didn't put it in the right place, you wrote your code to connect to the database via "localhost", you have a firewall blocking communication -- the list is endless.
bertin kiek
Greenhorn

Joined: Jan 12, 2012
Posts: 3
Hi,

the problem is there are no messages.

To isolate the problem, I created a runnable jar. If I execute it from my laptop it works fine, which means I just test if I can make a connection.

If I copy the Jar to my production server and start it, it just hangs. On the database I can see a process then and if I kill that process I just get a Connection Reset error message in my application.

Tested it from yet another computer and it works fine again.

Regards Bertin

bertin kiek
Greenhorn

Joined: Jan 12, 2012
Posts: 3
Solved,

tested my app on various computers. Noticed that only computers with java version 1.6.0_29 did not work. Lower versions and higher versions work well. After upgrade 1.6.0_29 computers to 1.6.0_30 they work well too.

Regards Bertin
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: cannot connect to MS SQLServer from other computer