Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.sql.*;
- import com.microsoft.sqlserver.jdbc.*;
- public class Main {
- public static void main(String[] args) {
- String connectionString = "jdbc:sqlserver://localhost:1433;"
- +"database=QMT;"
- +"user=superadmin;"
- +"password=myPassword.;";
- // Declare the JDBC objects.
- 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