public class SQLServerConnector extends DatabaseConnector
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DATABASE_DESCRIPTION
The name of the represented database management system.
|
static java.lang.String |
DATABASE_NAME
The name of the represented database management system.
|
static java.lang.String |
DRIVER_DISPLAY_NAME
SQL driver display name (client/server mode).
|
static java.lang.String |
DRIVER_NAME
SQL driver class name (client/server mode).
|
static java.net.URL |
ICON_SQLSERVER
Default icon for the connector.
|
cacheSchemaByTable, CONNECT_AUTH_REQUIRED, CONNECT_FAILED, CONNECT_SUCCESS, databaseDescription, databaseName, dbManager, defaultConn, defaultConnURL, driverDisplayName, driverName, driverProductName, driverProductVersion, params, pool, schemaMappings, typeConfig
Constructor and Description |
---|
SQLServerConnector()
Constructor method for i18n purposes only.
|
SQLServerConnector(java.util.Properties params,
DatabaseManager manager)
Constructor to create a connector instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkSequenceExists(java.lang.String schema,
java.lang.String table)
Checks whether a sequence for the given target table does exist.
|
int |
connect(java.lang.String jdbcurl)
Connects to the configured database.
|
static java.util.Properties |
createParams(java.lang.String host,
int port,
java.lang.String dbname,
java.lang.String username,
java.lang.String password)
Convenience method to preconfigure a connection.
|
boolean |
createSequence(java.lang.String schema,
java.lang.String table,
int initval)
Creates a new sequence for the given target table.
|
javax.swing.tree.TreeNode[] |
createSubTree(java.lang.String[] jdbcurls)
Creates a connector specific sub-tree from a set of JDBC URLs handled by the connector.
|
static DatabaseConnectorDef |
getConnectorDef(boolean supported,
boolean createconnections)
Provides the connector definition to be listed without installing any connectors.
|
java.lang.String |
getDefaultConnectionURL()
Provides the JDBC URL for the default conenction (normally a user connection).
|
java.lang.String |
getDisplayURL(java.lang.String jdbcurl)
Makes sure that the given JDBC URL does not contain any passwords.
|
javax.swing.ImageIcon |
getIcon()
Provides the connector specific icon to represent it by GUI components.
|
java.sql.Connection |
getNewConnectionNoCheck(java.lang.String jdbcurl)
Creates a fresh connection for the given JDBC URL (never taken from the pool).
|
int |
getSequenceCurrentValue(java.lang.String schema,
java.lang.String table)
Reads the current (last generated) value from a sequence.
|
int |
getSequenceNextValue(java.lang.String schema,
java.lang.String table)
Reads the next value from a sequence.
|
java.lang.String |
getUserConnectionURL()
Creates a JDBC connection URL to access the database with user permissions.
|
java.lang.String |
getUserName()
Provides the name of the default user.
|
java.lang.String |
getUserPassword()
Provides the password for the default user.
|
static boolean |
isAvailableStatic()
Is the JDBC driver available on the classpath?
|
boolean |
isConnected()
Provides the info if this connector is currently connected to the database.
|
boolean |
resetSequence(java.lang.String schema,
java.lang.String table,
int nextval)
Resets an existing sequence for the given target table.
|
addSchemaMapping, checkAndCreateSchemas, disconnect, finalize, getBytes, getBytes, getBytes, getBytes, getConnectionPool, getDatabaseDescription, getDatabaseManager, getDatabaseName, getDatabaseProductName, getDatabaseProductVersion, getDefaultConnection, getDefaultSchema, getDriver, getDriverDisplayName, getDriverName, getNewConnection, getParamDatabaseHost, getParamDatabaseName, getParamDatabasePort, getParams, getPooledConnection, getSchema, getSchemaMappings, getSchemaSeparator, getSerializedField, getTableFQN, getTypeTable, getUsedSchema, isAvailable, isBinary, isEmbedded, mapToJavaType, releasePooledConnection, replaceParams, replaceTableFQN, setParams, updateBytes, updateBytes, updateBytes, updateBytes, updateSchemaTables, updateSerializedField
public static final java.lang.String DATABASE_NAME
public static final java.lang.String DATABASE_DESCRIPTION
public static final java.lang.String DRIVER_NAME
public static final java.lang.String DRIVER_DISPLAY_NAME
public static final java.net.URL ICON_SQLSERVER
public SQLServerConnector() throws java.lang.InstantiationException
I18NExtractor
).
java.lang.InstantiationException
- Error indicationpublic SQLServerConnector(java.util.Properties params, DatabaseManager manager)
params
- The database configurationmanager
- The database managerpublic java.lang.String getDisplayURL(java.lang.String jdbcurl)
getDisplayURL
in class DatabaseConnector
jdbcurl
- The original URL including passwordsjava.lang.NullPointerException
- If parameters are invalidpublic javax.swing.tree.TreeNode[] createSubTree(java.lang.String[] jdbcurls)
createSubTree
in class DatabaseConnector
jdbcurls
- The JDBC URLs to be processedjava.lang.NullPointerException
- If parameters are invalidpublic java.lang.String getUserConnectionURL()
public java.sql.Connection getNewConnectionNoCheck(java.lang.String jdbcurl) throws java.sql.SQLException
jdbcurl
- The desired connector class in FQNnull
if an error occursjava.sql.SQLException
- If something goes wrongpublic int connect(java.lang.String jdbcurl)
connect
in class DatabaseConnector
jdbcurl
- The URL for the default connectionpublic boolean isConnected()
false
then none of the connection types should be used any more. Some
drivers like PostgreSQL do not support the isValid()
method yet.
isConnected
in class DatabaseConnector
public java.lang.String getDefaultConnectionURL()
getDefaultConnectionURL
in class DatabaseConnector
null
if an error occurspublic java.lang.String getUserName()
getUserName
in class DatabaseConnector
null
public java.lang.String getUserPassword()
getUserPassword
in class DatabaseConnector
null
public boolean checkSequenceExists(java.lang.String schema, java.lang.String table)
checkSequenceExists
in class DatabaseConnector
schema
- The target schema (optional)table
- The name of the target tablepublic boolean createSequence(java.lang.String schema, java.lang.String table, int initval)
createSequence
in class DatabaseConnector
schema
- The target schema (optional)table
- The name of the target tableinitval
- The initial value from sequencepublic int getSequenceCurrentValue(java.lang.String schema, java.lang.String table)
getSequenceCurrentValue
in class DatabaseConnector
schema
- The target schema (optional)table
- The name of the target tablepublic int getSequenceNextValue(java.lang.String schema, java.lang.String table)
Statement.getGeneratedKey()
work :-( Sequence tables should
have two attributes, the auto-increment (identity) column (use an arbitrary name here)
and a second column DUMMY char(1) not null for the INSERTs.
getSequenceNextValue
in class DatabaseConnector
schema
- The target schema (optional)table
- The name of the target tablepublic boolean resetSequence(java.lang.String schema, java.lang.String table, int nextval)
resetSequence
in class DatabaseConnector
schema
- The target schema (optional)table
- The name of the target tablenextval
- The next value from sequencepublic javax.swing.ImageIcon getIcon()
GUIUtils.getIconVariant()
method.
getIcon
in class DatabaseConnector
public static DatabaseConnectorDef getConnectorDef(boolean supported, boolean createconnections)
supported
- May the connector be used?createconnections
- May new connections be created?public static boolean isAvailableStatic()
public static java.util.Properties createParams(java.lang.String host, int port, java.lang.String dbname, java.lang.String username, java.lang.String password)
host
- The hostport
- The portdbname
- The database nameusername
- The userpassword
- The passwordCopyright © 2005-2013 Leisenfels UG (haftungsbeschränkt). All rights reserved.