The DBCENTURY variable

If a String value represents a DATE value that has less than a three-digit year and DBCENTURY is set, Informix® JDBC Driver converts the String value to a DATE value and uses the DBCENTURY property to determine the correct four-digit expansion of the year.

The methods affected and the conditions under which they are affected are summarized in the following table.
Method Condition
PreparedStatement.setString(int, String) The target column is DATE.
PreparedStatement.setObject(int, String) The target column is DATE.
IfxPreparedStatement.IfxSetObject(String) The target column is DATE.

ResultSet.getDate(int)
ResultSet.getDate(int, Calendar)
ResultSet.getDate(String)
ResultSet.getDate(String, Calendar)

The source column is a String type.

ResultSet.getTimestamp(int)
ResultSet. getTimestamp(int, Calendar)
ResultSet.getTimestamp(String)
ResultSet.getTimestamp(String, Calendar)

The source column is a String type.

ResultSet.updateString(int, String)
ResultSet.updateString(String, String)

The target column is DATE.

ResultSet.updateObject(int, String)
ResultSet.updateObject(int, String, int)
ResultSet.updateObject(String, String)
ResultSet.updateObject(String, String, int)

The target column is DATE.
The following table describes the four possible settings for the DBCENTURY environment variable.
Setting Meaning Description
P Past Uses past and present centuries to expand the year value.
F Future Uses present and next centuries to expand the year value.
C Closest Uses past, present, and next centuries to expand the year value.
R Present Uses present century to expand the year value.

See the Environment Variables section in the Informix® Guide to SQL: Reference for a discussion of the algorithms used for each setting and examples of each setting.

Here is an example of a URL that sets the DBCENTURY value:
jdbc:informix-sqli://myhost:1533:informixserver=myserver;
   user=myname;password=mypasswd;DBCENTURY=F;

A URL must not have a line break.

Informix® JDBC Driver always includes four-digit years when it sends java.sql.Date and java.sql.Timestamp values to the server. Similarly, the server always includes four-digit years when it sends Informix® date values to Informix® JDBC Driver.

For examples of how to use DBCENTURY with Informix® JDBC Driver, see the DBCENTURYSelect.java, DBCENTURYSelect2.java, DBCENTURYSelect3.java, DBCENTURYSelect4.java, and DBCENTURYSelect5.java example programs.