Quick Start: Progress® DataDirect® for JDBC for

Amazon Redshift Driver

The following information enables you to connect with and test your driver immediately after installation. For installation instructions, refer to the Installation Guide. This Quick Start covers the following topics:

Connecting to a Database

Testing the Connection

Tuning the Driver for Optimal Performance

Connecting to a Database

Once the driver is installed, you can connect from your application to your data store in two ways: using the JDBC Driver Manager or using a JNDI data source. The following section provides information you need to get started using the drivers with the Driver Manager. For information on using data sources, refer to the User's Guide.

Environment Setup

Set your system CLASSPATH to include the following entry:

install_dir/lib/redshift.jar
 
Note: The dependent jar files that are installed in the install_dir/lib folder with the redshift.jar must remain in the same directory as the redshift.jar file for the driver to be able to find them without explicitly adding them to the class path.
 
Windows Example
 
CLASSPATH=.;c:\program files\progress\datadirect\jdbc_51\lib\redshift.jar
 
UNIX/Linux Example
 
CLASSPATH=.:/home/user1/progress/datadirect/jdbc_51/lib/redshift.jar

Driver Manager

To establish a database connection using the Driver Manager, your application must register the class name of the JDBC driver with the Driver Manager using the Class.forName() method and specifying the driver class name as the argument. The application must then invoke the DriverManager.getConnection() method supplying a connection URL.

IMPORTANT: If using Java SE 6 or higher as a JVM, you do not need to register the driver and can skip this step. Java SE 6 and higher automatically registers the driver with the JDBC Driver Manager.

The classname and connection URL syntax for the Amazon Redshift driver are:

 

Driver Classname:

com.ddtek.jdbc.redshift.RedshiftDriver

Connection URL:

jdbc:datadirect:redshift://<server>:<port>;

DatabaseName=<name>;

 

For example, a connection URL might take the following form:

jdbc:datadirect:redshift://Server3:5439;

DatabaseName=Test;User=admin;Password=adminpass

Refer to the User's Guide for a complete description of the connection URL syntax and descriptions of the connection properties that can be specified.

Example

 

// Register the driver with the driver manager.
// If using Java SE 6 or higher, you can omit this step. 
// Java SE 6 and higher automatically registers the driver. 
Class.forName("com.ddtek.jdbc.redshift.RedshiftDriver");
 
// Establish the Connection

String url = "jdbc:datadirect:redshift://<server>:<port>;

DatabaseName=<name>;";
Connection con = DriverManager.getConnection(url, "test04", "test04");
 
// Verify the Connection
DatabaseMetaData metaData = con.getMetaData();
System.out.println("Database Name: " + metaData.getDatabaseProductName());
System.out.println("Database Version: " + 
metaData.getDatabaseProductVersion());

Testing the Connection

DataDirect Test for JDBC is a Java software component developed by Progress DataDirect to test JDBC applications. Use the following steps to test your connection:

1.     Start DataDirect Test for JDBC by running testforjdbc.bat or testforjdbc.sh in the install_dir/testforjdbc directory, where install_dir is your installation directory.

2.     Click Press Here to Continue.

3.     From the Connection menu, select Connect to DB.

4.     Select the appropriate template for your data source, and specify the properties needed to connect. OK.

5.     A new connection window opens if the connection information was entered correctly. If the connection cannot be established, an error is displayed in the JDBC/Database Output window.

For more information about DataDirect Test for JDBC, refer to the User's Guide.

Tuning the Driver for Optimal Performance

The driver has connection properties that directly affect performance. To tune the driver for optimal performance, set the connection properties in the following table. Refer to the User's Guide if you need additional information.

If you are using SSL encryption

EncryptionMethod=noEncryption|SSL|requestSSL

Determines whether data is encrypted and decrypted when transmitted over the network between the driver and database server.

If your application returns insensitive result set data

InsensitiveResultSetBufferSize=-1|0|x

Determines the amount of memory used by the driver to cache insensitive result set data.

If your application is using statement pooling

MaxPooledStatements=0|x

Specifies the maximum number of pooled prepared statements for the connection. Setting this property to an integer greater than zero (0) enables the driver's internal prepared statement pooling, which is useful when the driver is not running from within an application server or another application that provides its own prepared statement pooling.

If you want your application to return table name information

ResultSetMetaDataOptions=0|1

Determines whether the driver returns table name information in the ResultSet metadata for Select statements.

If your application needs to handle Clobs

VarcharClobThreshold=x

Enables CLOB functionality when handling character data. Determines whether columns of the Character varying data type will be described as VARCHAR or LONGVARCHAR (CLOB).

© 2015. Progress Software Corporation. All rights reserved.