<public class JavaApplication2 { /** * @param args the command line arguments */ public static void main(String[] args) { try { Class.forName("com.microsoft.sqlserver.jdbc.SQLSer verDriver"); String connectionUrl = "jdbc:sqlserver://localhost:1433;databaseName=Attendance;user=suhail ;password=123456"; Connection con = DriverManager.getConnection(connectionUrl); // String connectionUrl = "jdbc:sqlserver://localhost;integratedSecurity=true"; // Connection con = DriverManager.getConnection(connectionUrl); } catch (SQLException e) { System.out.println("SQL Exception: " + e.toString()); } catch (ClassNotFoundException cE) { System.out.println("Class Not Found Exception: " + cE.toString()); } } } >
Error msg am getting as:-
"SQL Exception: com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host 192.168.0.71, 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."."
plz help me i have tried many ways for getting connection but still failed to do so
Thanks