daily pastebin goal
59%
SHARE
TWEET

Untitled

a guest Sep 21st, 2016 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public static void main(String[] args) throws SQLException {
  2.          
  3.        
  4.          try {
  5.                
  6.                     DriverManager.registerDriver(new com.microsoft.sqlserver.jdbc.SQLServerDriver());
  7.             } catch(Exception e) { System.out.println("Could not connect. Errormessage: " + e);}
  8.             try {
  9.            
  10.             Connection con =
  11.             DriverManager.getConnection
  12.             ("jdbc:sqlserver://localhost:1433;" + "databaseName=Inl√§mningsuppgifter;user=sa;password=test123;");
  13.             if (con == null)
  14.                 System.out.println("No driver found");
  15.                 else
  16.                 System.out.println("Connected to database");
  17.            
  18.          
  19.                
  20.             }
  21.              catch(Exception e) { System.out.println("Error message: " + e);
  22.            
  23.             }
  24.            
  25.             }
  26.        
  27.  
  28.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top