You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2006/03/09 18:40:00 UTC

DO NOT REPLY [Bug 37349] - DBAppender not working with jTDS driver

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=37349>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=37349





------- Additional Comments From jonathan.beer@gmail.com  2006-03-09 17:39 -------
Here is what I have found when I experienced the same problem.  I don't think
this is a bug in the DBAppender:

After tracing through the code, it also supports the getGeneratedKeys method...
sort of. They have provided an implementation of getGeneratedKeys that simply
returns a dummy resultset.  I'm not sure there's anything that can be done about
this until their implementation is fixed, aside from removing the dependency on
"getGeneratedKeys", which seems like it would take a lot of refactoring.
    
    Exception: java.sql.SQLException: No current row in the ResultSet. 
    Line# 268 of DBAppender
    Explanation: DBAppender successfully invokes getGeneratedKeys method on the
Statement implementation class, but fail to get the actual generated value from
the resultset, cause it seems the returned resultset is a fake (empty) one     
 (according to the sources comments in JtdsStatement class)


(In reply to comment #0)
> When using DBAppender with the jTDS driver, it gave the following error: 
> 
> java.sql.SQLException: No current row in the ResultSet. 
> at net.sourceforge.jtds.jdbc.JtdsResultSet.getColumn(JtdsResultSet.java:269) 
> at net.sourceforge.jtds.jdbc.JtdsResultSet.getInt(JtdsResultSet.java:630) 
> at org.apache.log4j.db.DBAppender.append(DBAppender.java:226) 
> at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:239) 
> at
>
org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:67)
> 
> at org.apache.log4j.Category.callAppenders(Category.java:219) 
> at org.apache.log4j.Category.forcedLog(Category.java:588) 
> at org.apache.log4j.Category.log(Category.java:1169) 
> at org.apache.commons.logging.impl.Log4JLogger.info(Log4JLogger.java:135) 
>  
> The jTDS developer believe that it's a bug in DBAppender with the following
comment:
> 
> Moving on to the error itself it's indeed caused by DBAppender. It tries to
> retrieve auto generated keys although it didn't request them in the first place:
> it calls prepareStatement(String) instead of prepareStatement(String, int),
> which is needed if auto generated keys are to be retrieved. A second problem is
> that it doesn't even check whether ResultSet.next() returned true or not and it
> just goes for the value which isn't there. Here's the code in question: 
>  
>
http://fisheye.cenqua.com/viewrep/jakarta/jakarta-log4j/src/java/org/apache/log4j/db/DBAppender.java?r=1.17&k=
> 
> 
> For more information, please refer to:
> 
> http://sourceforge.net/forum/forum.php?thread_id=1377897&forum_id=104389
> 
> URL of jTDS: http://jtds.sourceforge.net/

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org