com.altair.hwm.database.dbmodel
Class HWMEmbeddedDBInfo

java.lang.Object
  extended by com.altair.hwm.database.dbmodel.HWMDatabaseInfo
      extended by com.altair.hwm.database.dbmodel.HWMEmbeddedDBInfo

public class HWMEmbeddedDBInfo
extends HWMDatabaseInfo

Title: HWMEmbeddedDBInfo

Description: The database info for the Altair's embeddd DB server

Company: Altair Engineering, Inc.


Field Summary
 
Fields inherited from class com.altair.hwm.database.dbmodel.HWMDatabaseInfo
AUTO_ID_TYPE, DBTYPE_ALTAIRQED, DBTYPE_MYSQL, DBTYPE_QED, TYPE_BLOB, TYPE_BOOL, TYPE_CHAR, TYPE_CLOB, TYPE_DATE, TYPE_DOUBLE, TYPE_FLOAT, TYPE_INT, TYPE_LONG, TYPE_SHORT, TYPE_STRING
 
Constructor Summary
HWMEmbeddedDBInfo(HWMDatabaseInfo hwmDBInfo)
          Constructor
 
Method Summary
 java.sql.Connection ConnectToDB(java.lang.String strURL, int nPort, java.lang.String strDBName, java.lang.String strUser, java.lang.String strPwd, boolean bCreate)
          Returns a connection to the given database.
 java.lang.String GetAutoInc()
          Returns the SQL syntax for auto increment
 java.lang.String GetDriverID()
          Returns the driver ID for the database.
 java.util.Hashtable GetTypeMapping()
          Returns the hashtable that maps the datamodel's generic types to data types supported by the database
 int InsertData(java.sql.Connection cxn, java.sql.PreparedStatement prepStmt, java.lang.String strClassName)
          Insert data and retrieve the auto generated ID
 int RetrieveAutoInc(java.sql.Connection cxn)
          Returns the auto inc ID
 int RetrieveAutoInc(java.sql.Connection cxn, java.lang.String strTable)
          Returns the auto inc ID
 
Methods inherited from class com.altair.hwm.database.dbmodel.HWMDatabaseInfo
GetDriver, GetTypes, RetrieveAutoInc, RetrieveAutoInc
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HWMEmbeddedDBInfo

public HWMEmbeddedDBInfo(HWMDatabaseInfo hwmDBInfo)
Constructor

Method Detail

InsertData

public int InsertData(java.sql.Connection cxn,
                      java.sql.PreparedStatement prepStmt,
                      java.lang.String strClassName)
               throws java.lang.Exception
Insert data and retrieve the auto generated ID

Overrides:
InsertData in class HWMDatabaseInfo
Parameters:
cxn - Connection to the database.
prepStmt - The statement to execute
strClassName - The class name into which data is being inserted
Returns:
int The value for the auto incremented ID
Throws:
java.lang.Exception

RetrieveAutoInc

public int RetrieveAutoInc(java.sql.Connection cxn)
                    throws java.lang.Exception
Returns the auto inc ID

Parameters:
cxn - The connection to the database
Returns:
int The value for the auto incremented ID
Throws:
java.lang.Exception

RetrieveAutoInc

public int RetrieveAutoInc(java.sql.Connection cxn,
                           java.lang.String strTable)
                    throws java.lang.Exception
Returns the auto inc ID

Parameters:
cxn - The connection to the database
strTable - The table name to use
Returns:
int The value for the auto incremented ID
Throws:
java.lang.Exception

ConnectToDB

public java.sql.Connection ConnectToDB(java.lang.String strURL,
                                       int nPort,
                                       java.lang.String strDBName,
                                       java.lang.String strUser,
                                       java.lang.String strPwd,
                                       boolean bCreate)
                                throws java.lang.Exception
Returns a connection to the given database. If the flag bCreate is true, then the DB is created.

Overrides:
ConnectToDB in class HWMDatabaseInfo
Parameters:
strURL - The URL to connect/create the DB
nPort - The port to connect to. ignored if set to -1.
strDBName - The database name to connect to
strUser - The user name
strPwd - The password for the user
bCreate - If true, the DB get the init packet for DB creation else DB connection.
Returns:
Connection Returns a connection to the database throws Exception
Throws:
java.lang.Exception

GetTypeMapping

public java.util.Hashtable GetTypeMapping()
Returns the hashtable that maps the datamodel's generic types to data types supported by the database

Overrides:
GetTypeMapping in class HWMDatabaseInfo
Returns:
Hashtable The data types supported by database

GetAutoInc

public java.lang.String GetAutoInc()
Returns the SQL syntax for auto increment

Overrides:
GetAutoInc in class HWMDatabaseInfo
Returns:
String SQL syntax for auto increment

GetDriverID

public java.lang.String GetDriverID()
Returns the driver ID for the database. The name is not the class name. It is the name used in the address passed for connection. Example: For mysql, the address string is jdbc:mysql://url. Hence, mysql is used to identify that it is a MySQL database.

Overrides:
GetDriverID in class HWMDatabaseInfo