How to use mariadb and liquibase together with maven on jboss
Tech-Today

How to use mariadb and liquibase together with maven on jboss



First you must define the needed dependency in your pom file.
<profile>
<id>mariadb</id>
<activation>
<property>
<name>env</name>
<value>mariadb</value>
</property>
</activation>
<properties>
<db.driver>org.mariadb.jdbc.Driver</db.driver>
<db.url>jdbc:mariadb://localhost:3306/mariadb</db.url>
<db.username>mariadb</db.username>
<db.password>mariadb</db.password>
</properties>
<dependencies>
<!-- Dependency for liquibase plugin -->
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>1.5.4</version>
</dependency>
</dependencies>
</profile>
Then we need to configure jboss datasource
<datasource jta="true"
jndi-name="java:jboss/datasources/MariaDBAdminDatasource" pool-name="MariaDBMariadb"
enabled="true" use-java-context="true" use-ccm="false">
<connection-url>jdbc:mariadb://127.0.0.1:3306/MariaDB</connection-url>
<driver-class>org.mariadb.jdbc.Driver</driver-class>
<driver>mariadb-driver</driver>
<pool>
<min-pool-size>2</min-pool-size>
<max-pool-size>20</max-pool-size>
</pool>
<security>
<user-name>MariaDB</user-name>
<password>MariaDB</password>
</security>
<validation>
<validate-on-match>true</validate-on-match>
<background-validation>true</background-validation>
<check-valid-connection-sql>select 1</check-valid-connection-sql>
</validation>
<statement>
<prepared-statement-cache-size>10</prepared-statement-cache-size>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>

<drivers>
<driver name="mariadb-driver" module="org.mariadb">
<xa-datasource-class>org.mariadb.jdbc.MySQLDataSource</xa-datasource-class>
</driver>
</drivers>
And finally inside jboss modules folder we need to create a new folder: org\mariadb\main with mariadb-java-client-1.5.4.jar and module.xml. Content of module.xml is:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="org.mariadb">
<resources>
<resource-root path="mariadb-java-client-1.5.4.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>





- Install And Configure Mariadb On Ubuntu
I. Installation In your terminal execute the following commands: sudo apt-get install software-properties-common sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 sudo add-apt-repository 'deb [arch=amd64] http://mirror.zol.co.zw/mariadb/repo/10.3/ubuntu...

- Setup Mysql Database For Remote Access
Here are some useful guidelines in setting up a mysql server for remote access in Ubuntu. Install and configure mysql server. sudo apt-get update sudo apt-get install mysql-server mysql_secure_installation *Note in MySQL - it will ask to set the password...

- How To Monitor The Data Source Connections And Sql Queries In Jboss
To allow us to debug our jboss server for possible connection leaks, wrong sql queries normally we do 2 changes: 1.) In persistence.xml, set hibernate.show_sql to true 2.) In jboss's standalone.xml, we set the hibernate logger to DEBUG <logger...

- How To Create A Modeshape Datasource Connection For Jboss
<datasource jndi-name="java:/jcr/myportal" pool-name="myJCRPortalPool" enabled="true" use-java-context="true"> <connection-url>jdbc:jcr:jndi:jcr?repositoryName=my</connection-url> <connection-property name="workspace"> extra </connection-property>...

- Jboss Datasource Configuration Settings
The following are sample configurations for different database (it's in the file standalone.xml subsystem=datasources): H2, postgresql, mysql <datasources> <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true"...



Tech-Today








.