This extension installs the MariaDB Connector/J Type 4 JDBC driver for creating MariaDB data sources in Lucee Server. It is an alternative to the generic MySQL driver.
- In your Lucee Administrator, go to the Extension > Providers page and add
https://forgebox.io
as a New Extension Provider if not already present - Go to Extension > Applications and look for MariaDB in the "Not installed" section
- Click the extension and install
- Download the the lucee-mariadb.lex file
- In your Lucee Administrator, go to the Extension > Applications page
- Under "Upload new extension", select the lex file and click "Upload"
Once installed you can either create datasources in the Lucee Administrator using the newly added "MariaDB" type, or you can define them in your Application.cfc as follows:
this.datasource = {
class: "org.mariadb.jdbc.Driver"
,connectionString: "jdbc:mariadb://[hostname]:[port]/[database]?<parameter>=<value>"
,username: [username]
,password: [password]
//other options if required
};
More details on defining Lucee datasources
Note that when inserting records into tables with an auto-increment primary key, the MySQL driver returns the new primary key value in two variables in the query result:
GENERATED_KEY
generatedKey
However the MariaDB driver returns the value in the following variables:
generatedKey
insert_id
Before switching drivers, you should therefore check that your code is using generatedKey
and not GENERATED_KEY
.
Inspiration came from Bruce Kirkpatrick.