public blobtest(String[] args) throws IOException, ClassNotFoundException, SQLException, FileNotFoundException {
String url = args[0];
String usr = args[1];
String pwd = args[2];
// Load the driver
Class.forName("org.postgresql.Driver");
// Connect to database
System.out.println("Connecting to Database URL = " + url);
db = DriverManager.getConnection(url, usr, pwd);
// This is required for all LargeObject calls
System.out.println("Connected... First turn off autoCommit()");
db.setAutoCommit(false);
System.out.println("Now creating a statement");
s = db.createStatement();
// Now run tests using postgresql's own Large object api
// NOTE: The methods shown in this example are _NOT_ JDBC, but are
// an implementation of the calls found in libpq. Unless you need to
// use this functionality, look at the jdbc tests on how to access blobs.
ownapi();
// Now run tests using JDBC methods
//jdbcapi(db,s);
// Finally close the database
System.out.println("Now closing the connection");
s.close();
db.close();
}
|