borland.jbcl Packages borland.jbcl Class Hierarchy borland.jbcl.dataset
java.lang.Object +----borland.jbcl.dataset.ConnectionDescriptor
Constructors Properties Methods
Implements 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 click the area to the right of the connection option in the Component Inspector. An ellipses button appears; 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:
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.
The 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.jbcl.dataset.ConnectionDescriptor cDesc)
public ConnectionDescriptor(java.lang.String connectionURL)
public ConnectionDescriptor(java.lang.String connectionURL, java.lang.String userName)
public ConnectionDescriptor(java.lang.String connectionURL, java.lang.String userName, java.lang.String password)
public ConnectionDescriptor(java.lang.String connectionURL, java.lang.String userName, java.lang.String password, boolean promptPassword)
public ConnectionDescriptor(java.lang.String connectionURL, java.lang.String userName, java.lang.String password, boolean promptPassword, java.lang.String driver)
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 String getUserName() public synchronized void setUserName(java.lang.String userName)Stores the user name used to connect to the database.
public final boolean equals(borland.jbcl.dataset.ConnectionDescriptor cDesc)Returns true if the ConnectionDescriptor object is equal to the specified cDesc and returns false otherwise.
public String toString()Returns a String equivalent of the property values stored in the ConnectionDescriptor. This String representation appears in the JBuilder Component Inspector as the value of the connection property. The password is not included in the resulting String.
Overrides: java.lang.Object.toString()