SHARE
TWEET

Untitled

a guest Jul 17th, 2017 41 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5. package javaapplication1;
  6.  
  7. import java.sql.*;
  8. import com.microsoft.sqlserver.jdbc.*;
  9. import java.util.logging.Level;
  10. import java.util.logging.Logger;
  11.  
  12. public class Main {
  13.  
  14.     public static void main(String[] args) {
  15.         try {
  16.             Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
  17.             String connectionUrl = "jdbc:sqlserver://localhost:1433;" + "databaseName=wypozyczalnia;";
  18.             Connection con = DriverManager.getConnection(connectionUrl, "sa", "wereti");
  19.         } catch (SQLException ex) {
  20.             Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
  21.         } catch (ClassNotFoundException ex) {
  22.             Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
  23.         }
  24.  
  25.  
  26.  
  27.     }
  28. }
RAW Paste Data
Top