Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void createConnection() throws ClassNotFoundException, SQLException {
- String hostName = "dsp.database.windows.net";
- String dbName = "University";
- String user = "dsp";
- String password = "Abc12345.";
- String url = String.format(
- "jdbc:sqlserver://%s:1433;database=%s;user=%s;password=%s;encrypt=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;",
- hostName, dbName, user, password);
- try {
- connection = DriverManager.getConnection(url);
- String schema = connection.getSchema();
- System.out.println("Successful connection - Schema: " + schema);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement