I have deployed a Worksphere Liberty project from eclipse to Bluemix. Now I want to connect it with an existing Db2 database. What are the steps to follow?
-
Stackoverflow is a community that will gladly help you solve your coding issue, but you must show what you have tried so far and where you are getting stuck. Please update your question. – Jeff Sloyer Jul 30 '15 at 18:20
3 Answers
Check out the example app Java DB Web Starter. It uses a DB2 database in Bluemix.

- 4,899
- 1
- 24
- 48
Does your existing database have a URL which is accessible from the internet? If so, you can directly talk to the database from your Bluemix application.
Class.forName("com.ibm.db2.jcc.DB2Driver");
Connection connection = connection = DriverManager.getConnection("jdbc:db2://localhost:50000/yourdb", "username", "pwd");
Be sure to package the db2 driver jar in your WEB-INF/lib.
If your datasource definition is already defined in a Liberty server.xml config, you can push the entire liberty server pacakge.
If your existing database is behind a company firewall, look at the Secure Gateway to expose the connection securely.

- 3,536
- 1
- 12
- 19
Assuming you need to connect to an existing DB2 database that resides on-premises (outside of Bluemix), you would need to use the Bluemix Cloud Integration service. With it, you can move data or create REST APIs for Bluemix applications to access and use.

- 942
- 5
- 14