【问题标题】:MySql To MariadbMySql 到 Mariadb
【发布时间】:2014-12-29 05:41:41
【问题描述】:

我一直在使用 Eclipse 连接我的项目,使用 mysql ..

要连接我的 sql,我在 context.xml 文件中使用 mysql 连接器

这是我的 context.xml 文件

<Context reloadable="true" antiResourceLocking="true">
<Resource auth="Container" driverClassName="com.mysql.jdbc.Driver"
    maxActive="300" maxIdle="30" maxWait="10000" name="jdbc/tds" password="xxx"
    autoReconnect="true" removeAbandoned="true" logAbandoned="true" removeAbandonedTimeout="60"
    type="javax.sql.DataSource" url="jdbc:mysql://192.168.1.101:3306/tds?autoConnect=true"
    username="xxx" />

我也想在我的项目中存储毫秒,所以我从 mysql 迁移到 mariadb..

所以,我下载了 mariadb 连接器并作为外部 jar 文件添加到我的项目中..

并将上下文文件更改为

<Context reloadable="true" antiResourceLocking="true">
<Resource auth="Container" driverClassName="com.mariadb.jdbc.Driver"
    maxActive="300" maxIdle="30" maxWait="10000" name="jdbc/tds" password="xxx"
    autoReconnect="true" removeAbandoned="true" logAbandoned="true" removeAbandonedTimeout="60"
    type="javax.sql.DataSource" url="jdbc:mariadb://192.168.1.101:3306/tds?autoConnect=true"
    username="xxx" />

但它在我的 java 文件中出现错误,即在这样的行中

import java.sql.Connection;

import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Timestamp;

就像在这些行中显示错误一样,在其他一些 java 文件中也一样..

我不知道是什么问题..

【问题讨论】:

  • 能否包含错误堆栈跟踪输出?

标签: mariadb


【解决方案1】:

尝试将com.mariadb.jdbc.Driver 更改为org.mariadb.jdbc.Driver 中的driverClassName

【讨论】:

    猜你喜欢
    • 2011-11-25
    • 2014-01-29
    • 2020-06-10
    • 2013-10-12
    • 1970-01-01
    • 2020-10-18
    • 2019-02-15
    • 2019-09-10
    • 1970-01-01
    相关资源
    最近更新 更多