Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) throws SQLException {
- try {
- DriverManager.registerDriver(new com.microsoft.sqlserver.jdbc.SQLServerDriver());
- } catch(Exception e) { System.out.println("Could not connect. Errormessage: " + e);}
- try {
- Connection con =
- DriverManager.getConnection
- ("jdbc:sqlserver://localhost:1433;" + "databaseName=Inlämningsuppgifter;user=sa;password=test123;");
- if (con == null)
- System.out.println("No driver found");
- else
- System.out.println("Connected to database");
- }
- catch(Exception e) { System.out.println("Error message: " + e);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement