## org.eclipse.datatools.sqltools.sqleditor
Class SQLEditorConnectionInfo

    java.lang.Object
      org.eclipse.datatools.sqltools.sqleditor.SQLEditorConnectionInfo

All Implemented Interfaces:
  ISQLEditorConnectionInfo

public class SQLEditorConnectionInfo
extends java.lang.Object
implements ISQLEditorConnectionInfo

This class provides the default implementation for `ISQLEditorConnectionInfo`.

Author:
  Hui Cao

Field Summary
`static SQLEditorConnectionInfo` `DEFAULT_SQLEDITOR_CONNECTION_INFO`

Constructor Summary
`SQLEditorConnectionInfo(DatabaseVendorDefinitionId dbVendorId)` Constructs a `SQLEditorConnectionInfo` by `DatabaseVendorDefinitionId`.
`SQLEditorConnectionInfo(DatabaseVendorDefinitionId dbVendorId, java.lang.String profileName, java.lang.String dbName)` Constructs a `SQLEditorConnectionInfo`.
`SQLEditorConnectionInfo(DatabaseVendorDefinitionId dbVendorId, java.lang.String profileName, java.lang.String dbName, java.lang.String schemaName)` Constructs a `SQLEditorConnectionInfo`.

Method Summary
`static SQLEditorConnectionInfo` `decode(java.lang.String code)` Decodes a `SQLEditorConnectionInfo` from an encoded String
`java.lang.String` `encode()` Encodes the given `SQLEditorConnectionInfo` object for persistency.
`IConnectionProfile` `getConnectionProfile()` Gets the `IConnectionProfile` object associated with this input.
`java.lang.String` `getConnectionProfileName()` Gets the `IConnectionProfile` name associated with this input.
`Database` `getDatabase()` Gets the `Database` object associated with this input.
`java.lang.String` `getDatabaseName()` Gets the database name associated with this input.
`DatabaseVendorDefinition` `getDatabaseVendorDefinition()` Gets the `DatabaseVendorDefinition` object associated with this input.
`DatabaseVendorDefinitionId` `getDatabaseVendorDefinitionId()` Gets the `DatabaseVendorDefinitionId` object associated with this input.
`java.lang.String` `getDefaultSchemaName()` Gets the default schema name to use with the connection or database associated with this input.
`java.lang.String` `getName()` Gets a representing this object.
`java.sql.Connection` `getSharedConnection()` Retrieves the sharable connection from IControlConnection, which in turn delegates to the connectivity layer.
`void` `setConnectionProfileName(java.lang.String profileName)` Sets the `IConnectionProfile` name associated with this input to the given object.
`void` `setDatabase(Database database)` Sets the `Database` object associated with this input to the given object.
`void` `setDatabaseVendorDefinitionId(DatabaseVendorDefinitionId dbVendorDefId)` Sets the `DatabaseVendorDefinitionId` associated with this input to the given object.
`void` `setDefaultSchemaName(java.lang.String schemaName)` Sets the default schema name to use with the connection or database associated with this input.

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

Field Detail

### DEFAULT_SQLEDITOR_CONNECTION_INFO

    public static SQLEditorConnectionInfo DEFAULT_SQLEDITOR_CONNECTION_INFO

Constructor Detail

### SQLEditorConnectionInfo

    public SQLEditorConnectionInfo(DatabaseVendorDefinitionId dbVendorId)

  Constructs a `SQLEditorConnectionInfo` by `DatabaseVendorDefinitionId`. This is used when connction profile information is not available.

Parameters:
  `dbVendorId` - `DatabaseVendorDefinitionId`
See Also:
  `DefaultDBFactory.getDefaultInstance().getDatabaseVendorDefinitionId()`

### SQLEditorConnectionInfo

    public SQLEditorConnectionInfo(DatabaseVendorDefinitionId dbVendorId,
                                   java.lang.String profileName,
                                   java.lang.String dbName)

  Constructs a `SQLEditorConnectionInfo`.

Parameters:
  `dbVendorId` - `DatabaseVendorDefinitionId`, can be null if clients want it to be created from `profileName`
  `profileName` - connection profile name
  `dbName` - database name

### SQLEditorConnectionInfo

    public SQLEditorConnectionInfo(DatabaseVendorDefinitionId dbVendorId,
                                   java.lang.String profileName,
                                   java.lang.String dbName,
                                   java.lang.String schemaName)

  Constructs a `SQLEditorConnectionInfo`.

Parameters:
  `dbVendorId` - `DatabaseVendorDefinitionId`, can be null if clients want it to be created from `profileName`
  `profileName` - connection profile name
  `dbName` - database name
  `schemaName` - default schema name

Method Detail

### getDatabaseVendorDefinitionId

    public DatabaseVendorDefinitionId getDatabaseVendorDefinitionId()

  Description copied from interface: `ISQLEditorConnectionInfo`
  Gets the `DatabaseVendorDefinitionId` object associated with this input. The `DatabaseVendorDefinitionId` object identifies a `DatabaseVendorDefinition` object

  Specified by:
    `getDatabaseVendorDefinitionId` in interface `ISQLEditorConnectionInfo`
  Returns:
    the `DatabaseVendorDefinitionId` object associated with this input, can never be null. A default `DatabaseVendorDefinitionId` object will be return if not specified.

