Connecting to an event source using JDBC
Connecting to an event source involves downloading and installing the JDBC driver, and specifying appropriate values for the connection-related properties.
JDBC drivers
You must obtain the JDBC driver for the target database from the database vendor and install it according to the vendor's instructions. The drivers are usually provided as Java™ archives (.jar).
Setting the CLASSPATH variable
Environment variables are specific preset values that establish the working environment of the probe. From the environment variable specified, the probe receives path information for the directories in which library files are present.
Set
the CLASSPATH
variable to the full path of the JDBC
jar file that you installed for your datasource. For example:
c:\\DB2\\db2jcc.jar
On UNIX or Linux operating systems, use the following command:
export
CLASSPATH=/home/jdbc_driver
where jdbc_driver is the full path of the JDBC jar file that you installed for your datasource.
On Windows operating systems, use the following command:
set CLASSPATH=c:\jdbc_driver
where jdbc_driver is the full path of the JDBC jar file that you installed for your datasource.
Database connection properties
- JdbcDriver: This property specifies the JDBC driver required to connect the database.
- JdbcUrl: This property specifies the URL of the target database.
- DBUsername: This property specifies the user name for the target database.
- DBPassword: This property specifies the password for the target database.
The format in which you specify the JdbcDriver and JdbcUrl properties depend on the type of database to which the probe is connecting.
The following table lists example values for the JdbcDriver and JdbcUrl properties for use with each database supported by the probe. Consult your driver documentation for more information about setting up database connections. Default values may be different depending on your setup.
DB2® LUW |
|
JdbcDriver |
|
JdbcUrl |
Where host_name is the name of the database host machine, port is the port number, and db_name is the name of the database. For example:
|
DB2 z/OS® |
|
JdbcDriver |
|
JdbcUrl |
Where host_name is the name of the database host machine, port is the port number, and db_name is the name of the database. For example:
|
Informix® |
|
JdbcDriver |
|
JdbcUrl |
Where host_name is the name of the database host machine, port is the port number, db_name is the name of the database, and server_name is the same as the host_name. For example:
|
Microsoft SQL Server |
|
JdbcDriver |
|
JdbcUrl |
Where host_name is the name of the database host machine, port is the port number, and db_name is the name of the database. The default port is 1433. For example:
|
MySQL |
|
JdbcDriver |
|
JdbcUrl |
Where host_name is the name of the database host machine, failover_host is the name of the optional failover host, port is the port number, db_name is the name of the database, and param1 and param2 are optional parameters. The default port is 3306. For example:
|
Oracle |
|
JdbcDriver |
|
JdbcUrl |
Where host_name is the name of the database host machine, port is the port number, and db_name is the name of the database. The default port is 1521. For example:
|
Sybase |
|
JdbcDriver |
|
JdbcUrl |
Where host_name is the name of the database host machine, port is the port number, db_name is the name of the database, and property is an optional parameter. For example:
|