2

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?

Bltucker
  • 447
  • 3
  • 9
  • 17

1 Answers1

4

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>
Shiva
  • 6,677
  • 4
  • 36
  • 61
  • Do I need to reference the keystore from any xml config? Simply placing it in the directory should be enough? – Bltucker Jun 16 '15 at 14:12
  • @BLT: you have to refer the keystore from the xml file, please check the second link in the post,on how to do it. – Shiva Jun 18 '15 at 18:45
  • mentioned links are not browseable. Can you please help in steps you fallowed to this ? – Ashish Nov 07 '19 at 04:21