java.sql.SQLFeatureNotSupportedException: Method is not implemented by JDBC driver

 Exception

18:25:07,241 INFO  [STDOUT] 2017-11-30 18:25:07,240 ERROR An exception occurred processing Appender LogAppender org.apache.logging.log4j.core.appender.AppenderLoggingException: Failed to insert record for log event in JDBC manager: Method is not implemented by JDBC driver

18:25:07,241 INFO  [STDOUT]     at org.apache.logging.log4j.core.appender.db.jdbc.JdbcDatabaseManager.writeInternal(JdbcDatabaseManager.java:125)

18:25:07,241 INFO  [STDOUT]     at org.apache.logging.log4j.core.appender.db.AbstractDatabaseManager.write(AbstractDatabaseManager.java:167)

18:25:07,241 INFO  [STDOUT]     at org.apache.logging.log4j.core.appender.db.AbstractDatabaseAppender.append(AbstractDatabaseAppender.java:105)

18:25:07,241 INFO  [STDOUT]     at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:99)

18:25:07,241 INFO  [STDOUT]     at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:430)

18:25:07,242 INFO  [STDOUT]     at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:409)

18:25:07,242 INFO  [STDOUT]     at org.apache.logging.log4j.core.Logger$PrivateConfig.logEvent(Logger.java:288)

18:25:07,242 INFO  [STDOUT]     at org.apache.logging.log4j.core.async.AsyncLogger.actualAsyncLog(AsyncLogger.java:305)

18:25:07,242 INFO  [STDOUT]     at org.apache.logging.log4j.core.async.RingBufferLogEvent.execute(RingBufferLogEvent.java:100)

18:25:07,242 INFO  [STDOUT]     at org.apache.logging.log4j.core.async.RingBufferLogEventHandler.onEvent(RingBufferLogEventHandler.java:43)

18:25:07,242 INFO  [STDOUT]     at org.apache.logging.log4j.core.async.RingBufferLogEventHandler.onEvent(RingBufferLogEventHandler.java:28)

18:25:07,242 INFO  [STDOUT]     at com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:137)

18:25:07,243 INFO  [STDOUT]     at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)

18:25:07,243 INFO  [STDOUT]     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)

18:25:07,243 INFO  [STDOUT]     at java.lang.Thread.run(Thread.java:662)

18:25:07,243 INFO  [STDOUT] Caused by: java.sql.SQLFeatureNotSupportedException: Method is not implemented by JDBC driver

18:25:07,243 INFO  [STDOUT]     at org.jboss.resource.adapter.jdbc.WrappedConnection.checkException(WrappedConnection.java:875)

18:25:07,244 INFO  [STDOUT]     at org.jboss.resource.adapter.jdbc.WrappedStatement.checkException(WrappedStatement.java:852)

18:25:07,244 INFO  [STDOUT]     at org.jboss.resource.adapter.jdbc.jdk6.WrappedPreparedStatementJDK6.setNString(WrappedPreparedStatementJDK6.java:443)

18:25:07,244 INFO  [STDOUT]     at org.apache.logging.log4j.core.appender.db.jdbc.JdbcDatabaseManager.writeInternal(JdbcDatabaseManager.java:110)

18:25:07,245 INFO  [STDOUT]     ... 14 more

18:25:07,246 INFO  [STDOUT] Caused by: java.lang.AbstractMethodError: net.sourceforge.jtds.jdbc.JtdsPreparedStatement.setNString(ILjava/lang/String;)V

18:25:07,246 INFO  [STDOUT]     at org.jboss.resource.adapter.jdbc.jdk6.WrappedPreparedStatementJDK6.setNString(WrappedPreparedStatementJDK6.java:439)

18:25:07,246 INFO  [STDOUT]     ... 15 more

18:25:07,246 INFO  [STDOUT]

Resolution:

Add  isUnicode="false" in the column tag

For e.g.

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="info">

    <CustomLevels>
        <CustomLevel name="EMPLOYEE" intLevel="50" />
    </CustomLevels>
 
    <Appenders>
        <JDBC name="employeeLogAppender" tableName="EMPLOYEE">
            <DataSource jndiName="java:Datasource" />
            <Column name="Name" pattern="%X{Name}" isUnicode="false"/>
            <Column name="empid" pattern="%X{empid}" isUnicode="false"/>
            <Column name="city" pattern="%X{city}" isUnicode="false"/>
            <Column name="department" pattern="%X{department}" isUnicode="false"/>
            <Column name="designation" pattern="%X{designation}" isUnicode="false"/>
            <Column name="experience" pattern="%X{experience}" isUnicode="false"/>
        </JDBC>
    </Appenders>
   
    <Loggers>
        <Root level="trace" includeLocation="false" additivity="false">
            <AppenderRef ref="employeeLogAppender" level="EMPLOYEE" />
        </Root>
    </Loggers>
   
</Configuration>
 

Comments