| Author |
somebody come in and help me check this error
|
lei zhang
Greenhorn
Joined: Sep 15, 2004
Posts: 14
|
|
I installed SQL sever 2000 in my computer,but i doesn't connected it with the follow TestJDBC class: --------------------------------------------------------------------------- import java.sql.*; public class TestJDBC{ public static void main(String[] args){ try { String url = "jdbc:microsoft:sqlserver://localhost:1433;databaseName=jiaotong"; String username = "java"; String password = "java"; Connection conn = null; System.out.println("1"); Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); System.out.println("2"); conn = DriverManager.getConnection(url, username, password); System.out.println("2" + conn); Statement stmt = conn.createStatement() ; //String strSql = " insert into cat values('1','jdbc','m',0) " ; // stmt.execute( strSql ); stmt.close(); conn.close(); } catch (Exception e) { e.printStackTrace(); } } } -------------------------------------------------------------------------- and the errors are follow: D:\>java TestJDBC 1 2 java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establis hing 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 Sou rce) at com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown S ource) 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) at java.sql.DriverManager.getConnection(Unknown Source) at TestJDBC.main(TestJDBC.java:18) D:\> ------------------------------------------------------------------------- set sql_home=D:\sql set CLASSPATH=%classpath%;%sql_home%\mssqlserver.jar;%sql_home%\msutil.jar;%sql_home%\msbase.jar; plase give me a help, thanks
|
people laugh and people cry.some give up some always try.some say hi while some say bye.others may forget you but never i!!
|
 |
praveen kanakarajan
Ranch Hand
Joined: Apr 27, 2005
Posts: 54
|
|
pls visit the link may be it will help you http://support.microsoft.com/default.aspx?scid=kb;en-us;313178
|
 |
lei zhang
Greenhorn
Joined: Sep 15, 2004
Posts: 14
|
|
thank you praveen k jack
|
 |
 |
|
|
subject: somebody come in and help me check this error
|
|
|