Home | Previous Page | Next Page   Connecting to the Database > Using the DriverManager.getConnection() Method >

Format of Database URLs

For connections from a client, use the following format to specify database URLs:

jdbc:informix-sqli://[{ip-address|host-name}:port-number][/dbname]:
   INFORMIXSERVER=servername[;user=user;password=password]
   [;name=value[;name=value]...]

For connections on the database server, use the following format:

jdbc:informix-direct://[/dbname:;[user=user;password=password] ]

[;name=value[;name=value]...]

In the preceding syntax:

Blank spaces are not allowed in the database URL.

For example, on the client you might use:

jdbc:informix-sqli://123.45.67.89:1533/testDB:
   INFORMIXSERVER=myserver;user=rdtest;password=test

On the server, you might use:

jdbc:informix-direct://testDB;user=rdtest;password=test

Important:
Connections using server-side JDBC have different syntax. For details, see the IBM Informix: J/Foundation Developer's Guide or the release notes for your version of the database server.

The following table describes the variable parts of the database URL and the equivalent Informix connection properties.

Informix Connection Property Database URL Variable Required? Description
IFXHOST ip-addresshost-name Yes for client-side JDBC, unless SQLH_TYPE is defined or IFXHOST is used; no for server-side JDBC The IP address or the host name of the computer running the Informix database server
PORTNO port-number Yes for client-side JDBC, unless SQLH_TYPE is defined or PORTNO is used; no for server-side JDBC The port number of the Informix database server
The port number is listed in the /etc/services file.
DATABASE dbname No, except for connections from Web applications (such as a browser) running in the database server The name of the Informix database to which you want to connect
If you do not specify the name of a database, a connection is made to the Informix database server.
INFORMIXSERVER server-name Yes The name of the Informix database server to which you want to connect
USER user Yes The name of the user who wants to connect to the Informix database or database server
You must specify both the user and the password or neither. If you specify neither, the driver calls System.getProperty() to obtain the name of the user currently running the application, and the client is assumed to be trusted.
PASSWORD password Yes The password of the user
You must specify both the user and the password or neither. If you specify neither, the driver calls System.getProperty() to obtain the name of the user currently running the application, and the client is assumed to be trusted.
none name=value No A name-value pair that specifies a value for the Informix environment variable contained in the name variable, recognized by either IBM Informix JDBC Driver or Informix database servers
The name variable is case insensitive.
See Specifying Properties and Using Informix Environment Variables for more information.

If an LDAP server or sqlhosts file provides the IP address, host name, or port number through the SQLH_TYPE property, you do not have to specify them in the database URL. For more information, see Dynamically Reading the Informix sqlhosts File.

IP Address in Connection URLs

The IBM Informix JDBC Driver, Version 3.0, supporting the JDK 1.4, is IPv6 aware. That is, the code that parses the connection URL can handle the longer (128-bit mode) IPv6 addresses (as well as IPv4 format). This IP address can be a IPv6 literal, for example:

3ffe:ffff:ffff:ffff:0:0:0:12

To connect to the IPv6 port with an IDS 10.0 server, use the system property, for example:

java -Djava.net.preferIPv6Addresses=true ...

With the IBM Informix JDBC Driver, Version 3.0, handling of URLs without IPv6 literals is unchanged, and legacy behavior is unchanged.

The colon (that is, :) is a key delimiter in a connection URL, especially in IPv6 literal addresses.

You must create a well-formed URL for the driver to recognize an IPv6 literal address. Note, in the example below:

jdbc:informix-sqli://3ffe:ffff:ffff:ffff:0::12:8088:informixserver=X... 
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]