Actually, I didn't mean change the pool as that would change for
everything you did with connections from the pool. I meant just change it
for your local connection.

e.g. conn.setAutocommit(false);

This is code we built back in JBoss 2.2 days against Oracle - we don't
have an in-house Oracle as it chews too many resources, so I can't
reverify the code operation against current JBoss builds. Assuming that
nothing has changed, we used to have to turn off the autocommit. I can't
tell you exactly the mechanics of why the pooled connection acts this way,
but it does.

    // Oracle customisation
    public boolean setImage(ImageLocator imageLocator, Image image)
    {
        PreparedStatement updateImage = null;
        boolean imageSet = false;
        String sqlString = retrieveSQLCache(imageLocator);
        Connection connection = connectionPool.retrieveConnection();
        if (connection != null)
        {
            try
            {
                connection.setAutoCommit(false);
                updateImage = connection.prepareStatement(sqlString);
                updateImage.setString(1, image.getImageName());
                updateImage.setInt(2, image.getImageType());
                updateImage.setInt(3, image.getLength());
                updateImage.executeUpdate();
                imageSet = createBlob(imageLocator, image, connection);
            }
            catch(Exception e)
            {
                String variables = "imagename=" + image.getImageName() +
", length="
                    + image.getLength() + ", imagetype = " +
image.getImageType();
                localEvent.setMethod("setImage");
                localEvent.setSeverity(EventType.SEVERE);
                localEvent.setException(e.toString());
                localEvent.setMessage("Failed to set image.");
                localEvent.setVariables(variables);
                localEvent.setSQL(sqlString);
                localEvent.setDate(new java.util.Date());
                logEvent(localEvent);
            }
            closePreparedStatement(updateImage);
            completeTransaction(sqlString, connection, imageSet);
            setAutoCommit(connection, true);
            closeConnection(connection);
        }
        return imageSet;
    }

Hope this helps - at least it is something to try, rather than theorising
about it. :) To badly misquote Bob Colwell, calibrate your foot and kick
the tyres.

JonB

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Karl Koster
> Sent: Wednesday, 2 July 2003 12:42 AM
> To: [EMAIL PROTECTED]
> Subject: RE: [JBoss-user] Oracle LOB's on JBoss 3.2.1
>
>
> Correct me if I am wrong, but the connection retrieved from
> JBoss's managed connection pool always has autocommit to set to
> false even if it reports true. If there is a configuration
> setting for the datasource that I am missing, I have not been
> able to find it. I am using a local transaction datasource
> configuration (no XA semantics).

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to