Re: Large Objects
От | Daniel Fisher |
---|---|
Тема | Re: Large Objects |
Дата | |
Msg-id | 01072712534905.01029@psych.ward.vt.edu обсуждение исходный текст |
Ответ на | Re: Large Objects (Philip Crotwell <crotwell@seis.sc.edu>) |
Список | pgsql-jdbc |
I tried that but I got the same results. -- Daniel Fisher On Friday 27 July 2001 12:36, you wrote: > You probably need to add a conn.commit(); statement after the > executeUpdate. > > Philip > > On Fri, 27 Jul 2001, Daniel Fisher wrote: > > 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?use > >r=dfisher&password=dfisher") trying > > driver[className=org.postgresql.Driver,org.postgresql.Driver@e08d1172] > > getConnection returning > > driver[className=org.postgresql.Driver,org.postgresql.Driver@e08d1172] > > Large Object initialised > > > > > > -- > > Daniel Fisher > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 5: Have you checked our extensive FAQ? > > > > http://www.postgresql.org/users-lounge/docs/faq.html > > ------------------------------------------------------------------------ > Philip Crotwell (803)777-0955 (803)777-0906 fax crotwell@seis.sc.edu > ------------------------------------------------------------------------
В списке pgsql-jdbc по дате отправления: