skip to main content
Using the driver : Using client information : Returning metadata about client information locations
  

Try DataDirect Drivers Now

Returning metadata about client information locations

You may want to return metadata about the register, variable, or column in which the database stores client information. For example, you may want to determine the maximum length allowed for a client information value before you store that information. If your application attempts to set a client information value that exceeds the maximum length allowed by the database, that value is truncated and the driver generates a warning. Determining the maximum length of the value beforehand can avoid this situation.
To return metadata about client information, call the DatabaseMetaData.getClientInfoProperties() method.
// Get Database Connection
Connection con = DriverManager.getConnection(
   "jdbc:datadirect:sqlserver://MyServer:1433;DatabaseName=jdbc", "test", "secret");
DatabaseMetaData metaData = con.getMetaData();
ResultSet rs = metaData.getClientInfoProperties();
...
The driver returns a result set that provides the following information for each client information property supported by the database.
*Property name
*Maximum length of the property value
*Default property value
*Property description