Advertisement
Guest User

ExampleReport.java

a guest
Apr 24th, 2017
3,221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.66 KB | None | 0 0
  1. import java.sql.*;
  2. public class ExampleReport
  3. {
  4.     public ExampleReport () {}
  5.     public Connection bukakoneksi () throws SQLException
  6.     {
  7.         Connection con = null;
  8.         try
  9.         {
  10.             Class.forName("com.mysql.jdbc.Driver");
  11.             con = DriverManager.getConnection("jdbc:mysql://localhost/absensi","root","");
  12.             return con;
  13.         }
  14.         catch (SQLException se)
  15.         {
  16.             System.out.println("No Connection Open");
  17.             return null;
  18.         }
  19.         catch (Exception ex)
  20.         {
  21.             System.out.println("Couldn't open connection"+ex);
  22.             return null;
  23.         }
  24.     }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement