import java.util.*; import java.sql.*; public class DropUpdateAPI { // Change the following values to meet your settings // --- public static String dblocation = "localhost:5432"; public static String dbname = "apitest"; public static String username = "saxtouri"; public static String password = ""; // --- public static void main(String[] args) { try { Class.forName("org.postgresql.Driver"); } catch(java.lang.ClassNotFoundException ex) { System.out.println(ex.getMessage()+ ": PostgreSQL driver is not found. \nCheck if the CLASSPATH variable contains the postgresql.jar path."); } //change dbURL to reflect the machine/port postmaster is running and //the name of your db String dbURL = "jdbc:postgresql://"+dblocation+"/"+dbname ; Properties info = new Properties(); info.setProperty("user", username); info.setProperty("password", password); try { Connection con = DriverManager.getConnection(dbURL, info); //begin the transaction con.setAutoCommit(false); Statement stmt = con.createStatement(); ResultSet rs = null; int retVal = -1; // drop create_instance try{stmt.executeQuery("drop function create_instance(text,text,text)");} catch(SQLException e1){} // drop delete_object try{stmt.executeQuery("drop function delete_object(text, text, text, int4)");} catch(SQLException e1){} // drop add_property try{stmt.executeQuery("drop function add_property(text, text, text, text)");} catch(SQLException e1){} // drop delete_property try{stmt.executeQuery("drop function delete_property(text, text, text, text, int4)");} catch(SQLException e1){} // drop update_property try{stmt.executeQuery("drop function update_property(text, text, text, text, text, int4)");} catch(SQLException e1){} //commit the transaction con.commit(); System.out.println("Transaction committed!"); if (stmt != null) stmt.close(); } catch(SQLException ex) { System.out.println("SQLException: " + ex.getMessage()); ex.printStackTrace(); } } }