### getDatabaseVendorDefinition

    public DatabaseVendorDefinition getDatabaseVendorDefinition()

  Description copied from interface: `ISQLEditorConnectionInfo`
  Gets the `DatabaseVendorDefinition` object associated with this input. The `DatabaseVendorDefinition` object contains the information needed to do parsing, syntax highlighting, and syntax validation.

  Specified by:
    `getDatabaseVendorDefinition` in interface `ISQLEditorConnectionInfo`
  Returns:
    the `DatabaseVendorDefinition` object associated with this input, can never be null. A default `DatabaseVendorDefinition` object will be return if not specified.

### getConnectionProfile

    public IConnectionProfile getConnectionProfile()

  Description copied from interface: `ISQLEditorConnectionInfo`
  Gets the `IConnectionProfile` object associated with this input. The `IConnectionProfile` object contains the information needed to connect to a database.

  Specified by:
    `getConnectionProfile` in interface `ISQLEditorConnectionInfo`
  Returns:
    the `IConnectionProfile` object associated with this input or `null` if none or profile name is invalid

### getConnectionProfileName

    public java.lang.String getConnectionProfileName()

  Description copied from interface: `ISQLEditorConnectionInfo`
  Gets the `IConnectionProfile` name associated with this input. The `IConnectionProfile` object contains the information needed to connect to a database.

  Specified by:
    `getConnectionProfileName` in interface `ISQLEditorConnectionInfo`
  Returns:
    the `IConnectionProfile` name associated with this input or `null` if none

### getDatabase

    public Database getDatabase()

  Description copied from interface: `ISQLEditorConnectionInfo`
  Gets the `Database` object associated with this input. The `Database` object provides access to database metadata (catalog) information.

  Specified by:
    `getDatabase` in interface `ISQLEditorConnectionInfo`
  Returns:
    the `Database` object associated with this input, or `null` if none

### getDatabaseName

    public java.lang.String getDatabaseName()

  Description copied from interface: `ISQLEditorConnectionInfo`
  Gets the database name associated with this input.

  Specified by:
    `getDatabaseName` in interface `ISQLEditorConnectionInfo`
  Returns:
    the database name associated with this input, or `null` if none
  See Also:
    `ISQLEditorConnectionInfo.getDatabase()`

### getDefaultSchemaName

    public java.lang.String getDefaultSchemaName()

  Description copied from interface: `ISQLEditorConnectionInfo`
  Gets the default schema name to use with the connection or database associated with this input.

  Specified by:
    `getDefaultSchemaName` in interface `ISQLEditorConnectionInfo`
  Returns:
    the default schema name to use with this input, or null if none

### setConnectionProfileName

    public void setConnectionProfileName(java.lang.String profileName)

  Description copied from interface: `ISQLEditorConnectionInfo`
  Sets the `IConnectionProfile` name associated with this input to the given object.

  Specified by:
    `setConnectionProfileName` in interface `ISQLEditorConnectionInfo`
  Parameters:
    `profileName` - the `IConnectionProfile` name to set

### setDatabase

    public void setDatabase(Database database)

  Description copied from interface: `ISQLEditorConnectionInfo`
  Sets the `Database` object associated with this input to the given object.

  Specified by:
    `setDatabase` in interface `ISQLEditorConnectionInfo`
  Parameters:
    `database` - the `Database` object to set

### setDefaultSchemaName

    public void setDefaultSchemaName(java.lang.String schemaName)

  Description copied from interface: `ISQLEditorConnectionInfo`
  Sets the default schema name to use with the connection or database associated with this input.

  Specified by:
    `setDefaultSchemaName` in interface `ISQLEditorConnectionInfo`

### setDatabaseVendorDefinitionId

    public void setDatabaseVendorDefinitionId(DatabaseVendorDefinitionId dbVendorDefId)

  Description copied from interface: `ISQLEditorConnectionInfo`
  Sets the `DatabaseVendorDefinitionId` associated with this input to the given object.

  Specified by:
    `setDatabaseVendorDefinitionId` in interface `ISQLEditorConnectionInfo`
  Parameters:
    `dbVendorDefId` - the `DatabaseVendorDefinitionId` object to set

### encode

    public java.lang.String encode()

  Encodes the given `SQLEditorConnectionInfo` object for persistency.

  Specified by:
    `encode` in interface `ISQLEditorConnectionInfo`
  Returns:
    A encoded String
  See Also:
    `decode()`

### decode

    public static SQLEditorConnectionInfo decode(java.lang.String code)

  Decodes a `SQLEditorConnectionInfo` from an encoded String

  Parameters:
    `code` -
  Returns:
    `SQLEditorConnectionInfo` object
  See Also:
    `encode()`

### getName

    public java.lang.String getName()

  Description copied from interface: `ISQLEditorConnectionInfo`
  Gets a representing this object. Contains connection profile name and database name if any.

  Specified by:
    `getName` in interface `ISQLEditorConnectionInfo`
  Returns:
    connection name

### getSharedConnection

    public java.sql.Connection getSharedConnection()

  Retrieves the sharable connection from IControlConnection, which in turn delegates to the connectivity layer.

  Specified by:
    `getSharedConnection` in interface `ISQLEditorConnectionInfo`
  Returns:
    if no shared connection set, return null.

Copyright © 2006 Actuate, IBM Corporation, Sybase, Inc. and others. All rights reserved.