/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package javaap2; import java.sql.Connection; import java.sql.DriverManager; /** * * @author Manas */ public class JavaApp2 { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here Connection c = null; try { Class.forName("org.postgresql.Driver"); c = DriverManager .getConnection("jdbc:postgresql://localhost:5432/postgres", "postgres", "postgre_manas9"); } catch (Exception e) { e.printStackTrace(); System.err.println(e.getClass().getName()+": "+e.getMessage()); System.exit(0); } System.out.println("Connected to database successfully"); } }