How to give Worklight Server access to MySQL (SQL

2019-09-02 10:00发布

问题:

I'm migrating a worklight app from 5.0.3 to 5.0.6.

I tried to add

mysql-connector-java-5.1.22-bin.jar** to worklight.war

file but I get the following error:

Procedure invocation error. Runtime: java.lang.ClassNotFoundException: Class com.mysql.jdbc.Driver not found in Worklight platform or project /worklight

Any workaround?

回答1:

Why to the .war file? Add more information to your question: are you running Worklight in Eclipse or on an application Server (Tomcat/Liberty/WAS)?

If you are using the Worklight Developer Edition (essentially plug-in download for Eclipse):

  • You need to place mysql-connector-java-5.1.22-bin.jar to the \lib folder of your project... located at: yourProject\server\lib.
  • Make sure to also update the datasource definitions in the adapter XML:
<dataSourceDefinition>
    <driverClass>com.mysql.jdbc.Driver</driverClass>
    <url>jdbc:mysql://localhost:3306/mydb</url>
    <user>myUsername</user>
    <password>myPassword</password> 
</dataSourceDefinition>

If you are using Worklight by deploying it to an Application Server (Tomcat/Libery/WAS), the above actions will also update the .war file, located in yourProject\bin, which you will need to redeploy to your application server.