Class Database.Connection
- java.lang.Object
-
- com.jgcomptech.tools.databasetools.jdbc.Database.Connection
-
- Enclosing class:
- Database
public final class Database.Connection extends java.lang.ObjectThe object that stores tasks related to the connection, useDatabase.getConnection()to access methods.
-
-
Constructor Summary
Constructors Constructor Description Connection()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconnect()Connects to the database and shows a retry dialog message box if the connection fails.voidconnect(boolean showStatusAlert, boolean showRetryDialog)Connects to the database and if parameter is true, shows a message box if the connection succeeds.voiddisconnect()Releases this database and JDBC resources immediately instead of waiting for this to happen when it is automatically closed, It is generally good practice to release resources as soon as you are finished with them to avoid tying up database resources, shows message box on error.booleanequals(java.lang.Object o)java.sql.ConnectiongetObject()Returns the rawjava.sql.Connectionobject.inthashCode()booleanisConnected()Checks if a connection is open to the database.java.lang.StringtoString()
-
-
-
Method Detail
-
getObject
public java.sql.Connection getObject()
Returns the rawjava.sql.Connectionobject.- Returns:
- the Connection object
-
connect
public void connect() throws java.sql.SQLExceptionConnects to the database and shows a retry dialog message box if the connection fails.- Throws:
java.sql.SQLException- if error occurs
-
connect
public void connect(boolean showStatusAlert, boolean showRetryDialog) throws java.sql.SQLExceptionConnects to the database and if parameter is true, shows a message box if the connection succeeds.- Parameters:
showStatusAlert- Specifies if message box should be shown if connection succeedsshowRetryDialog- Specifies if a retry dialog should be shown if the database is in use- Throws:
java.sql.SQLException- if error occurs
-
disconnect
public void disconnect() throws java.sql.SQLExceptionReleases this database and JDBC resources immediately instead of waiting for this to happen when it is automatically closed, It is generally good practice to release resources as soon as you are finished with them to avoid tying up database resources, shows message box on error.- Throws:
java.sql.SQLException- if error occurs
-
isConnected
public boolean isConnected() throws java.sql.SQLExceptionChecks if a connection is open to the database.- Returns:
- true if connected
- Throws:
java.sql.SQLException- if error occurs
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-