Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Network error while connecting to sql server

I am using sql server 2008 and jtds driver to establish a connection between sql server and the jsp application. I code i used is

  java.sql.SQLException: Network error IOException: Connection refused: connect
     String url= "jdbc:jtds:sqlserver://127.0.0.1/sfts";
String id= "sfts";
String pass = "sfts";
try{
     Class.forName("net.sourceforge.jtds.jdbc.Driver");
     con = java.sql.DriverManager.getConnection(url, id, pass);
    }catch(Exception e){
                out.println(e);
     }

While running this code, it showing error as

  java.sql.SQLException: Network error IOException: Connection refused: connect

TCP/IP was set enabled and port number was set to 1433. But still it is showing this error.. What to do now??

like image 465
user636207 Avatar asked Nov 29 '11 07:11

user636207


1 Answers

Goto AllProgram->SQL Server 2008->configuraton tools->SQL Server Configuration Manager->SQL Server Network Configuration-> Select your server instance and right click on TCP/IP then goto IPAddresses. Change/Place port number for all IP's as 1433. Save it and restart the server. It Should solve your problem

like image 147
RAVITEJA SATYAVADA Avatar answered Sep 19 '22 12:09

RAVITEJA SATYAVADA