de.mguennewig.pobjects.jdbc
Class SqlServerContainer

java.lang.Object
  extended by de.mguennewig.pobjects.AbstractContainer
      extended by de.mguennewig.pobjects.jdbc.JdbcContainer
          extended by de.mguennewig.pobjects.jdbc.SqlServerContainer
All Implemented Interfaces:
Container

public class SqlServerContainer
extends JdbcContainer

Container implementation for MS-SQL Server databases.

Author:
Michael Günnewig
See Also:
getCapabilities(), SqlServer

Field Summary
static int DEFAULT_PORT
          MS-SQL default database port.
 
Fields inherited from interface de.mguennewig.pobjects.Container
SUPPORTS_BOOLEAN, SUPPORTS_INHERITS, SUPPORTS_JOIN, SUPPORTS_LIMIT_OFFSET, SUPPORTS_ORACLE_JOIN, SUPPORTS_SQL99_JOIN, USE_ARRAY_FOR_LOB, USE_STREAM_TO_INSERT_LOB
 
Constructor Summary
SqlServerContainer(java.sql.Connection conn, PObjDictionary dict, java.lang.String schema)
          Creates a container with a specified connection to a DBMS, which must denote a MS-SQL Server compatible DBMS.
SqlServerContainer(PObjDictionary dict, java.lang.String schema)
          Creates a container without a connection to a MS-SQL Server.
SqlServerContainer(java.lang.String hostname, java.lang.Integer port, java.lang.String database, java.lang.String username, java.lang.String password, PObjDictionary dict, java.lang.String schema)
           
 
Method Summary
 int getCapabilities()
          Returns the capabilities of the DBMS.
 java.util.Properties getConnectProperties()
          
 java.lang.String getConnectURL(java.lang.String hostname, java.lang.Integer port, java.lang.String database)
          
static boolean getForceEncryption()
          Returns whether a new created container will enforce an encrypted connection to the MS-SQL database.
 java.lang.String getSequenceCurrentValue(Sequence seq)
          Returns the current value of the given sequence.
 java.lang.String getSequenceNextValue(Sequence seq)
          Returns a new value of the given sequence.
 java.lang.String insertObject(PObject obj)
          Inserts the given object into the database.
static void setForceEncryption(boolean encrypt)
          Sets whether a new created container will enforce an encrypted connection to the MS-SQL database.
 
Methods inherited from class de.mguennewig.pobjects.jdbc.JdbcContainer
addArguments, addParameter, beginTransaction, close, commitTransaction, deleteAll, deleteAll, deleteObject, deleteRecord, getConnection, getObject, insertRecord, mapClassDeclToPClassId, mapPClassIdToClassDecl, newEvalContext, newQuery, prepareStatement, prepareStatement, reset, retrieveData, rollbackTransaction, setConnection, updateObject
 
Methods inherited from class de.mguennewig.pobjects.AbstractContainer
createObject, deleteAll, getClassDecl, getClassDecls, getData, getDictionary, getObject, getQualifiedName, getSchema, getTableExpr, isStrictMode, makePersistent, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, notifyChange, setStrictMode, storeAll, supportsBoolean, supportsInherits, supportsLimitOffset, supportsOracleJoin, supportsSQL99Join, useArrayForLob, useStreamToInsertLob
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PORT

public static final int DEFAULT_PORT
MS-SQL default database port.

See Also:
Constant Field Values
Constructor Detail

SqlServerContainer

public SqlServerContainer(PObjDictionary dict,
                          java.lang.String schema)
Creates a container without a connection to a MS-SQL Server.


SqlServerContainer

public SqlServerContainer(java.lang.String hostname,
                          java.lang.Integer port,
                          java.lang.String database,
                          java.lang.String username,
                          java.lang.String password,
                          PObjDictionary dict,
                          java.lang.String schema)
                   throws java.sql.SQLException
Throws:
java.sql.SQLException

SqlServerContainer

public SqlServerContainer(java.sql.Connection conn,
                          PObjDictionary dict,
                          java.lang.String schema)
                   throws java.sql.SQLException
Creates a container with a specified connection to a DBMS, which must denote a MS-SQL Server compatible DBMS.

NOTE: Auto-commitment will be turned off which is normally turned on for JDBC.

Throws:
java.sql.SQLException
Method Detail

getForceEncryption

public static final boolean getForceEncryption()
Returns whether a new created container will enforce an encrypted connection to the MS-SQL database.


setForceEncryption

public static void setForceEncryption(boolean encrypt)
Sets whether a new created container will enforce an encrypted connection to the MS-SQL database.


getConnectURL

public java.lang.String getConnectURL(java.lang.String hostname,
                                      java.lang.Integer port,
                                      java.lang.String database)

Specified by:
getConnectURL in class JdbcContainer

getConnectProperties

public java.util.Properties getConnectProperties()

Overrides:
getConnectProperties in class JdbcContainer

getCapabilities

public int getCapabilities()
Returns the capabilities of the DBMS.

Currently returns Container.SUPPORTS_SQL99_JOIN and Container.SUPPORTS_LIMIT_OFFSET.

See Also:
"The SUPPORTS_* constants."

getSequenceCurrentValue

public java.lang.String getSequenceCurrentValue(Sequence seq)
Returns the current value of the given sequence.

Throws:
java.lang.UnsupportedOperationException - as MS-SQL does not support sequences with its own name

getSequenceNextValue

public java.lang.String getSequenceNextValue(Sequence seq)
Returns a new value of the given sequence.

Throws:
java.lang.UnsupportedOperationException - as MS-SQL does not support sequences with its own name

insertObject

public java.lang.String insertObject(PObject obj)
                              throws PObjConstraintException,
                                     PObjSQLException
Inserts the given object into the database.

Throws:
PObjConstraintException - if a database constraint will be violated.
PObjSQLException - if any other database error occurs.