Advertisement
Guest User

Untitled

a guest
Dec 6th, 2016
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.52 KB | None | 0 0
  1. import java.sql.Connection;
  2. import java.sql.DriverManager;
  3. import java.sql.Statement;
  4.  
  5. public class Connect
  6. {
  7.     public static void main(String[] args)
  8.     {
  9.         try
  10.         {
  11.             Class.forName("org.postgresql.Driver");
  12.             Connection con = DriverManager.getConnection("jdbc::postgresql://localhost:5432/postgres", "postgres", "ankara");
  13.             if(con != null)
  14.                 System.out.println("Connected");
  15.            
  16.             Statement st = con.createStatement();
  17.             String sql;
  18.         }
  19.         catch(Exception ee)
  20.         {
  21.             ee.printStackTrace();
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement