Configuring a JDBC Connection to an External Database

Create a service definition for a JDBC connection to the database of your choice.

To set up a JDBC connection from within Event Stream Processor, edit ESP_HOME/bin/service.xml.

  1. Set the Service Name parameter to a unique service name for the database service. This name is:
    • case-sensitive
    • must begin with a letter
    • may contain a character string consisting of either letters, numbers, underscores, dots, and colons.
    This service name is the value you specify to components, such as the Database adapter, that accesses external databases.
  2. Set the Type attribute of the service parameter to DB.
  3. (Optional) Add a description of your service entry in the Description parameter.
  4. Set the DriverLibrary parameter to the Event Stream Processor library of the database you want to connect to:
    Database DriverLibrary Value
    Adaptive Server Enterprise esp_db_jdbc_sybase_lib
    Microsoft SQL Server esp_db_jdbc_mssql_lib
    IBM DB2 esp_db_jdbc_db2_lib
    Oracle esp_db_jdbc_oracle_lib
    Kx Systems KDB+ esp_db_jdbc_kdb_lib
    SAP HANA esp_db_jdbc_lib
  5. If you are connecting to SAP HANA, set the DataSource parameter as shown:
    <Parameter  Name="DataSource">com/sap/db/jdbcext/DataSourceSAP</Parameter>
  6. Set the User parameter to the user name that you want to use when communicating with the external database.
    This value is unencrypted, so anyone with access to the services.xml may read the user name.
  7. Set the Password parameter to the password for your user name.
    To encrypt this password, add the encrypted="true" attribute after the password value and use the esp_cluster_admin utility to generate encrypted text.
  8. Set:
    Parameter Description
    Host Database server host name.
    Port Database server port number.
    Database Database name. This parameter is not necessary for Oracle and KDB.
    Important: For the Oracle JDBC driver, replace the Database parameter with the Instance parameter. For example, <Parameter Name="Instance">orcl</Parameter>.

    or

    Parameter Description
    ConnectString

    (Optional) This is a JDBC style connect string that contains the host, port and database information. This overrides the three separate Host, Port, and Database parameters. For guidelines on the format of this parameter, see the documentation provided with the database to which you wish to connect.

    If you want to enable password encryption between your driver and an external server, add the EncryptPassword property to the connect string and set it to true. For example:

    <Parameter Name="ConnectString>jdbc:sybase:Tds:localhost:5000/cep?ENCRYPT_PASSWORD=true</Parameter>