## org.eclipse.datatools.sqltools.sqleditor.internal.utils
Class SQLDBUtils

    java.lang.Object
      org.eclipse.datatools.sqltools.sqleditor.internal.utils.SQLDBUtils

    public class SQLDBUtils

extends java.lang.Object

Provides database services for the editor. This includes services for selecting and re-establishing a database connection.

Author:
  Hetty Dougherty, bgp

Constructor Summary
`SQLDBUtils()`

Method Summary
`static java.sql.ResultSet` `executeSQL(java.sql.Connection conn, java.lang.String sql)` Creates a SQL Statement and execute the statement using JDBC executeQuery method.
`static java.lang.String` `getDefaultSchemaName(ISQLEditorConnectionInfo connInfo)`
`static boolean` `isConnected(ISQLEditorConnectionInfo connInfo)` Determines if the DB connection described by the given `ISQLEditorConnectionInfo` is actively connected
`static boolean` `isDefaultUser(ISQLEditorConnectionInfo connInfo)` Determines if the given `ISQLEditorConnectionInfo` is references the default user ID.
`static boolean` `isPromptNeeded(ISQLEditorConnectionInfo connInfo)` Determines if a user ID and password prompt is needed for the given `ISQLEditorConnectionInfo` object.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SQLDBUtils

    public SQLDBUtils()

Method Detail

### executeSQL

    public static java.sql.ResultSet executeSQL(java.sql.Connection conn,
                                                java.lang.String sql)
                                         throws java.sql.SQLException

  Creates a SQL Statement and execute the statement using JDBC executeQuery method. This method uses a Statement object to execute the query. It does not close the Statement exlicitly because the ResultSet object will be closed if the Statement is closed.

  Parameters:
    `conn` - the `Connection` object to use
    `sql` - the SQL statement to execute
  Returns:
    The `ResultSet` resulting from running the query
  Throws:
    `java.sql.SQLException`

### isConnected

    public static boolean isConnected(ISQLEditorConnectionInfo connInfo)

  Determines if the DB connection described by the given `ISQLEditorConnectionInfo` is actively connected

  Parameters:
    `connInfo` - the `ISQLEditorConnectionInfo` to check
  Returns:
    true if the connection is active, otherwise false

### isDefaultUser

    public static boolean isDefaultUser(ISQLEditorConnectionInfo connInfo)

  Determines if the given `ISQLEditorConnectionInfo` is references the default user ID. This is done by checking if both the user ID and password are empty and non-null.

  Parameters:
    `connInfo` - the `ISQLEditorConnectionInfo` object to check
  Returns:
    true if the default user ID is being used, otherwise false

### isPromptNeeded

    public static boolean isPromptNeeded(ISQLEditorConnectionInfo connInfo)

  Determines if a user ID and password prompt is needed for the given `ISQLEditorConnectionInfo` object. This is done by checking if either the user ID or password is null or empty.

  Parameters:
    `connInfo` - the `ISQLEditorConnectionInfo` to check
    `true` - when userid/password prompt is needed, otherwise false

### getDefaultSchemaName

    public static java.lang.String getDefaultSchemaName(ISQLEditorConnectionInfo connInfo)