File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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

cannot connect to MS SQLServer from other computer

bertin kiek

Joined: Jan 12, 2012
Posts: 3

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: 484

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

Joined: Oct 14, 2005
Posts: 18121

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

Joined: Jan 12, 2012
Posts: 3

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

Joined: Jan 12, 2012
Posts: 3

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:
subject: cannot connect to MS SQLServer from other computer
Similar Threads
URLyBird: 2 questions
Problem in making connection
connection error when running web aplication using Tomcat 6.0
help needed for MS SQL Server
destroy() does not stop Process object