[logback-user] DBAppender with JNDI, JTDS

Stein, Eric steine at locustec.com
Wed Mar 21 20:00:18 CET 2012


Rest assured, I am a novice egg-sucker. At least now I know that the
dialect isn't something I need to worry about.

 

I figured out the problem. The 'value' here

 

    <connectionSource
class="ch.qos.logback.core.db.JNDIConnectionSource">

      <param name="jndiLocation" value="jdbc/MyDatabase" />

    </connectionSource>

 

needs to be

 

    java:comp/env/jdbc/MyDatabase

 

I don't remember if that's a Tomcat thing or a JTDS thing or some other
thing entirely, but some widget I'm using says that if you define a
datasource as 'jdbc/FOO', it needs to be referenced as
'java:comp/env/jdbc/FOO'. 

 

Sorry for the spam!

 

Eric

 

 

-----Original Message-----
From: logback-user-bounces at qos.ch [mailto:logback-user-bounces at qos.ch]
On Behalf Of Greg Thomas
Sent: Wednesday, March 21, 2012 1:49 PM
To: logback users list
Subject: Re: [logback-user] DBAppender with JNDI, JTDS

 

> I read a little about SQLDialect, but I appear to be missing the part 

> that shows how to configure it, and there's no dialect for JTDS. Am I 

> up the creek here, or is this possible?

 

It looks to me that something odd is going on. I assume you're
connecting to the same database in the end, but the DB Appender relies
on either

(a) the JDBC driver supporting the getGeneratedKeys() method, *or*

(b) the JDBC driver one of those listed at
http://logback.qos.ch/manual/appenders.html#DBAppender
<http://logback.qos.ch/manual/appenders.html#DBAppender>  so the record
that was inserted can be retrieved using a DB specific statement. You
can't specify the dialect - it's detected from the driver class.

[Apologies if the above is teaching you to scuk eggs]

 

Now, there's no dialect for JTDS, so you have to rely on the

getGeneratedKeys() method. What I don't understand is why it works with
DriverManagerConnectionSource but not JNDIConnectionSource.

 

This doesn't help; I started writing a more helpful email, but by the
time I finished I realised what I'd started saying was wrong!

Apologies,

 

Greg

_______________________________________________

Logback-user mailing list

Logback-user at qos.ch <mailto:Logback-user at qos.ch> 

http://mailman.qos.ch/mailman/listinfo/logback-user
<http://mailman.qos.ch/mailman/listinfo/logback-user> 


_________________________________________________
Don't gamble with your environmental information. Learn how the world's largest on-demand environmental information management system can help you mitigate your operating risk: www.locustec.com.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20120321/5aa4e58a/attachment.html>


More information about the Logback-user mailing list