M.,

setNString() is part of JDBC 4.0, which came with Java 6. It sounds like you 
are using the postgresql-x.x-xxxx.jdbc3.jar JDBC driver, which was written for 
Java 4. Please download the latest JDBC driver postgresql-9.2-1003.jdbc4.jar 
(http://jdbc.postgresql.org/download/postgresql-9.2-1003.jdbc4.jar). However, 
you should note that PostgreSQL's website says the following:

> Support for JDBC4 methods is not complete, but the majority of methods are 
> implemented.

So it's possible that even the latest driver is not fully JDBC 4.0 compliant 
and won't support this method. In that case, there's nothing we can do about 
it. PostgreSQL has had 7 years to implement a JDBC 4.0 driver; you'll need to 
complain to them. JDBC 4.1 came out two years ago and JDBC 4.2 comes out next 
March. I suppose it'll be ~2020 before they implement those. :-/

Opinion Section: Based on my reading of PostgreSQL website, it doesn't sound 
like a very Java-friendly database to use if you want to use modern versions of 
Java. At least MySQL and Microsoft SQL Server support JDBC 4.0 (which Log4j 
requires) though they still haven't implemented JDBC 4.1 (which Log4j does not 
require). Only Oracle fully supports JDBC 4.1 right now (sad face).

Nick

On Jul 16, 2013, at 6:18 AM, Betty User wrote:

> Hello,
> 
> I am trying to log Log4j 2 events into PostgreSQL database via JDBC
> appender with datasource (com.jolbox.bonecp.BoneCPDataSource).
> 
> This data source uses JDBC driver for PostgreSQL
> (postgresql-9.2-1003.jdbc4.jar) but there isn't implemented
> method org.postgresql.jdbc4.Jdbc4PreparedStatement.setNString(int, String)
> which is called from Log4j 2.
> 
> Is there some another way how to use Log4J database appender with
> PostgreSQL database?
> 
> Thank you for suggestions how to solve this issue.
> 
> M.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to