aspose file tools*
The moose likes Other Open Source Projects and the fly likes Log4j - JDBCLogger::setLogType() throws a column is not writable message Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Log4j - JDBCLogger::setLogType() throws a column is not writable message" Watch "Log4j - JDBCLogger::setLogType() throws a column is not writable message" New topic
Author

Log4j - JDBCLogger::setLogType() throws a column is not writable message

Priyaa V Kumar
Ranch Hand

Joined: Aug 12, 2004
Posts: 32
Hi,

I am trying to use the JDBCAppender provided in the package org.apache.log4j.jdbcplus to write to multiple columns of a particular table.

I get a java class enclosing some integer and string members. I want these values to go into different columns of a table.

My program has the following code snippet

// Create a new instance of JDBCAppender
JDBCAppender ja = new JDBCAppender();
ja.setUrl("jdbc dbc:test");
ja.setUsername("Admin");
ja.setPassword("");
ja.setTable("result");

ResultObject rslt = null; //my java class with some ints & strings

for (int i = 0; i < 1; i++)
{
rslt = new ResultObject();

rslt.setCol1(1);
rslt.setCol2(1);
rslt.setCol3(20);
rslt.setName("Actual name " + i);

ja.setColumn("Col1", JDBCLogType.EMPTY, "" + rslt.getCol1());
ja.setColumn("Col2", JDBCLogType.EMPTY, "" + rslt.getCol2());
ja.setColumn("Col3", JDBCLogType.EMPTY, "" + rslt.getCol3());

ja.setColumn("Name", JDBCLogType.MSG, "" +rslt.getName());

logger.info(rslt);
}


..........
..........


I get the message/error

log4j:ERROR JDBCAppender::configure()
java.lang.Exception: JDBCLogger::setLogType(), Column COL1 is not writeable !
at org.apache.log4j.jdbcplus.JDBCLogger.setLogType(JDBCLogger.java:212)
at org.apache.log4j.jdbcplus.JDBCAppender.configure(JDBCAppender.java:98
9)
at org.apache.log4j.jdbcplus.JDBCAppender.ready(JDBCAppender.java:880)
at org.apache.log4j.jdbcplus.JDBCAppender.append(JDBCAppender.java:816)
at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:221)

Is the database readonly? Using this same user id & password, I was able to write to this table using a simple java.sql.Statement?

Please let me know if I am missing something here...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Log4j - JDBCLogger::setLogType() throws a column is not writable message
 
Similar Threads
Passing Table values to action class
Dynamic TaleColumn
Help me to have a sortable table in my html profile!
Runtime Creating Tables
log4j JDBCAppender with Oracle problem