By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,905 Members | 900 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,905 IT Pros & Developers. It's quick & easy.

SQL Server 2000 Driver for JDBC - Error establishing sockets

P: 30
Hi,

I am using Microsoft SQL Server 2000 Driver for JDBC to connect to SQL Sever 2000. It is just a test application whether its connect or not. But I got the following errors:

Error is:
javax.servlet.ServletException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.


I installed the windows xp sp2, jdk5 and tomcat 4.I have already tried the all posibilities like Server Network Utility, Firewall and etc.

Here is my code:

<%@ page language="java" contentType="text/html" import="java.sql.*" %>
<%! Connection con; Statement st; ResultSet rs; %>
<%
try
{
Class.forName("com.microsoft.jdbc.sqlserver.SQLSer verDriver");

con=DriverManager.getConnection("jdbc:microsoft:sq lserver://localhost:1433;DatabaseName=VFS","sa","");
st=con.createStatement();
rs=st.executeQuery("select * from test");
while(rs.next())
{
out.println(rs.getString(1));
}
}
catch(Exception e)
{
out.println("Error -----> "+e);
}
%>

If anybody know the answer, please post ur suggestion.



Thanks in advance.


Thanks & Regards,


V. Prasath
Sep 21 '07 #1
Share this Question
Share on Google+
2 Replies


P: 58
Hi,

I am using Microsoft SQL Server 2000 Driver for JDBC to connect to SQL Sever 2000. It is just a test application whether its connect or not. But I got the following errors:

Error is:
javax.servlet.ServletException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.


I installed the windows xp sp2, jdk5 and tomcat 4.I have already tried the all posibilities like Server Network Utility, Firewall and etc.

Here is my code:

<%@ page language="java" contentType="text/html" import="java.sql.*" %>
<%! Connection con; Statement st; ResultSet rs; %>
<%
try
{
Class.forName("com.microsoft.jdbc.sqlserver.SQLSer verDriver");

con=DriverManager.getConnection("jdbc:microsoft:sq lserver://localhost:1433;DatabaseName=VFS","sa","");
st=con.createStatement();
rs=st.executeQuery("select * from test");
while(rs.next())
{
out.println(rs.getString(1));
}
}
catch(Exception e)
{
out.println("Error -----> "+e);
}
%>

If anybody know the answer, please post ur suggestion.



Thanks in advance.


Thanks & Regards,


V. Prasath
Enable the Tcp/Ip protocol in sql server settings and restart sql server,if its not working after this stuffs,try to reinstall ur sql server,make sure tat u enable Tcp/Ip settings while installing.

Thanks&Regards,
Sundar.
Sep 21 '07 #2

P: 30
Enable the Tcp/Ip protocol in sql server settings and restart sql server,if its not working after this stuffs,try to reinstall ur sql server,make sure tat u enable Tcp/Ip settings while installing.

Thanks&Regards,
Sundar


Thanks for your reply...

Where to enable the tcp/ip protocol in sql server you mean Server Network Utility, i have already tried all possibilities including uninstall and reinstall.
How to enable the tcp/ip when I install the sql server 2000?


Thanks & Regards,

V. Prasath
Sep 22 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.