Hi there,
I would like ask about ODBC support (with MySQL) under Linux (Debian 5.0).
As for Debian 5.0 does not support the current version and the version does not 
have ODBC support enabled, I had to get the source (0.9.7 version) , make some 
changes because of gcc 4.3.2 differences to get it to work (mostly adding 
#include<memory.h>)  and compile it with ODBC.

I had the choice to either configure unixODBC or iODBC, I chose unixODBC.
Further I included XML support. This works for XML-style output, and also - 
more importantly - for the config file.
I can create nice XML-a-like files, normal log files, but ODBC support is not 
working, and I cannot figure out how.
I even tracked down to the the function which causes the exception:
In odbcappender.cpp the last I can track is the function  "ret = 
SQLExecDirect(stmt, (SQLTCHAR *)sql.c_str(), SQL_NTS);" which does not work - 
no suprise!
But there I cannot debug further - if someone has an idea how I can see a more 
detailed message than the log4cxx error message:
"Failed to execute sql" but without any more detail.
A MySQL server under 192.168.1.1 is running, I cannot any see malformed SQL 
statements or password, access problems (looking at server logs), though I 
don't know if something is missing.

unixodbc
libodbcinst
and 
myodbc (?)
are installed, so my question would be, how a standard correct appender param 
name would look like in Linux, especially with driver=....???

My Appender looks like this (the normal ones, XML work)
<appender name="MyOdbcMysqlAppender" class="org.apache.log4j.odbc.ODBCAppender">
         <param name="URL" 
value="Driver=ODBC;Server=192.168.1.1;Database=errorlog;User=logger;Password=1234;"/>
         <layout class="org.apache.log4j.PatternLayout">
             <param name="ConversionPattern" value="INSERT INTO errormessages 
(message) VALUES ('%d - %c - %p - %m')"/>
         </layout>
     </appender> 

I assume
<param name="URL" 
value="Driver=ODBC;Server=192.168.1.1;Database=errorlog;User=logger;Password=1234;"/>
is the problem!  Does it has to be like <param name="database" ... <param 
name="user" .... <param name="host" .... 
Do I need log4j and the java classes?
Any hint would be appreciated, thanks.







Reply via email to