0

I am newer to APIMan. I have configured apiman-tomcat-final-distro with Apache Tomcat instance. Now as it is using default as a H2 Database for APIMan, I want to configure the MySQL DB with this.

Some of the documentations are available on RedHat APIMan Page, but they are unclear and not properly stated.

Any step wise approach i.e. Blogger or Tutorial will be of great help.

Thanks.

Dipen Shah
  • 21
  • 1
  • 2

2 Answers2

1

The production installation guide provided by apiman itself is a good resource in my opinion. Here is the appropriate link to your questions. I do not want to repeat the same steps, but the links can be moved so highlighting some key points.

apiman guide

  • Deploy a JDBC driver compatible with your database
  • Update the apiman-ds.xml datasource file (to point it at your database)
  • Update the hibernate dialect in apiman.properties
ulab
  • 1,079
  • 3
  • 15
  • 45
  • Thanks for the reply@ulab but the configuration you are telling is for Wildfly Server. I need to configure it on Tomcat instance. Request for any stepwise approach or tutorial for the same. – Dipen Shah Jul 13 '17 at 09:05
  • agreed. but the core steps remains the same. May be you can provide the steps that you have tried and the problem you are facing, would attract better answers. – ulab Jul 13 '17 at 09:09
0

When you are in the tomcat base directory, modify the following files :

  • In conf/apiman.properties put :

Don't forget to prepend java:comp/env/ to your jdbc name and only in the apiman.properties file

apiman.hibernate.connection.datasource=java:comp/env/jdbc/datasources/apiman-manager
apiman.hibernate.dialect=io.apiman.manager.api.jpa.ApimanMySQL5Dialect
apiman.hibernate.hbm2ddl.auto=validate

# API Manager storage settings.
apiman-manager.storage.type=jpa
apiman-manager.storage.jpa.initialize=true
# apiman-manager.storage.es.protocol=${apiman.es.protocol}
# apiman-manager.storage.es.host=${apiman.es.host}
# apiman-manager.storage.es.port=${apiman.es.port}
# apiman-manager.storage.es.username=${apiman.es.username}
# apiman-manager.storage.es.password=${apiman.es.password}
# apiman-manager.storage.es.timeout=${apiman.es.timeout}
# apiman-manager.storage.es.initialize=true

  • In conf/context.xml put :
<Context>
    <Resource name="jdbc/datasources/apiman-manager" auth="Container" 
    type="javax.sql.DataSource"
                   maxTotal="100" maxIdle="30" maxWaitMillis="10000"
                   username="username" password="password" 
    driverClassName="com.mysql.jdbc.Driver"
                   url="jdbc:mysql://YOUR_DB_IP:YOUR_DB_PORT/apiman"/>
         <ResourceLink global="jdbc/datasources/apiman-manager" 
    name="jdbc/datasources/apiman-manager" type="javax.sql.DataSource"/>
</Context>
  • In conf/web.xml :
<web-app>
    <resource-ref>
        <res-ref-name>jdbc/datasources/apiman-manager</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>
</web-app>
  • In lib put the jar of your driver (for example mysql-connector-java-5.1.33.jar)

And that should work !