简体   繁体   English

从 MySQL 迁移到 MariaDB

[英]Moving from MySQL to MariaDB

I am transferring my database from MySQL to MariaDB.我正在将我的数据库从 MySQL 转移到 MariaDB。

The data transfer process is now complete.数据传输过程现已完成。 However, I have a problem with connecting the driver to WildFly.但是,我在将驱动程序连接到 WildFly 时遇到问题。

After WildFly startup, I get an error: WildFly 启动后,出现错误:

2019-12-22 09:47:18,985 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 43) WFLYCTL0013: Operation ("add") failed - address: ([
    ("subsystem" => "datasources"),
    ("jdbc-driver" => "mariadb")
]) - failure description: "WFLYJCA0115: Module for driver [org.mariadb] or one of it dependencies is missing: [org.mariadb]"

I am looking for the solution but nothing works.我正在寻找解决方案,但没有任何效果。

My module.xml :我的module.xml

<module xmlns="urn:jboss:module:1.5" name="org.mariadb">
    <resources>
        <resource-root path="mariadb-java-client-2.5.2.jar"/>
    </resources>
    <dependencies>
        <module name="javax.api"/>
        <module name="javax.transaction.api"/>
    </dependencies>
</module>

and standalone.xml :standalone.xml

<datasources>
    <datasource jndi-name="java:jboss/MariaDBDS" pool-name="MariaDBDS" enabled="true" statistics-enabled="true">
        <connection-url>jdbc:mariadb://localhost:3306/bgdb</connection-url>
        <driver>mariadb</driver>
        <new-connection-sql>SELECT 1</new-connection-sql>
        <security>
            <user-name>user</user-name>
            <password>pass</password>
        </security>
        <validation>
            <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/>
            <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
            <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>
        </validation>
    </datasource>
    <drivers>
        <driver name="mariadb" module="org.mariadb">
            <xa-datasource-class>org.mariadb.jdbc.MariaDbDataSource</xa-datasource-class>
        </driver>
    </drivers>
</datasources>

The <datasource>...</datasource> was added from one of the solution from web. <datasource>...</datasource>是从 web 的解决方案之一添加的。


Here is my directory structure:这是我的目录结构:

modules
└─ system
   └─ layers
      └─ base
         └─ com
            └─ mariadb
               └─ main
                  ├─ mariadb-java-client-2.5.2.jar
                  └─ module.xml

I found the problem and solution.我找到了问题和解决方案。

The configuration files module.xml and mariadb-java-client-2.5.2.jar was in /modules/system/layers/base/com/mariadb/main .配置文件module.xmlmariadb-java-client-2.5.2.jar位于/modules/system/layers/base/com/mariadb/main

But the java package of mariadb-java-client-2.5.2.jar is org.mariadb .但是mariadb-java-client-2.5.2.jar的 java 包是org.mariadb So the files have to be in corresponds direcotry /modules/system/layers/base/org/mariadb/main .所以文件必须在对应的目录/modules/system/layers/base/org/mariadb/main

After this change everything works properly.在此更改后,一切正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM