There are two recent changes to App Connect Enterprise which now enable users of the cloud service to connect directly (without any need for an additional software installation) to JDBC based endpoints.

  • JDBC Jar files can now be placed into an application. Instead of placing the jar files within the product installation, you can now supply jar files within the application
  • Connection information can now be defined within a “JDBC Policy” which can reference jar files within the application and also contain all connection details such as usernames and passwords

Below is an example configuration showing how to achieve this.

Pre-requisites

Sample Application

Download the attached Project Interchange file, which you can import into your App Connect Enterprise Toolkit. This file contains two projects:

  • A simple Application project named JDBCinACEoC containing a message flow named JDBC.msgflow with the message flow nodes HTTP Input -> Java Compute -> HTTP Output. This message flow queries a database and returns the response to the user.
  • A Policy project named DefaultPolicies containing a JDBC policy named BLUDB.policyxml for connecting to DB2 on Cloud

Configuration

  • Into your App Connect Enterprise Toolkit, import the contents of the attached Project Interchange file JDBCinACE
  • Import the JDBC jar file db2jcc4.jar which you downloaded into the application JDBCinACEoC
  • Open your DB2 on Cloud instance and find out your security credentials:
    • Select the “Service credentials” section on the left menu
    • If you have not created any credentials before:
      • Select “New credentials”
      • Select “Add”

    • Select the “View credentials” drop down on the credential. This should present a number of fields. Please make a note of the following:
      • hostname
      • password
      • port
      • db
      • username

  • In your App Connect Enterprise Toolkit, open the JDBC policy named BLUDB.policyxml and edit the following parameters
    • “Name of the database” should contain the value from the db field shown in the above screenshot, for example BLUDB
    • “Connection URL format” should contain values from multiple fields shown in the above screenshot in the format “jdbc:db2://:/:user=;password=;”, for example jdbc:db2://dashdb-txn-sbox-yp-lon02-01.services.eu-gb.bluemix.net:50000/BLUDB:user=hbg87jy8yg;password=oijoijij98uo8987
    • “Database server name” should contain the value from the hostname field shown in the above screenshot, for example dashdb-txn-sbox-yp-dal09-03.services.dal.bluemix.net
    • “Database server port number” should contain the value from the port field shown in the above screenshot, for example 50000
    • Make sure that “User JAR files that have been deployed in a .bar file” is set to true

  • Create a new bar file with both the application and policy. Once you have created the bar if you select the “Manage” tab you should see its contents like the following screenshot

Testing

  • Deploy and start the created bar file to the App Connect (enterprise plan).
  • Open the integration in the cloud ui and make a note of the HTTP input URL
  • Click on the “Credentials” link and then “Copy credentials” to copy the credentials into your clipboard
  • Use an application such as curl to test your application i.e. curl -u iib:<password> https://tgmesftb.ace.ibm.com/jdbc. This should result in a response such as: “<Results><Customer><Number>10</Number><Name>Rob</Name></Customer><Customer><Number>20</Number><Name>Dave</Name></Customer></Results>

2 comments on"Connecting integrations to JDBC endpoints on App Connect"

  1. Thanks! I figured this out by myself just today:| Is it necessary to use always DefaultPolicies in ACE on Cloud as a default PolicyProject?

    • BenThompsonIBM January 25, 2019

      Hi Aris,

      Glad to hear that you have been using this new feature. Regarding your question about “DefaultPolicies” … I guess the original article should have been clearer: No, you can choose any name you like when defining the name of your Policy Project in the App Connect Enterprise Toolkit, it is just this example happened to use a project interchange file which had a policy project of this name. This Policy Project, and the policy it contains, are placed entirely under your control because you can choose in your Application and Flow which Policy / Policy Project you wish to refer to, and deployment of both the Policy Project and the Application and Flow are all handled in the BAR file itself.

      In the Cloud service, you can also use the menus to define policies – this part of the cloud service was available when we were still branded as IBM Integration Bus on Cloud, and actually pre-dates the ACEv11 software capabilities in the area of policies. These policies, which are defined exclusively through the UI (web browser) of the cloud service, result in additional definitions being placed into the ACE containers which the service starts up on your behalf when you deploy your BAR files.

      This means that as a user, you now have two separate ways available to get configuration information into your running containers – both the very controlled way through our web browser UI, and a much more free-form method (discussed in this JDBC example) of using policies inside policy projects which are carried inside the BAR files which you upload. For scenarios like this one, where you also want to carry a JDBC driver into the service as well, the more free-form method gives you many more functional opportunities!

      Cheers,
      Ben

Join The Discussion

Your email address will not be published. Required fields are marked *