Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

SQL Server 2000 Driver for JDBC - Error establishing sockets

843859Jan 2 2006 — edited Oct 9 2007
Hi there

I am using Microsoft SQL Server 2000 Driver for JDBC to connect to SQL Sever 2000. It is just a test application to see if it would connect to the datacase successfully. But I got the following errors. I already set up the classpath and installed all SQL Server 2000 Driver for JDBC sp 3. Dont know why it still failed...can anyone help me out of this? Thanks.

When i am using simple JDBC-ODBC bridge Driver it's working fine.

For this Server Pack3 , i have checked every thing like--

TCP / IP Poart is Enable.

I am working in client machine, my MSSQLServer 2000 Placed in server Machine.

when i am giving Telnet ServerIP 1433 it's giving following response.
connecting to ServerIP ....... could not open connection to the host , on port 1433:connection Failed

My Sample Code is :--

String user="sa";
String password="imcindia";
Connection con1 = null;
CallableStatement cstmt = null;
-----------
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
con1=DriverManager.getConnection("jdbc:microsoft:sqlserver://ServerName:1433;DatabaseName=dmo1o2d",user,password);


Statement st=con1.createStatement();
st.execute("use dm0102d");
st.execute("setuser 'dm01012'");
----------------------

cstmt = con1.prepareCall("{?=Call dms_ex_create_folder('ABC','18753','NB21','u')}");

----------------------

cstmt.execute();


Here are Error Code :

java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSConnection.<init>(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)
at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Connection refused: connect
at java.sql.DriverManager.getConnection(Unknown Source)
at TestConnection1.main(TestConnection1.java:24)

one can help me to over come this problm,

Thanks in advance.
venkat
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 6 2007
Added on Jan 2 2006
13 comments
2,743 views