简体   繁体   中英

Bluemix Liberty SQLDB

I have created an "enterprise template" Liberty server with an EAR file application requiring a few SQLDB connections. This is working and I am able to cf push this server to the Bluemix environment.

My question is how do I go about packaging the entire content and publish this to Bluemix in ONE action (ie, they will have an instance of the same application running on Liberty with the same SQLDB table setup).

From my quick browsing of the blogs and Q&A, I have only found articles talking about creating the SQLDB ahead of time, packaging the Liberty runtime as a .zip file, and then using cf push to Bluemix. Because the SQLDB was created ahead of time, the DB connections would work.

So is there a way to package the Liberty server with the SQLDB creation as one entity into perhaps one "buildpack"? If so, can someone guide me on the steps involved? (or articles/blogs, anything would help)

You can't do it.

If you want create a script that do all operations in one time, an idea is create a simple job (in java for example) that you can launch in your script.

The job should perform these steps:

  1. connect to sqldb - bluemix service using VCAP_SERVICES (for this step you can see the documentation https://www.ng.bluemix.net/docs/#services/SQLDB/index.html#SQLDB
  2. run DDL (create table, ...) in your little job
  3. close connection

另一种选择是打包数据库迁移助手(类似迁徙路线中的应用。然后你可以使用Java,在应用程序启动(我们已经有好运气@Singleton @Startup EJB的这种模式)调用它。迁移将运行这种模式的另一个优点是,您可以使用迁移来更新现有表的表(顾名思义)。

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