Bltucker
Bltucker

Reputation: 467

Wildfly mysql with SSL

I have a web app using a mysql database as its data store. It is currently running in Glassfish and talking to that mysql database with SSL.

I am thinking about migrating to Wildfly but I can't seem to create a Wildfly datasource that will talk to the mysql database with SSL enabled.

The Wildfly server is running in standalone mode. What config or option do I need to add that will allow Wildfly to talk to the mysql database with ssl?

Upvotes: 2

Views: 3025

Answers (1)

Shiva
Shiva

Reputation: 6887

You will need to add the certificate to keystore to make an SSL connection.You can refer to the following links.

  1. Install SSL Certificate
  2. Create KEYSTORE-File from existing SSL-Certificate

Then you can create a datasource with a SSL URL as demonstrated in the below sample in standalone.xml file.

<datasource jndi-name="java:jboss/datasources/dbname" pool-name="poolname">
    <connection-url>jdbc:mysql://serveraddress:3306/dbname?ssl=true</connection-url>
    <driver>mysql</driver>
    <security>
        <user-name>user</user-name>
        <password>password</password>
    </security>
</datasource>
<drivers>
    <driver name="mysql" module="com.mysql">
        <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
    </driver>
</drivers>

Upvotes: 4

Related Questions