[logback-dev] [JIRA] Issue Comment Edited: (LBCORE-15) Problems getting autogenerated Keys in Oracle with Oracle JDBC 10.2.03

Ceki Gulcu (JIRA) noreply-jira at qos.ch
Wed Oct 22 23:01:22 CEST 2008


    [ http://jira.qos.ch/browse/LBCORE-15?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=10801#action_10801 ] 

Ceki Gulcu edited comment on LBCORE-15 at 10/22/08 11:00 PM:
-------------------------------------------------------------

It's actually more of a JDBC driver issue then a RDBMS version
issue. I could reproduce the problem on Oracle 10g using ojdbc14.jar
(version 10.2.0.1). This JDBC drivers support the getGeneratedKeys
method. The problem cannot be reproduced with an older driver,
classic12.jar, version 9.0.1.4.0, because it does not support
getGeneratedKeys().

Anyway, the code has been modified to use the
connection. prepareStatement() method taking two arguments, the sql
statement follows by the auto-generated columnNames, as suggested John
Gibson. Surprisingly enough, this change is compatible with other
databases supporting getGeneratedKeys().

Fixed in revision 1860

      was (Author: noreply.ceki at qos.ch):
    It's actually more of a JDBC driver issue then a RDBMS version
issue. I could reproduce the problem on Oracle 10g using ojdbc14.jar
(version 10.2.0.1). This JDBC drivers support the getGeneratedKeys
method. The problem cannot be reproduced with an older driver,
classic12.jar, version 9.0.1.4.0, because it does not support
getGeneratedKeys().

Anyway, the code has been modified to use the
connection. prepareStatement() method taking two arguments, the sql
statement follows by the auto-generated columnNames, as suggested John
Gibson. Surprisingly enough, this change is compatible with other
databases supporting getGeneratedKeys().

Fixed in revision 1859
  
> Problems getting autogenerated Keys in Oracle with Oracle JDBC 10.2.03
> ----------------------------------------------------------------------
>
>                 Key: LBCORE-15
>                 URL: http://jira.qos.ch/browse/LBCORE-15
>             Project: logback-core
>          Issue Type: Bug
>          Components: Appender
>    Affects Versions: unspecified
>         Environment: Operating System: Windows
> Platform: PC
>            Reporter: Klaus Unger
>            Assignee: Logback dev list
>            Priority: Blocker
>             Fix For: 0.9.10
>
>
> I've encountered troubles logging StackTrace/MDC entries with die DBAppender on our plattform! We are using Oracle 9.2.0.6.0 on a Solaris Box with Oracle JDBC Driver 10.2.0.3!
> I've debugged the processing of LogMessages into DBAppenderBase.append()!
> There I found a call "con.prepareStatement(getInsertSQL())" which is followed by a call "subAppend(...)"
> As far as I understand Oracle Drivers return generatedKeys only, if you use the right prepareStatement() methods, which is in my understanding the following:
> PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
>                                    throws SQLException
> @see http://java.sun.com/j2se/1.5.0/docs/api/java/sql/Connection.html#prepareStatement(java.lang.String,%20int)
> which is available since JDK 1.4

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the logback-dev mailing list