java.sql

Class DriverPropertyInfo


public class DriverPropertyInfo
extends Object

Driver properties for making a connection. The DriverPropertyInfo class is of interest only to advanced programmers who need to interact with a Driver via the method getDriverProperties to discover and supply properties for connections.

Field Summary

String[]
choices
An array of possible values if the value for the field DriverPropertyInfo.value may be selected from a particular set of values; otherwise null.
String
description
A brief description of the property, which may be null.
String
name
The name of the property.
boolean
required
The required field is true if a value must be supplied for this property during Driver.connect and false otherwise.
String
value
The value field specifies the current value of the property, based on a combination of the information supplied to the method getPropertyInfo, the Java environment, and the driver-supplied default values.

Constructor Summary

DriverPropertyInfo(String name, String value)
Constructs a DriverPropertyInfo object with a name and value; other members default to their initial values.

Method Summary

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

choices

public String[] choices
An array of possible values if the value for the field DriverPropertyInfo.value may be selected from a particular set of values; otherwise null.
Usages and Demos :

View More Examples of choices
   1: import java.sql.Connection;
   2: import java.sql.DriverPropertyInfo;
   3: import java.sql.PreparedStatement;
   4:         ...
   5:     protected void fillPropertyInfo(ArrayList pi, Properties info) {
   6:         DriverPropertyInfo p;
   7: 
   8:         ...
   9:         p = new DriverPropertyInfo(HOST, info.getProperty(HOST));
  10:         p.description = "The host to connect to";
  11:         ...
  12:         p.required = false;
  13:         p.choices = new String[]{"localhost"};

View Full Code Here
   1: import java.sql.DriverManager;
   2: import java.sql.DriverPropertyInfo;
   3: import java.sql.PreparedStatement;
   4:         ...
   5: 
   6:         DriverPropertyInfo p;
   7:         
   8:         ...
   9:         p = new DriverPropertyInfo(FORCECLIENTENC,
  10:                 info.getProperty(FORCECLIENTENC));
  11:         ...
  12:         p.required = false;
  13:         p.choices = null;

View Full Code Here

description

public String description
A brief description of the property, which may be null.
Usages and Demos :

View More Examples of description
   1: import java.sql.DriverManager;
   2: import java.sql.DriverPropertyInfo;
   3: import java.sql.SQLException;
   4:         ...
   5:   
   6:   private static final DriverPropertyInfo USER_PI = new DriverPropertyInfo("user", "");
   7:   private static final DriverPropertyInfo PASS_PI = new DriverPropertyInfo("password", "");
   8:         ...
   9:     USER_PI.required = true;
  10:     USER_PI.description = "user account name";
  11:     PASS_PI.required = true;
  12:         ...
  13:     PASS_PI.description = "user account password";

View Full Code Here
   1: 
   2: import java.sql.DriverPropertyInfo;
   3: import java.sql.SQLException;
   4:         ...
   5:             this.dpbKey = dpbKey;
   6:             this.description = description;
   7:             
   8:         ...
   9:     
  10:     public static DriverPropertyInfo[] getDriverPropertyInfo(Properties props) {
  11:         ArrayList result = new ArrayList();
  12:         ...
  13:             
  14:             DriverPropertyInfo driverPropInfo = new DriverPropertyInfo(

View Full Code Here
   1: import java.sql.Connection;
   2: import java.sql.DriverPropertyInfo;
   3: import java.sql.PreparedStatement;
   4:         ...
   5:     protected void fillPropertyInfo(ArrayList pi, Properties info) {
   6:         DriverPropertyInfo p;
   7: 
   8:         ...
   9:         p = new DriverPropertyInfo(HOST, info.getProperty(HOST));
  10:         ...
  11:         p.description = "The host to connect to";

View Full Code Here
   1: 
   2: import java.sql.DriverPropertyInfo;
   3: import java.sql.SQLException;
   4:         ...
   5: 
   6:     public DriverPropertyInfo[] getPropertyInfo(String url, Properties info)
   7:         throws java.sql.SQLException {
   8:         ...
   9: 
  10:         DriverPropertyInfo hostProp = new DriverPropertyInfo("HOST",
  11:                 info.getProperty("HOST"));
  12:         ...
  13:         hostProp.required = true;
  14:         hostProp.description = "Hostname of MySQL Server";

View Full Code Here
   1: import java.sql.DriverManager;
   2: import java.sql.DriverPropertyInfo;
   3: import java.sql.PreparedStatement;
   4:         ...
   5: 
   6:         DriverPropertyInfo p;
   7:         
   8:         ...
   9:         p = new DriverPropertyInfo(FORCECLIENTENC,
  10:                 info.getProperty(FORCECLIENTENC));
  11:         ...
  12:         p.description = "Force a SET CLIENT ENCODING";

View Full Code Here

name

public String name
The name of the property.

required

public boolean required
The required field is true if a value must be supplied for this property during Driver.connect and false otherwise.
Usages and Demos :

View More Examples of required
   1: import java.sql.DriverManager;
   2: import java.sql.DriverPropertyInfo;
   3: import java.sql.SQLException;
   4:         ...
   5:   
   6:   private static final DriverPropertyInfo USER_PI = new DriverPropertyInfo("user", "");
   7:   private static final DriverPropertyInfo PASS_PI = new DriverPropertyInfo("password", "");
   8:         ...
   9:   static {
  10:     USER_PI.required = true;
  11:     USER_PI.description = "user account name";
  12:         ...
  13:     PASS_PI.required = true;

View Full Code Here
   1: import java.sql.Connection;
   2: import java.sql.DriverPropertyInfo;
   3: import java.sql.PreparedStatement;
   4:         ...
   5:     protected void fillPropertyInfo(ArrayList pi, Properties info) {
   6:         DriverPropertyInfo p;
   7: 
   8:         ...
   9:         p = new DriverPropertyInfo(HOST, info.getProperty(HOST));
  10:         p.description = "The host to connect to";
  11:         ...
  12:         p.required = false;

View Full Code Here
   1: 
   2: import java.sql.DriverPropertyInfo;
   3: import java.sql.SQLException;
   4:         ...
   5: 
   6:     public DriverPropertyInfo[] getPropertyInfo(String url, Properties info)
   7:         throws java.sql.SQLException {
   8:         ...
   9: 
  10:         DriverPropertyInfo hostProp = new DriverPropertyInfo("HOST",
  11:                 info.getProperty("HOST"));
  12:         ...
  13:         hostProp.required = true;

View Full Code Here
   1: import java.sql.DriverManager;
   2: import java.sql.DriverPropertyInfo;
   3: import java.sql.PreparedStatement;
   4:         ...
   5: 
   6:         DriverPropertyInfo p;
   7:         
   8:         ...
   9:         p = new DriverPropertyInfo(FORCECLIENTENC,
  10:                 info.getProperty(FORCECLIENTENC));
  11:         ...
  12:         p.description = "Force a SET CLIENT ENCODING";
  13:         p.required = false;

View Full Code Here

value

public String value
The value field specifies the current value of the property, based on a combination of the information supplied to the method getPropertyInfo, the Java environment, and the driver-supplied default values. This field may be null if no value is known.
Usages and Demos :

View More Examples of value
   1: import java.sql.DriverManager;
   2: import java.sql.DriverPropertyInfo;
   3: import java.sql.SQLException;
   4:         ...
   5: 
   6:     public DriverPropertyInfo[] getPropertyInfo(String url, Properties info)
   7:             throws SQLException {
   8:         ...
   9: 
  10:         DriverPropertyInfo[] dpi = new DriverPropertyInfo[18];
  11:         ConnectionPool cp = null;
  12:         ...
  13:         if (value != null) {
  14:             dpi.value = value;

View Full Code Here

Constructor Details

DriverPropertyInfo

public DriverPropertyInfo(String name,
                          String value)
Constructs a DriverPropertyInfo object with a name and value; other members default to their initial values.
Parameters:
name - the name of the property
value - the current value, which may be null
Usages and Demos :

View More Examples of DriverPropertyInfo(String name,String value)
   1:   
   2:   private static final DriverPropertyInfo USER_PI = new DriverPropertyInfo("user", "");
   3:         ...
   4:   private static final DriverPropertyInfo PASS_PI = new DriverPropertyInfo("password", "");
   5:   private static final DriverPropertyInfo[] PROPS = { USER_PI, PASS_PI };
   6:         ...
   7:   private static final DriverPropertyInfo createCopy(DriverPropertyInfo info) {
   8:     DriverPropertyInfo dpi = new DriverPropertyInfo(info.name, info.value);
   9:     dpi.required = info.required;

View Full Code Here
   1:             prop = new DriverPropertyInfo[1];
   2:             prop[0] = new DriverPropertyInfo("Directory", null);
   3:             prop[0].description = "Initial text file directory";
   4:             prop[0].required = false;

View Full Code Here
   1: 
   2:         p = new DriverPropertyInfo(HOST, info.getProperty(HOST));
   3:         p.description = "The host to connect to";
   4:         ...
   5: 
   6:         p = new DriverPropertyInfo(CATALOG, info.getProperty(CATALOG));
   7:         p.description = "The database to connect to";
   8:         ...
   9: 
  10:         p = new DriverPropertyInfo(PORT, info.getProperty(PORT));
  11:         p.description = "The port to connect to";

View Full Code Here
   1: 
   2:         p = new DriverPropertyInfo(USEDBENC, info.getProperty(USEDBENC));
   3:         p.description = "Use server encoding";
   4:         ...
   5: 
   6:         p = new DriverPropertyInfo(OPTIONS, info.getProperty(OPTIONS));
   7:         p.description = "Additional options passed to the backend";
   8:         ...
   9: 
  10:         p = new DriverPropertyInfo(TTY, info.getProperty(TTY));
  11:         p.description = "The tty for the backend to write additional " +

View Full Code Here