Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Connecting to sql server

Author  Topic 

samee
Starting Member

15 Posts

Posted - 2005-02-11 : 05:22:08
Hi all,

This is my application
/////////////////////////////
import java.sql.*;
import javax.swing.*;


class A{
public void conn(){


try{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
JOptionPane.showMessageDialog(null,"Driver Ok");
Connection conn =

DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;user=user;password=pass");
JOptionPane.showMessageDialog(null,"SQL Ok");
Statement stmt=conn.createStatement( );
JOptionPane.showMessageDialog(null,"Connect Ok");
}
catch(Exception e){
JOptionPane.showMessageDialog(null,"Error");
System.out.println(e);
}




}
public static void main(String [] args){
A a=new A();
a.conn();
}
}

////////////////////////////////////

after runing

/////////////////////////////
C:\test>javac A.java

C:\test>java A
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establis
hing socket.

C:\test>
/////////////////////////////
Can any one give a an solution to this error

Thank You


JKNIGHT

Andraax
Aged Yak Warrior

790 Posts

Posted - 2005-02-11 : 06:44:21
Try with 127.0.0.1 instead of localhost in the url. Also check your network settings to ensure that you use TCP/IP.
Go to Top of Page

samee
Starting Member

15 Posts

Posted - 2005-02-11 : 07:04:06
Thank a Lot
But changing of the ip address from localhost to 127.0.0.1 did not help and this checking of tcp/ip I don’t know how to do it
Can you tell me
Thank You


JKNIGHT
Go to Top of Page

Andraax
Aged Yak Warrior

790 Posts

Posted - 2005-02-11 : 08:35:56
Hmm try this
Connection conn = DriverManager.getConnection
("jdbc:microsoft:sqlserver://127.0.0.1:1433","user","pass");

instead of what you have now. Just wanna make sure.
Go to Top of Page
   

- Advertisement -