using ballerina v.1.0.1. on Mac. On host I put MySQL driver to /Library/Ballerina/ballerina-1.0.1/distributions/jballerina-1.0.1/bre/lib , run ballerine code and I was eble to connecto to DB.
When I created docker image with build command and spin a docker in compose env it failed with
ApplicationError message=error in sql connector configuration: Failed to get driver instance for jdbcUrl=jdbc:mysql://mysql:3306/api_svc?serverTimezone=UTC:No suitable driver at ballerinax.java_jdbc:createClient(jdbc_client.bal:87) ballerinax.java_jdbc.Client:__init(client_endpoint.bal:27)
Question: How can I mount properly MySQL driver in docker image? I cannot find any reference in the documentation.
Thanks,
Another option is to package the MySQL driver jar with the executable jar file of your Ballerina program. This way, you don't need to copy files to the docker container, because
ballerina build
command produces a self-contained executable jar with all the dependencies.In order to do this, you need to create a Ballerina project and a module. This guide contains more information on Ballerina projects.
Then, copy and paste the following section to the
Ballerina.toml
in your project directory.