|
org.netbeans.modules.db/0 1.20.0 4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.netbeans.api.db.explorer.DatabaseConnection
public final class DatabaseConnection
Encapsulates a database connection. Each DatabaseConnection instance represents a connection to a database in the Database Explorer.
This class provides access to the properties of a database connection,
such as the connection name, database URL, user or default schema. New connections
can be created using the create(org.netbeans.api.db.explorer.JDBCDriver, java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean)
method (these connections can be
added to the Database Explorer using the
ConnectionManager.addConnection(org.netbeans.api.db.explorer.DatabaseConnection)
method.
It is also possible to retrieve the JDBC Connection
using the getJDBCConnection()
method (the connection can be connected
or disconnected using the ConnectionManager.showConnectionDialog(org.netbeans.api.db.explorer.DatabaseConnection)
and ConnectionManager.disconnect(org.netbeans.api.db.explorer.DatabaseConnection)
methods.
ConnectionManager
Method Summary | |
---|---|
static DatabaseConnection |
create(JDBCDriver driver,
String databaseURL,
String user,
String schema,
String password,
boolean rememberPassword)
Creates a new DatabaseConnection instance. |
String |
getDatabaseURL()
Returns this connection's database URL. |
String |
getDisplayName()
Returns the name used to display this connection in the UI. |
String |
getDriverClass()
Returns the JDBC driver class that this connection uses. |
Connection |
getJDBCConnection()
Returns the Connection instance which encapsulates
the physical connection to the database if this database connection
is connected. |
String |
getName()
Returns the programmatic name of this connection in the Database Explorer. |
String |
getPassword()
Returns the password used to connect to the database. |
String |
getSchema()
Returns this connection's default schema. |
String |
getUser()
Returns the user name used to connect to the database. |
String |
toString()
Returns a string representation of the database connection. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static DatabaseConnection create(JDBCDriver driver, String databaseURL, String user, String schema, String password, boolean rememberPassword)
driver
- the JDBC driver the new connection uses; cannot be null.databaseURL
- the URL of the database to connect to; cannot be null.user
- the username.password
- the password.rememberPassword
- whether to remeber the password for the current session.
NullPointerException
- if driver or database are null.public String getDriverClass()
public String getDatabaseURL()
public String getSchema()
public String getUser()
public String getPassword()
public String getName()
public String getDisplayName()
public Connection getJDBCConnection()
Connection
instance which encapsulates
the physical connection to the database if this database connection
is connected. Note that "connected" here means "connected using the
Database Explorer". There is no check if Connection.close()
has been called on the returned connection. However,
clients should not call Connection.close()
on the returned
connection, therefore this method should always return a non-closed
connection or null
.
Calling Connection.close()
on the connection
returned by this method is illegal. Use
ConnectionManager.disconnect(org.netbeans.api.db.explorer.DatabaseConnection)
to close the connection.
IllegalStateException
- if this connection is not added to the
ConnectionManager.public String toString()
|
org.netbeans.modules.db/0 1.20.0 4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |