borland Packages Class Hierarchy sql.dataset Package Index
java.lang.Object +----borland.sql.dataset.ConnectionDescriptor
Constructors Properties Methods
Implements Serializable, Cloneable
The ConnectionDescriptor object stores properties related to connecting to a SQL database. Its main properties are:
Both the ConnectionDescriptor object and the Database component are required elements when accessing data that is stored on a SQL server.
The information stored in the ConnectionDescriptor can be accessed through the user interface by inspecting the connection property of a Database object. To work with this object programatically, you set its properties when instantiating the ConnectionDescriptor, or by its write accessors.
To set these properties through the JBuilder UI design tools, select the Database object, then double click the area to the right of the connection option in the Inspector. Or, single click it to display the ellipses button and click it to open the custom property editor dialog for this descriptor. The Connection custom property editor also offers these additional ease-of-use features:
If you get the error "No suitable driver" when clicking the Test Connection button and have verified that the specified URL is correct, check the IDEClassPath (in the jbuilder.ini file) and update that setting to include the location of the driver classes.
Whenever you successfully connect to a database URL, the URL is recorded in a history list in the jbuilder.properties file. When you click the Choose URL button, the URLs listed in the jbuilder.history.connectionURL section of the properties file are read and appear in the history list.
To delete an entry that displays in the Choose URL list, press the Delete key when the URL is highlighted. You can also update the history list manually by editing the history list in the properties file. If you do so while JBuilder is running, your changes will be lost when JBuilder closes down and overwrites the properties file. This is true regardless of the type of manual modifications you make to the properties file.
Beneath this history list is a Show ODBC Data Sources button. Select this to display all the ODBC data sources that have been registered in your computer's system registry.
If you have Borland DataGateway installed, you will see an additional Borland DataGateway section that changes the history list to display the URLs from the following sources:
The Connection dialog also includes an option for the Driver Class to use when connecting to the database. This field is optional if you have already registered the driver class with JDBC -- it will not re-register a previously registered class. If the driver class has not been registered with JDBC, specify it here to have JBuilder register the driver class with JDBC, and have JDBC load the driver in memory before attempting the connection to the database.
For examples on connecting to a database server, see Connecting to a database using JDBC in the Database Application Developer's Guide.
public ConnectionDescriptor(borland.sql.dataset.ConnectionDescriptor cDesc)Constructs a ConnectionDescriptor using the property values from the specified cDesc.
public ConnectionDescriptor(java.lang.String connectionURL)Constructs a ConnectionDescriptor with the specified URL to the database.
public ConnectionDescriptor(java.lang.String connectionURL, java.lang.String userName)Constructs a ConnectionDescriptor with the specified connection URL to the database and user name.
public ConnectionDescriptor(java.lang.String connectionURL, java.lang.String userName, java.lang.String password)Constructs a ConnectionDescriptor with the specified connection URL to the database, user name, and password.
public ConnectionDescriptor(java.lang.String connectionURL, java.lang.String userName, java.lang.String password, boolean promptPassword)Constructs a ConnectionDescriptor with the specified connection URL to the database, user name, password, and whether to prompt for the password each time or store the password in the ConnectionDescriptor.
public ConnectionDescriptor(java.lang.String connectionURL, java.lang.String userName, java.lang.String password, boolean promptPassword, java.lang.String driver)Constructs a ConnectionDescriptor with the specified connection URL to the database, user name, password, whether to prompt for the password each time or store the password in the ConnectionDescriptor, and the driver class to use when connecting to the Database.
public ConnectionDescriptor(java.lang.String connectionURL, java.lang.String userName, java.lang.String password, boolean promptPassword, java.lang.String driver, java.util.Properties properties)Constructs a ConnectionDescriptor with the specified connection URL to the database, user name, password, whether to prompt for the password each time or store the password in the ConnectionDescriptor, the driver class to use when connecting to the Database, and the instance of a java.util.Properties that stores extended driver properties to use when connecting.
Not all drivers support connecting to a database using a java.util.Properties object. Check your driver documentation for more information on whether it supports this feature or not.
public synchronized boolean isComplete()Read-only property that returns true if all the ConnectionDescriptor parameters have been set.
public synchronized String getConnectionURL() public synchronized void setConnectionURL(java.lang.String url)Stores the name of the connection Universal Resource Locator (URL) for the database. The format consists of the URL type ("jdbc" for JDBC database access), followed by driver-specific information, separated by colons. The driver-specific information is driver/server dependent. It typically includes the driver name followed by the data source name. Refer to the documentation for your driver for more information on this property.
To connect to the Local InterBase Server sample file that has been configured with a data source name of DataSet Tutorial, the URL is: jdbc:odbc:DataSet Tutorial
When you successfully connect to a database, the database URL is saved in the jbuilder.properties file. The URL history is read from the properties file when you click the Choose URL button from the Connection custom property editor.
public synchronized String getDriver() public synchronized void setDriver(java.lang.String driver)The driver class to use when connecting to the Database, for example, jdbc.odbc.jdbcodbcDriver. This property is optional if you have already registered the driver class with JDBC -- if you specify it, it will not re-register a previously registered class. If the driver class has not been registered with JDBC, specify it here to have JBuilder register the driver class with JDBC, and have JDBC load the driver in memory before attempting the connection to the Database.
public synchronized String getPassword() public synchronized void setPassword(java.lang.String password)Stores the password used to connect to the database in the source code as unencrypted text. For maximum security, do not specify the password using this property but set the promptPassword property to true.
When accessing this property through the user-interface, an asterisk (*) appears for each character that you type in this field.
public synchronized boolean isPromptPassword() public synchronized void setPromptPassword(boolean prompt)Stores whether the password is maintained in the Java code or not, and therefore, whether the user should be prompted for a password each time a connection to the database is made. The default for this method is false.
When prompted for the password, you can optionally specify an alternate user name for the connection which overrides the userName property setting at runtime.
public synchronized Properties getProperties() public synchronized void setProperties(java.util.Properties properties)Some drivers may require or optionally accept additional connection parameters when connecting to a database. Such drivers take a java.util.Properties object that contains the extended properties. Use this property to specify the Properties object.
Note: Not all drivers support connecting to a database using a java.util.Properties object. Check your driver documentation for more information on whether it supports this feature or not.
public synchronized String getUserName() public synchronized void setUserName(java.lang.String userName)Stores the user name used to connect to the database.
public static Properties arrayToProperties(java.lang.String[][] array)A service method to convert a 2D string array into a Properties object. Used by the ConnectionDescriptor editor in generating code. Can also be used by developers. This method returns a Properties object containing key/value pairs.
Parameters:
public String toString()Returns a String equivalent of the property values stored in the ConnectionDescriptor. This String representation appears in the JBuilder Inspector as the value of the connection property. The password is not included in the resulting String.
Overrides: java.lang.Object.toString()