Re: Large Objects - Mailing list pgsql-jdbc

From Daniel Fisher
Subject Re: Large Objects
Date
Msg-id 01072712484104.01029@psych.ward.vt.edu
Whole thread Raw
In response to RE: Large Objects  (PERIN Pascal <pascal.perin@sacem.fr>)
List pgsql-jdbc
Yeah that line is in my code.
See the source below.

--
Daniel Fisher


On Friday 27 July 2001 12:13, you wrote:
> Hi,
>
> You should verify that you are in a transactionnal mode ie this line might
> appear :
> myConnection.setAutoCommit(false);
>
> If not, you problem might be solved.
> Hope this helps
> Pascal
>
> -------------------------------
> Pascal PERIN
> SESAM - Chargé de mission
> Tel :  33 1 47 15 49 66
> Fax : 33 1 47 15 49 75
> http://www.sesam.org
> -------------------------------
>
> > -----Message d'origine-----
> > De:    Daniel Fisher [SMTP:dfisher@vt.edu]
> > Date:    vendredi 27 juillet 2001 18:00
> > À:    pgsql-jdbc@postgresql.org
> > Objet:    [JDBC] Large Objects
> >
> > 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

pgsql-jdbc by date:

Previous
From: Philip Crotwell
Date:
Subject: Re: Large Objects
Next
From: Daniel Fisher
Date:
Subject: Re: Large Objects