com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused: connect. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall
im using java netbeans and ms sql server 2008 r2 and sqljdbc4 jar file
here my codes
try{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
Connection conn = DriverManager.getConnection ("jdbc:sqlserver://localhost:1433;database=database1;integratedSecurity=true;");
JOptionPane.showMessageDialog(null, "Connection Established");
return conn;
}catch(Exception e){
System.out.print(e);
return null;
}

New Topic/Question
Reply



MultiQuote







|