Thank you very much. Your suggestion helped me.
As I wrote in my previous post, I tried mysql-connector-java-5.1.44-bin.jar, 
but with mariadb JDBC jar file in the same classpath. And that was the problem.
This page 
https://apim.docs.wso2.com/en/latest/install-and-setup/setup/setting-up-databases/changing-default-databases/changing-to-mysql/
 tells that before deploying new connector all existing connectors have to be 
removed from the <API-M_HOME>/repository/components/lib and 
<API-M_HOME>/repository/components/dropins directories.
After removing mariadb-java-client-2.6.0.jar from  these directories it worked 
fine. Sorry, my mistake.

Best regards,
Roman Chrenko

From: Architecture <[email protected]> On Behalf Of Ruwan Abeykoon
Sent: piatok 12. júna 2020 4:59
To: architecture <[email protected]>
Subject: Re: [Architecture] MariaDB support for WSO2 API Manager 3.1.0 or newer

Hi Roman,
This limitation is for the JDBC driver by MariaDB.
It should work if you use MySQL driver, connecting MariaDB. Can you please 
check that approach.

Cheers,
Ruwan A

On Thu, Jun 11, 2020 at 3:16 PM Roman CHRENKO 
<[email protected]<mailto:[email protected]>> wrote:
Hello.
I would like to know if MariaDB will be supported with WSO2 API Manager 3.1.0 
or newer. You wrote that it is supported 
(https://apim.docs.wso2.com/en/latest/install-and-setup/setup/setting-up-databases/changing-default-databases/changing-to-mariadb/),
 but my experience is that it isn't. The source code of APIM tells the same 
(that it isn't).
I found out this problem when I wanted to change WSO2SHARED_DB and WSO2AM_DB to 
MariaDB. The first start of APIM failed with exception that "admin" user cannot 
be persisted.
<output from wso2carbon.log>
Caused by: org.wso2.carbon.user.core.UserStoreException: Error while persisting 
user : admin
        at 
org.wso2.carbon.user.core.jdbc.UniqueIDJDBCUserStoreManager.persistUser(UniqueIDJDBCUserStoreManager.java:1234)
Caused by: org.wso2.carbon.user.core.UserStoreException: Error occurred while 
adding user properties for user : 9c4faa63-a77b-447a-bbc1-abc7cad55558
        at 
org.wso2.carbon.user.core.jdbc.UniqueIDJDBCUserStoreManager.addPropertiesWithID(UniqueIDJDBCUserStoreManager.java:2577)
Caused by: java.lang.Exception: Unsupported database: MariaDB. Database will 
not be created automatically by the WSO2 Registry. Please create the database 
using appropriate database scripts for the database.
</output from wso2carbon.log>

After some digging into the source code I found that MariaDB is not supported:
/opt/apim/repository/components/plugins/org.wso2.carbon.utils_4.6.0.jar => 
org.wso2.carbon.utils.dbcreator.DatabaseCreator.getDatabaseType(Connection 
conn):
<javaCode>
DatabaseMetaData metaData = conn.getMetaData();
String databaseProductName = metaData.getDatabaseProductName();
</javaCode>
When MariaDB 10.3.23 is used it returns the string "MariaDB". It is returned by 
DB engine (despite of JDBC connector used; I tried 
mariadb-java-client-2.6.0.jar and mysql-connector-java-5.1.44-bin.jar).
The string databaseProductName is then compared against this list: hsql, derby, 
mysql, oracle, mssql, h2, db2, postgresql, openedge, informix. There is no 
match and the exception (little strange) is thrown:
<javaCode>
String msg = "Unsupported database: " + dbUrl + ". Database will not be created 
automatically by the WSO2 Registry. Please create the database using 
appropriate database scripts for the database.";
throw new Exception(msg);
</javaCode>
It does not depend on the fact if database is created using scripts or not. 
Simply - the "MariaDB" is not in the list.
Best regards
Roman Chrenko

_______________________________________________
Architecture mailing list
[email protected]<mailto:[email protected]>
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture


--
Ruwan Abeykoon | Director/Architect | WSO2 Inc.
(w) +947435800  | Email: [email protected]<mailto:[email protected]>
[http://c.content.wso2.com/signatures/wso2-signature-general.png]
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to