Configuring the JDBC data source by using an nzjdbc.ini file (UNIX and Linux®)

A data source contains the sets of data that the JDBC driver accesses, along with all the environments that are associated with the data.

You can configure a JDBC data source by specifying data source properties when creating a connection string in a JDBC application. For information about how to specify properties when creating a connection string, see JDBC connection strings. Alternatively, you can save data source configuration information, including a data source name (DSN), on the local server by using the nzjdbc.ini file. You can then specify that DSN for the dsn property as part of the connection string, which enables the connection string to access all the associated data source configuration properties that are in the nzjdbc.ini file.

Before you begin

Install the JDBC driver. See Installing the JDBC driver (UNIX and Linux).

Procedure

  1. Use the export command to modify the value of your CLASSPATH environment variable to include the location of the Netezza JDBC Version 3.0 driver.
    An example follows:
    export CLASSPATH=.:/usr/local/nz/lib/nzjdbc3.jar
    This command changes the environment for the current session only. After you verify that your environment modification works correctly, you can edit your login script to set the environment variable when users log in.
  2. Issue the following command:
    java -jar nzjdbc3.jar -c --add
  3. Specify configuration values at the command prompts. For information about how to specify values, see Configuring the JDBC data source by using an nzjdbc.ini file (Windows). After you finish specifying values, the nzjdbc.ini file is created in the same directory as the driver.
  4. Ensure that you specified the nzjdbc.ini file for the CLASSPATH environment variable.
  5. Ensure that you can access the data source that you defined in the nzjdbc.ini file. To test this, specify a connection string whose URL includes the data source name from the nzjdbc.ini file, and run an application.
  6. Test the connection by running the nzjdbc3.jar file with the -t option. An example follows:
    java -jar nzjdbc3.jar -t
    This connection is tested without WebSphere®. You can enter additional values for the test, such as those shown in the following example. If you are testing a connection to a database that has multiple schemas, include the -schema option.
    java -jar nzjdbc3.jar -t -host yourhostname -u username
    -pw password -db database -schema schemaname
    

What to do next

Before you use JDBC, verify that your system has the Java™ runtime environment installed. You need JRE Release 1.5 or later, or JRE 1.7 or later if your Netezza Performance Server host runs release 7.1.0.0 or later and uses SP 800-131a cryptography. For more information, go to the Java website (http://www.java.com), where you can test your system for Java software support and download the latest version for your system.