This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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?
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.
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.
Joined: Jan 20, 2006
Does it have to do anything with the edition of the SQL Server installed?
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.
Joined: Jan 20, 2006
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.