Guest User

Untitled

a guest
Dec 27th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.37 KB | None | 0 0
  1. import java.sql.*;
  2.  
  3.  
  4. public class Main {
  5. public static void main(String[] args) {
  6.  
  7. String userName ="testlogin2";
  8. String password ="pass";
  9.  
  10. String url ="jdbc:sqlserver://localhost/LabNoteMap;integratedSecurity=true;"; //LabNoteMap beeing target db
  11. try {
  12. Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
  13. Connection conn = DriverManager.getConnection(url, userName, password);
  14. } catch (ClassNotFoundException e) {
  15. e.printStackTrace();
  16. } catch (SQLException e) {
  17. e.printStackTrace();
  18. }
  19.  
  20. System.out.println("end");
  21. }
  22. }
  23.  
  24. "C:Program FilesJavajdk-9binjava" "-javaagent:C:Program FilesJetBrainsIntelliJ IDEA 2017.2.5libidea_rt.jar=63510:C:Program FilesJetBrainsIntelliJ IDEA 2017.2.5bin" -Dfile.encoding=UTF-8 -classpath C:UsersDeusIdeaProjectstestMYSQLoutproductiontestMYSQL;C:UsersDeusDesktopjdbcsqljdbc_6.0enujre8sqljdbc42.jar Main
  25. end
  26. com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host localhost/LabNoteMap, port 1433 has failed. Error: "localhost/LabNoteMap. 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.".
  27. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:191)
  28. at com.microsoft.sqlserver.jdbc.SQLServerException.ConvertConnectExceptionToSQLServerException(SQLServerException.java:242)
  29. at com.microsoft.sqlserver.jdbc.SocketFinder.findSocket(IOBuffer.java:2369)
  30. at com.microsoft.sqlserver.jdbc.TDSChannel.open(IOBuffer.java:551)
  31. at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1963)
  32. at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:1628)
  33. at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1459)
  34. at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:773)
  35. at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1168)
  36. at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:678)
  37. at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:229)
  38. at Main.main(Main.java:13)
  39.  
  40. Process finished with exit code 0
Add Comment
Please, Sign In to add comment