Logback DBAppender url

发布于 2024-08-27 09:53:05 字数 814 浏览 9 评论 0原文

我正在尝试使用 Logback 的 DBAppender。我的 logback.xml 有以下附加程序:

</appender>
 <appender name="DatabaseAppender" class="ch.qos.logback.classic.db.DBAppender">
  <connectionSource class="ch.qos.logback.core.db.DriverManagerConnectionSource">
   <driverClass>oracle.jdbc.OracleDriver</driverClass>
   <url>jdbc:oracle:thin:@HOST_URL:PORT:SERVICE_NAME</url>
   <user>USER</user>
   <password>PASS</password>
 </connectionSource>
</appender>

给定的 url 可以与同一项目中的其他 java 类一起使用,但它失败,logback 给出以下错误,

ORA-00904: "ARG3": invalid identifier

        at java.sql.SQLException: ORA-00904: "ARG3": invalid identifier

其中 ARG3 是 jdbc:oracle:thin:@HOST_URL:端口:SERVICEID

I'm trying to use Logback's DBAppender. My logback.xml has the following appender:

</appender>
 <appender name="DatabaseAppender" class="ch.qos.logback.classic.db.DBAppender">
  <connectionSource class="ch.qos.logback.core.db.DriverManagerConnectionSource">
   <driverClass>oracle.jdbc.OracleDriver</driverClass>
   <url>jdbc:oracle:thin:@HOST_URL:PORT:SERVICE_NAME</url>
   <user>USER</user>
   <password>PASS</password>
 </connectionSource>
</appender>

the url given works with other java classes in the same project but it fails with logback giving the following error

ORA-00904: "ARG3": invalid identifier

        at java.sql.SQLException: ORA-00904: "ARG3": invalid identifier

where ARG3 is the <url>jdbc:oracle:thin:@HOST_URL:PORT:SERVICEID</url>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

谁把谁当真 2024-09-03 09:53:05

我对导致此错误的 Oracle 语句感兴趣。
我的猜测是它正在尝试 INSERT INTO table (arg1, arg2, arg3) 值 (...);
当表不包含该列时。

如果您不知道该表是什么,请检查此处有关在以下情况下强制进行错误转储的信息:遇到 904 错误。

然后

ALTER system SET EVENTS '904 TRACE NAME ERRORSTACK LEVEL 3';

,当出现错误时,数据库会生成一个跟踪文件,该文件应显示类似于以下内容的问题陈述:

ORA-00904: "FRFRF": invalid identifier
Current SQL statement for this session:
select frfrf from dual

I'd be interested in the Oracle statement resulting in this error.
My guess is that it is trying an INSERT INTO table (arg1, arg2, arg3) values (...);
when the table doesn't contain that column.

If you don't know what the table is then checking here about forcing an error dump when the 904 error is encountered.

I can do a

ALTER system SET EVENTS '904 TRACE NAME ERRORSTACK LEVEL 3';

Then, when the error is raised, the database generates a trace file which should show the problem statement similar to the following :

ORA-00904: "FRFRF": invalid identifier
Current SQL statement for this session:
select frfrf from dual
浅忆流年 2024-09-03 09:53:05

对于数据源连接:

<appender name="DB" class="ch.qos.logback.classic.db.DBAppender">
    <connectionSource
      class="ch.qos.logback.core.db.DataSourceConnectionSource">
      <dataSource
        class="com.mchange.v2.c3p0.ComboPooledDataSource">
        <driverClass>oracle.jdbc.driver.OracleDriver</driverClass>
        <jdbcUrl>jdbc:oracle:thin:@localhost:1521:XE</jdbcUrl>
        <user>system</user>
        <password>a</password>
      </dataSource>
    </connectionSource>
  </appender>

对于 DRIVERMANAGER 连接:

 <appender name="DB" class="ch.qos.logback.classic.db.DBAppender">
    <connectionSource class="ch.qos.logback.core.db.DriverManagerConnectionSource">
      <driverClass>com.mysql.jdbc.Driver</driverClass>
      <url>jdbc:mysql://host_name:3306/datebase_name</url>
      <user>username</user>
      <password>password</password>
    </connectionSource>
  </appender>

FOR DATASOURCE CONNECTIONS:

<appender name="DB" class="ch.qos.logback.classic.db.DBAppender">
    <connectionSource
      class="ch.qos.logback.core.db.DataSourceConnectionSource">
      <dataSource
        class="com.mchange.v2.c3p0.ComboPooledDataSource">
        <driverClass>oracle.jdbc.driver.OracleDriver</driverClass>
        <jdbcUrl>jdbc:oracle:thin:@localhost:1521:XE</jdbcUrl>
        <user>system</user>
        <password>a</password>
      </dataSource>
    </connectionSource>
  </appender>

FOR DRIVERMANAGER CONNECTIONS:

 <appender name="DB" class="ch.qos.logback.classic.db.DBAppender">
    <connectionSource class="ch.qos.logback.core.db.DriverManagerConnectionSource">
      <driverClass>com.mysql.jdbc.Driver</driverClass>
      <url>jdbc:mysql://host_name:3306/datebase_name</url>
      <user>username</user>
      <password>password</password>
    </connectionSource>
  </appender>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文