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.
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) |
The source column is a String type. |
ResultSet.getTimestamp(int) |
The source column is a String type. |
ResultSet.updateString(int, String) |
The target column is DATE. |
ResultSet.updateObject(int, String) |
The target column is DATE. |
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.
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.