code style/openspending
[contractdashboard.git] / admin / neo4jimporter / src / main / java / JDBCExample.java
blob:a/admin/neo4jimporter/src/main/java/JDBCExample.java -> blob:b/admin/neo4jimporter/src/main/java/JDBCExample.java
import java.sql.DriverManager; import java.sql.DriverManager;
import java.sql.Connection; import java.sql.Connection;
import java.sql.SQLException; import java.sql.SQLException;
   
public class JDBCExample { public class JDBCExample {
   
public static void main(String[] argv) { public static void main(String[] argv) {
   
System.out.println("-------- PostgreSQL " System.out.println("-------- PostgreSQL "
+ "JDBC Connection Testing ------------"); + "JDBC Connection Testing ------------");
   
try { try {
   
Class.forName("org.postgresql.Driver"); Class.forName("org.postgresql.Driver");
   
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
   
System.out.println("Where is your PostgreSQL JDBC Driver? " System.out.println("Where is your PostgreSQL JDBC Driver? "
+ "Include in your library path!"); + "Include in your library path!");
e.printStackTrace(); e.printStackTrace();
return; return;
   
} }
   
System.out.println("PostgreSQL JDBC Driver Registered!"); System.out.println("PostgreSQL JDBC Driver Registered!");
   
Connection connection = null; Connection connection = null;
   
try { try {
   
connection = DriverManager.getConnection( connection = DriverManager.getConnection(
"jdbc:postgresql://127.0.0.1:5432/contractDashboard", "postgres", "jdbc:postgresql://127.0.0.1:5432/contractDashboard", "postgres",
"snmc"); "snmc");
   
} catch (SQLException e) { } catch (SQLException e) {
   
System.out.println("Connection Failed! Check output console"); System.out.println("Connection Failed! Check output console");
e.printStackTrace(); e.printStackTrace();
return; return;
   
} }
   
if (connection != null) { if (connection != null) {
System.out.println("You made it, take control your database now!"); System.out.println("You made it, take control your database now!");
} else { } else {
System.out.println("Failed to make connection!"); System.out.println("Failed to make connection!");
} }
} }
   
} }