Friday, February 24, 2017

SOA12c MySQL adapter configuration platform error

Error: When you configure MySQL adapter in 12c SOA server (or in other platforms as well) you won't see any error, the Test Connection returns you success during configuration.  But when you try to use the dataSource in your BPM, BPEL or OSB projects you will see the error com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"name") VALUES ('hhh')' at line 1.
Please see the logs for the full DBAdapter logging output prior to this exception.  ConnectionFactory property platformClassName was set to org.eclipse.persistence.platform.database.oracle.Oracle10Platform but the database you are connecting to is MySQL.  Please validate your platformClassName setting.  This mismatch can cause the adapter to trigger runtime exceptions or execute SQL that is invalid for the database you are connected to.  This exception is considered not retriable, likely due to a modelling mistake.  To classify it as retriable instead add property nonRetriableErrorCodes with value "-1064" to your deployment descriptor (i.e. weblogic-ra.xml).  To auto retry a retriable fault set these composite.xml properties for this invoke: jca.retry.interval, jca.retry.count, and jca.retry.backoff.  All properties are integers.".

Solution:  The solution is quite same even for all other platforms. In the datasource configuration properties you will give the connection pool JNDI name (say  jdbc/MYSQLCONNECTION).  In the same properties there is one more property  PlatformClassName.  Change its default value org.eclipse.persistence.platform.database.oracle.Oracle10Platform   to org.eclipse.persistence.platform.database.MySQLPlatform .  For more clarity see below image.

Note: Most of the time if you are configuring to a database connection other than Oracle then make sure you also have a look on this property, and set it with right platform names.

List of the platformClassName used for different database:-

Oracle10+ (including 11g)

org.eclipse.persistence.platform.database.Oracle10PlatformOracle9+ (optional)

org.eclipse.persistence.platform.database.Oracle9Platform

Oracle8
org.eclipse.persistence.platform.database.Oracle8Platform

Oracle7
org.eclipse.persistence.platform.database.OraclePlatform

DB2
org.eclipse.persistence.platform.database.DB2Platform

DB2 on AS400e
oracle.tip.adapter.db.toplinkext.DB2AS400Platform

Informix
org.eclipse.persistence.platform.database.InformixPlatform

SQLServer 
org.eclipse.persistence.platform.database.SQLServerPlatform

MySQL
org.eclipse.persistence.platform.database.MySQLPlatform

Any other database
org.eclipse.persistence.platform.database.DatabasePlatform



ENJOY LEARNING NEW THINGS..... MAN LIFELONG IS A STUDENT.


No comments: