简体   繁体   中英

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?

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM