JDBC connectivity to PostgreSQL is achieved in much the same way as is connectivity to other databases - via a JDBC driver. The PostgreSQL JDBC driver is deployed to QuerySurge Agents, and the Connection is created using the Connection Extensibility feature of the QuerySurge Connection Wizard.
Setting up a QuerySurge Connection with the PostgreSQL JDBC Driver
A QuerySurge PostgreSQL Connection is set up using the Connection Extensibility feature of the QuerySurge Connection Wizard..
- Download the PostgreSQL JDBC driver. QuerySurge currently uses Java 7, so download either the JDBC 4.0 or JDBC 4.1 driver version. The URL is here.
Note: We have some reports of the JDBC 4.1 driver mishandling JDBC URLs.
- Deploy the PostgreSQL JDBC driver jar to your Agent(s). The procedure for deploying a new driver to a QuerySurge Agent is here (for Agents on Windows) and here (for Agents on Linux).
- Log into QuerySurge as a QuerySurge Admin user, and navigate to the Admin view. Steps for using the Connection Extensibility feature can be found here. To use the Connection Extensibility option in the Connection Wizard with the PostgreSQL driver, you'll need the following information:
Connection URL template:
Sample Connection URL:
Note: The default port for PostgreSQL is 5423.
Note: The PostgreSQL driver supports a broad range of URL connection properties that you can see here.
Note: The JDBC URL for PostgreSQL is the same structure as Amazon's Redshift. This might cause unexpected behavior when querying or extracting metadata. To avoid utilizing the Redshift driver add the value "OpenSourceSubProtocolOverride=true" to the URL. For more information please view the Redshift documentation.
When you've entered your Connection information, the Connection Wizard will look like:
- If you have a Test Query, feel free to enter it in order to verify that your Connection parameters are correct. A
SELECT 1query is valid in PostgreSQL. However, any standard query that returns a small amount of information is appropriate - one row is enough. You can use the Test Connection button if you've entered a Test Query:
The Connection test gives a popup showing whether the Connection was successfully completed:
- Once you have the information entered and (optionally) verified with a Connection test, click the Save button to save the Connection. You're ready to use the Connection in a Query