<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>io.forgebox</groupId>
  <artifactId>lucee-mariadb-extension-extension</artifactId>
  <version>3.3.1</version>
  <packaging>lex</packaging>
  <name>Lucee MariaDB extension</name>
  <description># Lucee MariaDB Extension

This extension installs the MariaDB Connector/J Type 4 JDBC driver for creating MariaDB data sources in [Lucee Server](http://lucee.org/). It is an alternative to the generic MySQL driver.

## Installation

### via Forgebox

1. In your Lucee Administrator, go to the _Extension &gt; Providers_ page and add `https://forgebox.io` as a New Extension Provider if not already present
2. Go to _Extension &gt; Applications_ and look for _MariaDB_ in the &quot;Not installed&quot; section
3. Click the extension and install

### Manual

1. Download the the lucee-mariadb.lex file
2. In your Lucee Administrator, go to the Extension &gt; Applications page
3. Under &quot;Upload new extension&quot;, select the lex file and click &quot;Upload&quot; 

## Usage

Once installed you can either create datasources in the Lucee Administrator using the newly added &quot;MariaDB&quot; type, or you can define them in your Application.cfc as follows:

```
this.datasource = {
	class: &quot;org.mariadb.jdbc.Driver&quot;
	,connectionString: &quot;jdbc:mariadb://[hostname]:[port]/[database]?useUnicode=true&amp;characterEncoding=UTF-8&quot;// and any other required parameters
	,username: [username]
	,password: [password]
	//other options if required
};
```
[More details on defining Lucee datasources](https://docs.lucee.org/guides/cookbooks/datasource-define-datasource.html)

## Migration from the MySQL driver

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`.


## Credits

Inspiration came from [Bruce Kirkpatrick](https://github.com/jetendo).</description>
</project>