Quick Start: Progress® DataDirect® for JDBC for Impala 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/jdbc/lib/impala.jar
Note: The dependent jar files that are installed with the impala.jar file must remain in the same directory as the impala.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\impala.jar
UNIX/Linux Example
CLASSPATH=.:/opt/Progress/DataDirect/JDBC_51/lib/impala.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.

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 or higher automatically registers the driver with the JDBC Driver Manager.

The application must then invoke the DriverManager.getConnection() method supplying a connection URL.

The classname and connection URL syntax for the Impala driver are:

Driver Classname:

com.ddtek.jdbc.impala.ImpalaDriver

Connection URL:

jdbc:datadirect:impala://<server>:<port>;DatabaseName=<name>;

 

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

jdbc:datadirect:impala://Server3:21050;DatabaseName=Test

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.impala.ImpalaDriver");
 
// Establish the Connection
String url = "jdbc:datadirect:impala://Server3:21050;DatabaseName=Test";
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 by running testforjdbc.bat (Windows) or testforjdbc.sh (UNIX/Linux) in the install_dir/testforjdbc directory, where install_dir is your installation directory.

2.     Select Connect To DB from the Connection menu to configure your connection.

3.     In the Database field, enter your connection URL as described above.

4.     If required, enter your user name and password in the fields provided.

5.     Click Connect.

Result: If the connection information is entered correctly, the JDBC/Database Output window reports that a connection has been established.

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 following connection properties:

If you want to increase the amount of insensitive result set data the driver caches instead of writing this data to disk

Set InsensitiveResultSetBufferSize to a value greater than the default value of 2048 (KB). To prevent the driver from writing insensitive result set data to disk, set this property to -1.

If your application does not need the benefits normally associated with Clobs

Set StringDescribeType to varchar (default).

If your application needs to access tables and views owned only by the current user

Set UseCurrentSchema to true.

 

© 2015. Progress Software Corporation. All rights reserved.