[logback-dev] Setting up DB Appender with Oracle

auwall wallajr.auburn at gmail.com
Mon May 16 22:06:22 CEST 2011


I am having problems setting up a dbappender with an oracle database. The
version of oracle i'm using is oracle 11 gr 2 and i downloaded it's
corresponding jdbc drivers (ojdbc6 from oracle)

Here is my config for it

  <appender name="DB2" class="ch.qos.logback.classic.db.DBAppender">
       <connectionSource 
class="ch.qos.logback.core.db.DriverManagerConnectionSource">
         <driverClass>oracle.jdbc.driver.OracleDriver</driverClass>
         <url>jdbc:oracle:thin:@XX.XX.XX.XX:MYSID</url>
         <user>ME</user>
         <password>MYPASSWORD</password>
       </connectionSource>
  </appender>

but  i'm getting these errors:
19:53:25,311 |-WARN in
ch.qos.logback.core.db.DriverManagerConnectionSource at 69e328e0 - Could not
discover the dialect to use. java.sql.SQLRecoverableException: IO Error: The
Network Adapter could not establish the connection
	at java.sql.SQLRecoverableException: IO Error: The Network Adapter could
not establish the connection
	at 	at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:419)
	at 	at
oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:536)
	at 	at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:228)
	at 	at
oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
	at 	at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
	at 	at java.sql.DriverManager.getConnection(DriverManager.java:582)
	at 	at java.sql.DriverManager.getConnection(DriverManager.java:185)
	at 	at
ch.qos.logback.core.db.DriverManagerConnectionSource.getConnection(DriverManagerConnectionSource.java:54)
	at 	at
ch.qos.logback.core.db.ConnectionSourceBase.discoverConnnectionProperties(ConnectionSourceBase.java:47)
	at 	at
ch.qos.logback.core.db.DriverManagerConnectionSource.start(DriverManagerConnectionSource.java:38)
	at 	at
ch.qos.logback.core.joran.action.NestedComplexPropertyIA.end(NestedComplexPropertyIA.java:167)
	at 	at
ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Interpreter.java:315)
	at 	at
ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:194)
	at 	at
ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:180)
	at 	at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:52)
	at 	at ch.qos.logback.core.joran.spi.Interpreter.play(Interpreter.java:332)
	at 	at
ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:126)
	at 	at
ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:93)
	at 	at
ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:52)
	at 	at
ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:77)
	at 	at
ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:150)
	at 	at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:85)
	at 	at
org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
	at 	at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121)
	at 	at
org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111)
	at 	at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:268)
	at 	at package.MyClass.main(LogManagerTest.java:35)
Caused by: oracle.net.ns.NetException: The Network Adapter could not
establish the connection
	at 	at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:375)
	at 	at
oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:422)
	at 	at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:678)
	at 	at oracle.net.ns.NSProtocol.connect(NSProtocol.java:238)
	at 	at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1054)
	at 	at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:308)
	at 	... 26 common frames omitted
Caused by: java.net.NoRouteToHostException: No route to host
	at 	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at 	at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
	at 	at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
	at 	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
	at 	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
	at 	at java.net.Socket.connect(Socket.java:529)
	at 	at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:209)
	at 	at oracle.net.nt.ConnOption.connect(ConnOption.java:123)
	at 	at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:353)
	at 	... 31 common frames omitted
19:53:25,316 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter at 36:14 -
RuntimeException in Action for tag [appender]
java.lang.IllegalStateException: DBAppender cannot function if the JDBC
driver does not support getGeneratedKeys method *and* without a specific SQL
dialect
	at java.lang.IllegalStateException: DBAppender cannot function if the JDBC
driver does not support getGeneratedKeys method *and* without a specific SQL
dialect
	at 	at ch.qos.logback.core.db.DBAppenderBase.start(DBAppenderBase.java:62)
	at 	at ch.qos.logback.classic.db.DBAppender.start(DBAppender.java:96)
	at 	at
ch.qos.logback.core.joran.action.AppenderAction.end(AppenderAction.java:96)
	at 	at
ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Interpreter.java:315)
	at 	at
ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:194)
	at 	at
ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:180)
	at 	at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:52)
	at 	at ch.qos.logback.core.joran.spi.Interpreter.play(Interpreter.java:332)
	at 	at
ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:126)
	at 	at
ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:93)
	at 	at
ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:52)
	at 	at
ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:77)
	at 	at
ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:150)
	at 	at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:85)
	at 	at
org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
	at 	at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121)
	at 	at
org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111)
	at 	at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:268)
	at 	at package.main(LogManagerTest.java:35)
19:53:25,316 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction -
Setting level of logger [Service Management CSCI] to DEBUG
19:53:25,316 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction -
Attaching appender named [STDOUT] to Logger[Service Management CSCI]
19:53:25,318 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction
- Setting level of ROOT logger to DEBUG
-- 
View this message in context: http://old.nabble.com/Setting-up-DB-Appender-with-Oracle-tp31632497p31632497.html
Sent from the Logback Dev mailing list archive at Nabble.com.



More information about the logback-dev mailing list