Passing the connection URL
- Last Updated: July 30, 2024
- 1 minute read
- DataDirect Connectors
- JDBC
- PostgreSQL 6.0
- Documentation
After setting the CLASSPATH, the required connection information needs to be passed in the form of a connection URL. The following example includes the properties required for connecting with user ID/password authentication.
Connection URL Syntax
The connection URL takes the following form:
jdbc:datadirect:postgresql://servername:port;
User=userID;Password=password;[property=value[;...]];
where:
- servername
-
is the IP address or name of the server to which you are connecting.
- port
-
is the number of the TCP/IP port.
- userID
-
specifies the user ID that is used to connect to the PostgreSQL database.
- password
- specifies a password that is used to connect to your PostgreSQL database.
- property=value
- specifies connection property settings. Multiple properties are separated by a semi-colon.
The following example connection string includes the properties required for connecting with the user ID/password authentication.
Connection conn = DriverManager.getConnection
("jdbc:datadirect:postgresql://server1:5432;
User=test;Password=secret;");
Note: The User and Password properties are not required to be stored in the connection
string. They can also be passed separately by the application.