Skip to content

Log4j2 JDBC Appender DriverManager write to SQLite FAIL. #2911

Answered by ppkarwasz
life888888 asked this question in Q&A
Discussion options

You must be logged in to vote

@life888888,

Caused by: java.sql.SQLFeatureNotSupportedException
  at org.sqlite.jdbc4.JDBC4PreparedStatement.setNString(JDBC4PreparedStatement.java:36)
  at org.apache.logging.log4j.core.appender.db.jdbc.JdbcDatabaseManager.writeInternal(JdbcDatabaseManager.java:852)
  ... 68 more

...
Log4j2 JdbcDatabaseManager's use of setNString causes writing to SQLIte to fail. Is it possible to use setString for SQLIte instead of setNString?

Sure, since the JDBC driver does not support the optional setNString() method, you just need to set the isUnicode configuration attribute of Column to false (cf. Column plugin reference).

<JDBC name="demo-db-appender" tableName="logs">
  <DriverManager driverC…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@life888888
Comment options

Answer selected by life888888
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #2910 on August 31, 2024 07:30.