File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes SQL Connection Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "SQL Connection Error" Watch "SQL Connection Error" New topic
Author

SQL Connection Error

S bitz
Ranch Hand

Joined: Jan 20, 2006
Posts: 80
Hi,
This is not exactly a JDBC issue, but when i try to connect to the database using my code in java, it throws a [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
Now i did a netstat but did not find port 1433 even when the SQL Server was running.
Can anyone suggest what is the problem and how can i overcome this problem?
I am in an office LAN, is it a firewall issue?

Thanks,
Bitz
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30294
    
150

Bitz,
It's related enough to JDBC to stay here.

A firewall issue is likely the cause. Talking to whomever set up the firewall sounds like a useful first step.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
S bitz
Ranch Hand

Joined: Jan 20, 2006
Posts: 80
Hi Jeanne,
Well it turned out that the firewall is not ON on my system.
Is there any other reason, why the port is not listening or responding?

Thanks,
Bitz
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

The SQL Server instance you are trying to connect to, is it configured to listen on 1433? Its the default so it should be, but someone might have configured it otherwise. Also is the instance configured to allow connections via TCP/IP? Again, SQL Server 2000 should allow this by default (though be aware 2005 does not)? One last thing to check - if both of the above are true, check the versions of the network dlls SQL server is using; if the instance is not properly patched TCP/IP connections can be configured to be allowed, but don't work (though we're talking very old unpatched instances of SQL Server here).

One other thing (not related to your problem, just general advice) you might consider swapping the driver you are using to the 2005 version (which works fine against 2000 versions, but isn't riddled with bugs and has proper support). Or even better, use jTDS.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

I found something related with your query by google. here is link regarding this issue..
hope its helps you to reslove this.


Saifuddin..
[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30294
    
150

Originally posted by S bitz:
Well it turned out that the firewall is not ON on my system.
Is there any other reason, why the port is not listening or responding?

I was actually thinking about the firewall on the database server, not your machine. Usually a firewall is more strict about incoming connections than outgoing ones. This is similar to Paul's thought about whether the port is open.
S bitz
Ranch Hand

Joined: Jan 20, 2006
Posts: 80
Does it have to do anything with the edition of the SQL Server installed?
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Originally posted by S bitz:
Does it have to do anything with the edition of the SQL Server installed?


Do you mean v6, v7, 2000, 2005 version? Or are you worried whether using the developer edition is a hinderance?

If you are worried about the version, I don't think MS offered a JDBC driver for anything earlier than 2000. There are bugs in the network dlls, if you have old versions of them (as I pointed out earlier). Other tan that both the full edition and the developer edition should work fine.
S bitz
Ranch Hand

Joined: Jan 20, 2006
Posts: 80
Well i did not find a solution to the problem. so the admin guys uninstalled and then re-installed SQL Server Developer edition and now its working fine.
So i think maybe it was the edition that was installed. But i would really like to know why it did not work earlier? Please share any idea you have about it.

Thanks,
Bitz
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SQL Connection Error