Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <dependency>
- <groupId>com.microsoft.sqlserver</groupId>
- <artifactId>mssql-jdbc</artifactId>
- <version>6.1.5.jre8-preview</version>
- </dependency>
- String connectionString =
- "jdbc:sqlserver://192.168.66.66:1433;"
- + "database=MainDataBase;"
- + "user=user@192.168.36.26;"
- + "password=password;"
- + "encrypt=true;"
- + "trustServerCertificate=false;"
- + "hostNameInCertificate=*.database.windows.net;"
- + "loginTimeout=30;";
- Connection connection = null;
- try {
- connection = DriverManager.getConnection(connectionString);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- finally {
- if (connection != null) try { connection.close(); } catch(Exception e) {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement