title: log4j with oracle gives exception- invalid sql statement
body: <p>I try to implement log4j logging in database example from that page, <a href="http://www.tutorialspoint.com/log4j/log4j_logging_database.htm" rel="nofollow">http://www.tutorialspoint.com/log4j/log4j_logging_database.htm</a></p>
  
  <p>I edit my xml like</p>
  
  <pre><code>&lt;appender name="DB" class="org.apache.log4j.jdbc.JDBCAppender"&gt;
      &lt;param name="URL" value="jdbc:oracle:thin:@ip:port:dbname"/&gt;
      &lt;param name="driver" value="oracle.jdbc.OracleDriver"/&gt;
      &lt;param name="user" value="user"/&gt;
      &lt;param name="password" value="pass"/&gt;
      &lt;param name="sql" value="INSERT INTO FLOW_PATH_LOGS VALUES('%x',
                           '%d','%C','%p','%m')"/&gt;
      &lt;layout class="org.apache.log4j.PatternLayout"&gt;
      &lt;/layout&gt;
  &lt;/appender&gt;
  </code></pre>
  
  <p>but it gives sql exception, invalid sql statement. I try to replace statement as select 1 from dual but it gives same exception.</p>
  
  <p>Stack Trace:</p>
  
  <pre><code>log4j:ERROR Failed to excute sql
  java.sql.SQLSyntaxErrorException: ORA-00900: invalid SQL statement
  
  at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:91)
  at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)
  at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:206)
  at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
  at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
  at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1035)
  at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:183)
  at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:942)
  at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1224)
  at oracle.jdbc.driver.OracleStatement.executeUpdateInternal(OracleStatement.java:1717)
  at oracle.jdbc.driver.OracleStatement.executeUpdate(OracleStatement.java:1685)
  at oracle.jdbc.driver.OracleStatementWrapper.executeUpdate(OracleStatementWrapper.java:275)
  at org.apache.log4j.jdbc.JDBCAppender.execute(JDBCAppender.java:178)
  at org.apache.log4j.jdbc.JDBCAppender.flushBuffer(JDBCAppender.java:250)
  at org.apache.log4j.jdbc.JDBCAppender.append(JDBCAppender.java:146)
  at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230)
  at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65)
  at org.apache.log4j.Category.callAppenders(Category.java:203)
  at org.apache.log4j.Category.forcedLog(Category.java:388)
  at org.apache.log4j.Category.info(Category.java:663)
  at tr.com.innova.hukuk.ortak.controllers.OrtakController.logFlowPath(OrtakController.java:751)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)
  at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:328)
  at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:273)
  at org.jboss.el.parser.AstMethodSuffix.getValue(AstMethodSuffix.java:59)
  at org.jboss.el.parser.AstValue.getValue(AstValue.java:67)
  at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
  at com.sun.facelets.el.ELText$ELTextVariable.writeText(ELText.java:184)
  at com.sun.facelets.compiler.TextInstruction.write(TextInstruction.java:45)
  at com.sun.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:39)
  at com.sun.facelets.compiler.UILeaf.encodeAll(UILeaf.java:149)
  at javax.faces.component.UIComponent.encodeAll(UIComponent.java:257)
  at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
  at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
  at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
  at org.springframework.faces.webflow.JsfView.render(JsfView.java:89)
  at org.springframework.webflow.engine.ViewState.render(ViewState.java:282)
  at org.springframework.webflow.engine.ViewState.refresh(ViewState.java:241)
  at org.springframework.webflow.engine.ViewState.resume(ViewState.java:219)
  at org.springframework.webflow.engine.Flow.resume(Flow.java:545)
  at org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:259)
  at org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:169)
  at org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:183)
  at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
  at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
  at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
  at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
  at tr.com.innova.common.middleware.web.servlets.ServletToBeanProxy.service(ServletToBeanProxy.java:46)
  at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
  at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
  at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
  at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
  at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
  at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
  at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
  at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
  at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
  at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
  at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265)
  at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265)
  at tr.com.innova.ortak.web.filters.ExpiredPasswordCheckFilter.doFilter(ExpiredPasswordCheckFilter.java:48)
  at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
  at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)
  at tr.com.innova.ortak.web.filters.FlowSecurityFilter.doFilter(FlowSecurityFilter.java:38)
  at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
  at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:124)
  at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
  at org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:81)
  at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
  at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
  at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
  at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
  at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
  at tr.com.innova.ortak.web.filters.IDMFilter.doFilter(IDMFilter.java:68)
  at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
  at org.acegisecurity.ui.logout.LogoutFilter.doFilter(LogoutFilter.java:110)
  at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
  at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
  at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
  at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149)
  at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
  at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
  at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
  at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
  at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149)
  at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
  at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
  at org.jasig.cas.client.session.SingleSignOutFilter.doFilter(SingleSignOutFilter.java:99)
  at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
  at tr.com.innova.ortak.web.filters.ILoggerFilter.doFilter(ILoggerFilter.java:60)
  at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
  at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
  at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
  at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
  at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.doIt(WebAppServletContext.java:3684)
  at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3650)
  at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
  at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
  at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2268)
  at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2174)
  at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1446)
  at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
  at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
  </code></pre>
  
  <p>I'm thankful for any advice.</p>