Configuration

Configure your connection to Oracle databases with a user name, password, and DSN.

The most common way of configuring CCL queries to interact with an Oracle database includes a database user name, password, and Database Source Name (DSN). Follow the steps in this section to set up this type of connection with Oracle from within Sybase CEP Engine.

  1. In the c8-services.xml file, create a service entry section for the Oracle database. This entry provides information to enable Sybase CEP Server to communicate with the external database server. If you want to connect to multiple database servers, or to multiple databases on a single server, create a separate section for each database.
    The c8-services.xml file distributed with Sybase CEP contains several sample database service entry sections, each for a different type of database service. To find these entries, search for the string
    Type="DATABASE"
    
    inside the file. You can either customize one of these sections, or make a copy of it elsewhere in the file and customize the copy.
  2. Set the "Service Name" preference to a unique service name for Oracle. This name is case-sensitive, must begin with a letter, and may contain a character string consisting of letters, numbers, underscores, dots, and/or colons. The service name must be the same name as the name of the database you use in your CCL queries. For example, if your database subquery is:
    ...
    	FROM (DATABASE "Database1" SCHEMA "valuation.ccs" 
    	SELECT * FROM Stocks WHERE T.symbol=Stocks.symbol)
    
    The database name (
    Database1
    
    ) in the database subquery should match the service name in the c8-services.xml file.
  3. Set the "Type" preference to DATABASE.
  4. Optionally, add a description of your service entry in the "Description" element.
  5. Set the "DBDriverType" preference to the type of driver you use to communicate with your Oracle database. Sybase supports the following driver types:
    • DBDriverOracle – use if you are connecting to the database with a native (non-ODBC) Oracle driver. The connect string for DBDriverOracle is either an Oracle TNS Name or an EZ Connect string.

    • DBDriverODBCSybaseIQUnix – use if you are connecting to the database with a Sybase IQ driver on UNIX-like operating systems.

    • DBDriverODBC – use if you are connecting to the database with an ODBC driver, including a Sybase IQ driver on Microsoft Windows. If you set up an ODBC connection that uses the DSN name as the connect string name, you must also set up a DSN. Refer to your ODBC documentation for instructions on installing and setting up the necessary ODBC drivers for your database.

  6. If necessary, include a "DatabaseType" preference in your service entry. You can only use this preference in conjunction with the "DBDriverType" setting of DBDriverODBC. You must set this preference if you want to connect to the Oracle TimesTen database from Sybase CEP Engine. It may improve performance and compatibility for database drivers that do not fully implement the ODBC standard, or that provide features or optimizations that are not part of the standard. You can set the preference to the following values:
    • MyODBC35.

    • PostgreSQL.

    • SQLServer2005.

    • TimesTen.

    Here is an example of a "DatabaseType" setting:

    <Param Name="DatabaseType">TimesTen</Param>
    
  7. Set the "DBDriverConnectString" preference.
    The "DBDriverConnectString" may be the Oracle TNS Name, or may use the following format:
    
    dbserver:port/OracleSID
    
    where:

    • 
      dbserver
      
      is the name of the computer on which the other server resides.
    • 
      port
      
      is the port number used to communicate with the other server.
    • 
      OracleSID
      
      is the service name of the Oracle database to which you want to connect.

    For DBDriverODBC and DBDriverODBCSybaseIQUnix, the "DBDriverConnectString" is the name of the DSN entry you have set up for your connection in the ODBC control panel.

    Note that, if your "DBDriverConnectString" contains one of the following characters, the character must be preceded by a back slash escape character (\). These characters are: semicolon (;), forward slash (/), question mark (?), colon (:), at sign (@), ampersand (&), equal sign (=), plus sign (+), dollar sign ($), and comma (,).

  8. Optionally, set the "CacheMaximumAge" preference to specify how long Sybase CEP Server should keep a cached copy of the information that it read from the external database.

    For more information on caching, see "Caching Data from an External Database, RPC Server, or Public Window" on page 74 of the Sybase CEP Administrator's Guide.

  9. Set the "Username" preference to the user name that should be used when communicating with the external database.

    Note that this value is unencrypted, so anyone with access to the c8-services.xml file may read the user name.

  10. Set the "Password" preference to the password for the user name you specified in the "Username" preference.

    Like the user name, the password is unencrypted.

  11. Set any desired optional preferences for your database service entry in the c8-services.xml file.

    For more information, see "Setting Optional Preferences for Services" on page 71 of the Sybase CEP Administrator's Guide.

This is an example of an entry that uses the Oracle OCI driver:

<Service Name="OracleDb" Type="DATABASE" >
 <Description>local oracle dod db</Description>
 <Param Name="DBDriverType">DBDriverOracle</Param>
 <Param Name="DBDriverConnectString">myhost:6789/mydb</Param>
 <Param Name="CacheMaximumAge">0</Param>
 <Param Name="Username">myuser</Param>
 <Param Name="Password">mypass</Param>
</Service>

This example uses an ODBC driver. Note the different value for DBDriverType:

<Service Name="MyDB" Type="DATABASE" > 
 <Description>sample odbc db</Description> 
 <Param Name="DBDriverType">DBDriverODBC</Param> 
 <Param Name="DBDriverConnectString">MyDSNName</Param>
 <Param Name="CacheMaximumAge">0</Param> 
 <Param Name="Username">myuser</Param>
 <Param Name="Password">mypass</Param>
</Service>

This example uses a Sybase IQ driver. Note the different value for DBDriverType:

<Service Name="MyIQDB" Type="DATABASE" > 
 <Description>sample sybase iq db</Description> 
 <Param Name="DBDriverType">DBDriverODBCSybaseIQUnix</Param> 
 <Param Name="DBDriverConnectString">MyDSNName</Param>
 <Param Name="CacheMaximumAge">0</Param> 
 <Param Name="Username">myuser</Param>
 <Param Name="Password">mypass</Param>
</Service>

Make sure that the external database to which you are connecting is running properly before attempting to connect to it from Sybase CEP Engine.