Guest User

Untitled

a guest
Jan 14th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. How do I connect to local SQL database using java jdbc
  2. try{
  3. Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();
  4. DriverManager.getConnection("jdbc:sqlserver://localhost:1433");
  5.  
  6. }catch(Exception e){
  7. System.out.println("Couldn't get database connection.");
  8. e.printStackTrace();
  9. }
  10.  
  11. Couldn't get database connection.
  12. Oct 06, 2012 11:15:37 PM com.microsoft.sqlserver.jdbc.SQLServerConnection <init>
  13.  
  14. DRIVER CLASS: com.microsoft.sqlserver.jdbc.SQLServerDriver
  15.  
  16. JDBC URL FORMAT: jdbc:sqlserver://<server_name>:<port>
  17.  
  18. jdbc:sqlserver://neptune.acme.com:1433
  19.  
  20. jdbc:sqlserver://127.0.0.1:1433
Add Comment
Please, Sign In to add comment