Large Objects

From: Daniel Fisher <dfisher(at)vt(dot)edu>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Large Objects
Date: 2001-07-27 15:59:54
Message-ID: 01072711595403.01029@psych.ward.vt.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

I'm am attempting to make one of my Java servlets work with both MySQL & Postgres.
I'm having some trouble inserting a large object into the database.
I'm fairly certain that the problem is in my java code because I wrote some quick PHP code and it worked fine.
The main problem is I'm not getting any errors, so I'm kinda stumped.
The code appears to run fine, but nothing is being inserted into the database.
Any help would be appreciated.

----- Here is my Java source -----

// getConnection gives me a database connection
// image is a byte[] passed to this function

Connection conn = null;
PreparedStatement pstmt = null;

try {

conn = getConnection();
conn.setAutoCommit(false);
pstmt = conn.prepareStatement("INSERT INTO dfisher (image) VALUES (?)");
pstmt.setBytes(1, image);
pstmt.executeUpdate();

} catch (Exception e) {
e.printStackTrace();
}
finally {
try { if (pstmt != null) pstmt.close(); } catch (Exception e) { e.printStackTrace(); }
try { if (conn != null) conn.close(); } catch (Exception e) { e.printStackTrace(); }
}
}

----- Here is my Postgres log -----

/usr/local/bin/postmaster: BackendStartup: pid 54277 user dfisher db dfisher socket 8
FindExec: found "/usr/local/bin/postgres" using argv[0]
2001-07-27 11:51:35 [54277] DEBUG: connection: host=127.0.0.1 user=dfisher database=dfisher
2001-07-27 11:51:35 [54277] DEBUG: StartTransactionCommand
2001-07-27 11:51:35 [54277] DEBUG: query: set datestyle to 'ISO'; select getdatabaseencoding()
2001-07-27 11:51:35 [54277] DEBUG: ProcessUtility: set datestyle to 'ISO'; select getdatabaseencoding()
2001-07-27 11:51:35 [54277] DEBUG: CommitTransactionCommand
2001-07-27 11:51:35 [54277] DEBUG: StartTransactionCommand
2001-07-27 11:51:35 [54277] DEBUG: query: begin
2001-07-27 11:51:35 [54277] DEBUG: ProcessUtility: begin
2001-07-27 11:51:35 [54277] DEBUG: CommitTransactionCommand
2001-07-27 11:51:35 [54277] DEBUG: StartTransactionCommand
2001-07-27 11:51:35 [54277] DEBUG: query: SET TRANSACTION ISOLATION LEVEL READ COMMITTED
2001-07-27 11:51:35 [54277] DEBUG: ProcessUtility: SET TRANSACTION ISOLATION LEVEL READ COMMITTED
2001-07-27 11:51:35 [54277] DEBUG: CommitTransactionCommand
2001-07-27 11:51:35 [54277] DEBUG: StartTransactionCommand
2001-07-27 11:51:35 [54277] DEBUG: query: select proname, oid from pg_proc where proname = 'lo_open' or proname = 'lo_close' or proname = 'lo_creat' or proname = 'lo_unlink' or proname = 'lo_lseek' or proname = 'lo_tell' or proname = 'loread'
or proname = 'lowrite'
2001-07-27 11:51:35 [54277] DEBUG: CommitTransactionCommand
2001-07-27 11:51:35 [54277] DEBUG: StartTransactionCommand
2001-07-27 11:51:35 [54277] DEBUG: CommitTransactionCommand
2001-07-27 11:51:35 [54277] DEBUG: StartTransactionCommand
2001-07-27 11:51:35 [54277] DEBUG: CommitTransactionCommand
2001-07-27 11:51:35 [54277] DEBUG: StartTransactionCommand
2001-07-27 11:51:35 [54277] DEBUG: CommitTransactionCommand
2001-07-27 11:51:35 [54277] DEBUG: StartTransactionCommand
2001-07-27 11:51:35 [54277] DEBUG: CommitTransactionCommand
2001-07-27 11:51:35 [54277] DEBUG: StartTransactionCommand
2001-07-27 11:51:35 [54277] DEBUG: query: INSERT INTO dfisher (image) VALUES (19291)
2001-07-27 11:51:35 [54277] DEBUG: CommitTransactionCommand
/usr/local/bin/postmaster: reaping dead processes...
/usr/local/bin/postmaster: CleanupProc: pid 54277 exited with status 0

----- Here is my JServ log -----

DriverManager.getConnection("jdbc:postgresql://localhost:5432/dfisher?user=dfisher&password=dfisher")
trying driver[className=org.postgresql.Driver,org(dot)postgresql(dot)Driver(at)e08d1172]
getConnection returning driver[className=org.postgresql.Driver,org(dot)postgresql(dot)Driver(at)e08d1172]
Large Object initialised

--
Daniel Fisher

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message PERIN Pascal 2001-07-27 16:13:14 RE: Large Objects
Previous Message Dave Cramer 2001-07-27 01:39:45 RE: problem with serialization