Cisco Cisco Firepower Management Center 4000 Guía Del Desarrollador

Descargar
Página de 180
 
2-8
FireSIGHT System Database Access Guide
 
Chapter 2      Setting Up Database Access 
  Connecting to the Database Using a Custom Program
Tip
If you cannot select the Cisco driver class when creating a new JDBC data source profile, add the driver 
using the JDBC driver JAR files you downloaded from the Defense Center.
Connecting to the Database Using a Custom Program
Once you install the certificate, you can enable custom Java report tools to query the Cisco database. 
Cisco provides a sample Java command line application named RunQuery that establishes the required 
SSL connection using the JDBC driver provided with your Defense Center. RunQuery retrieves both 
table records and table metadata. The source code is included in the 
src
 directory of the ZIP package 
you downloaded from the Defense Center. See 
Note
RunQuery is a sample client only, not a fully featured reporting tool. Cisco strongly recommends 
against using it as your primary method of querying the database. For information on using RunQuery, 
refer to the README file included in the ZIP package.
See the following for more information on connecting to the database using a custom program:
  •
 describes the Java classes and methods that the 
RunQuery application uses to set up the database connection and submit queries.
  •
 discusses environment requirements necessary for your Java 
application to execute.
Sample Code for Custom Java Programs
The RunQuery source code uses the functions discussed below. These code samples illustrate one of 
several possible implementation approaches.
Dynamically setting the SSL provider connection
After you install the SSL security certificate on your client (see 
), you can dynamically register your JSSE provider with the following line in your program:
Security.addProvider(new com.sun.net.ssl.internal.ssl.
 
Provider());
Initializing the JDBC driver for your program
You can load the JDBC driver class in your Java application using the 
Class.forName()
 method, as 
follows:
Class.forName("com.sourcefire.vjdbc.VirtualDriver").newInstance();
If your program launches from the command line, the user supplies the JDBC class as follows:
java -Djdbc.drivers=“com.sourcefire.vjdbc.VirtualDriver” program_name ...
where 
program_name
 is the name of your program.