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:informix://servername:port;InformixServer=informixserver;
Database=databasename;User=userID;Password=password;[property=value[;...]];

where:

servername

is the IP address or name of the computer that is running the database server to which you want to connect.

port

is the number of the TCP/IP port.

informixserver

is the name of the database server to which you want to connect.

databasename

is the name of the database to which you want to connect.

userID

specifies the user ID that is used to connect to the Informix database.

password
specifies a password that is used to connect to your Informix 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:informix://myserver:1526;InformixServer=myinformixserver;
    DatabaseName=account;User=jsmith;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.