Index: components-sls/components/petals-bc-sql/src/main/java/org/ow2/petals/bc/sql/DriverResolver.java
===================================================================
--- components-sls/components/petals-bc-sql/src/main/java/org/ow2/petals/bc/sql/DriverResolver.java (revision 43285)
+++ components-sls/components/petals-bc-sql/src/main/java/org/ow2/petals/bc/sql/DriverResolver.java (working copy)
@@ -51,6 +51,7 @@
*
derby,
* postgresql,
* db2.
+ * mariadb.
*
*
* @param jdbcConnectionURI
Index: components-sls/components/petals-bc-sql/src/main/resources/jdbcDriverMapping.properties
===================================================================
--- components-sls/components/petals-bc-sql/src/main/resources/jdbcDriverMapping.properties (revision 43285)
+++ components-sls/components/petals-bc-sql/src/main/resources/jdbcDriverMapping.properties (working copy)
@@ -23,3 +23,4 @@
postgresql=org.postgresql.Driver
db2=com.ibm.db2.jcc.DB2Driver
sybase=com.sybase.jdbc2.jdbc.SybDriver
+mariadb=org.mariadb.jdbc.Driver
\ No newline at end of file
Index: components-sls/components/petals-bc-sql/src/main/resources/SQLextensions.xsd
===================================================================
--- components-sls/components/petals-bc-sql/src/main/resources/SQLextensions.xsd (revision 43285)
+++ components-sls/components/petals-bc-sql/src/main/resources/SQLextensions.xsd (working copy)
@@ -35,7 +35,7 @@
The JDBC Driver className. The library is loaded
with a SharedLibrary. Automatically resolved for:
- mysql,oracle,hsql,sqlserver,derby,postgresql,db2,sybase.
+ mysql,oracle,hsql,sqlserver,derby,postgresql,db2,sybase,mariadb.
Index: components-sls/components/petals-bc-sql/src/test/java/org/ow2/petals/bc/sql/DriverResolverTest.java
===================================================================
--- components-sls/components/petals-bc-sql/src/test/java/org/ow2/petals/bc/sql/DriverResolverTest.java (revision 43285)
+++ components-sls/components/petals-bc-sql/src/test/java/org/ow2/petals/bc/sql/DriverResolverTest.java (working copy)
@@ -1,16 +1,16 @@
/**
* Copyright (c) 2011-2012 EBM WebSourcing, 2012-2019 Linagora
- *
+ *
* This program/library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 2.1 of the License, or (at your
* option) any later version.
- *
+ *
* This program/library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
- *
+ *
* You should have received a copy of the GNU Lesser General Public License
* along with this program/library; If not, see http://www.gnu.org/licenses/
* for the GNU Lesser General Public License version 2.1.
@@ -17,10 +17,10 @@
*/
package org.ow2.petals.bc.sql;
+import org.junit.Test;
+
import static org.junit.Assert.assertEquals;
-import org.junit.Test;
-
/**
* @author Adrien Ruffie - EBM WebSourcing
*/
@@ -31,5 +31,37 @@
String jdbcUrl = "jdbc:mysql://localhost/mydatabase";
String jdbcClassName = "com.mysql.jdbc.Driver";
assertEquals(jdbcClassName, DriverResolver.resolveDriverClassname(jdbcUrl));
+
+ jdbcUrl = "jdbc:oracle:thin:@host-db:1521:dbname";
+ jdbcClassName = "oracle.jdbc.driver.OracleDriver";
+ assertEquals(jdbcClassName, DriverResolver.resolveDriverClassname(jdbcUrl));
+
+ jdbcUrl = "jdbc:hsqldb:hsql://localhost:9001/default";
+ jdbcClassName = "org.hsqldb.jdbcDriver";
+ assertEquals(jdbcClassName, DriverResolver.resolveDriverClassname(jdbcUrl));
+
+ jdbcUrl = "jdbc:sqlserver://localhost\\test:1324;database=test";
+ jdbcClassName = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
+ assertEquals(jdbcClassName, DriverResolver.resolveDriverClassname(jdbcUrl));
+
+ jdbcUrl = "jdbc:derby://localhost:1527/";
+ jdbcClassName = "org.apache.derby.jdbc.ClientDriver";
+ assertEquals(jdbcClassName, DriverResolver.resolveDriverClassname(jdbcUrl));
+
+ jdbcUrl = "jdbc:postgresql://localhost:5432/dbname";
+ jdbcClassName = "org.postgresql.Driver";
+ assertEquals(jdbcClassName, DriverResolver.resolveDriverClassname(jdbcUrl));
+
+ jdbcUrl = "jdbc:db2:database";
+ jdbcClassName = "com.ibm.db2.jcc.DB2Driver";
+ assertEquals(jdbcClassName, DriverResolver.resolveDriverClassname(jdbcUrl));
+
+ jdbcUrl = "jdbc:jtds:sybase://localhost:5000";
+ jdbcClassName = "com.sybase.jdbc2.jdbc.SybDriver";
+ assertEquals(jdbcClassName, DriverResolver.resolveDriverClassname(jdbcUrl));
+
+ jdbcUrl = "jdbc:mariadb://localhost/mydatabase";
+ jdbcClassName = "org.mariadb.jdbc.Driver";
+ assertEquals(jdbcClassName, DriverResolver.resolveDriverClassname(jdbcUrl));
}
}