Advertisement
Guest User

Untitled

a guest
Mar 21st, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. <dependency>
  2. <groupId>com.microsoft.sqlserver</groupId>
  3. <artifactId>mssql-jdbc</artifactId>
  4. <version>6.1.5.jre8-preview</version>
  5. </dependency>
  6.  
  7. String connectionString =
  8. "jdbc:sqlserver://192.168.66.66:1433;"
  9. + "database=MainDataBase;"
  10. + "user=user@192.168.36.26;"
  11. + "password=password;"
  12. + "encrypt=true;"
  13. + "trustServerCertificate=false;"
  14. + "hostNameInCertificate=*.database.windows.net;"
  15. + "loginTimeout=30;";
  16.  
  17. Connection connection = null;
  18.  
  19. try {
  20. connection = DriverManager.getConnection(connectionString);
  21. }
  22. catch (Exception e) {
  23. e.printStackTrace();
  24. }
  25. finally {
  26. if (connection != null) try { connection.close(); } catch(Exception e) {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement