Home

Application Program Interface User`s Manual

image

Contents

1. The ALTIBASE HDB NET Data Provider provides the following classes for handling exceptions man aging stored procedures and processing transactions Table 4 3 ALTIBASE HDB NET Data Provider Classes for Processing Transactions and Handling Exceptions Class Description AltibaseException This class is thrown when ALTIBASE HDB server returns an error and can be used to handle database errors and client errors received via the NET Framework AltibaseParameter This class is used to define input and output parameters for use with SQL commands and stored procedures AltibaseTransaction This class supports the execution of transaction related com mands in the database The AltibaseType class is used when declaring the data type of table columns and parameters Table 4 4 shows the relationships between the data types provided by ALTIBASE HDB and by the NET Framework Table 4 4 The Relationships between ALTIBASE HDB and NET Data Types AltibaseType Name Data Type of ALTIBASE HDB NET Framework Data Type Bigint BIGINT Int64 Bit BIT Bytel Application Program Interface Users Manual 60 4 2 Using the ALTIBASE HDB NET Data Provider AltibaseType Name Data Type of ALTIBASE HDB NET Framework Data Type Blob BLOB Bytel Byte BYTE Bytell Char CHAR String Clob CLOB String DateTime DATE DateTime Decimal DECIMAL
2. if handle ALTIBASE ILOADER NULL HANDLE return 0 altibase_iloader_final amp handle 7 4 2 altibase iloader dataout amp opt This function is used to download data from a database table and write the data to a file 7 4 2 1 Syntax int altibase iloader dataout ALTIBASE ILOADER HANDLE handle int version void options ALTIBASE ILOADER CALLBACK logCallback ALTIBASE ILOADER ERROR error 7 4 2 2 Arguments Argument In Out Description handle Input This is the pointer to the iLoader handle 131 The iLoader API 7 4 The iLoader API Argument In Out Description version Input This is the version of the iLoader API options Input This is the pointer to the option structure logCallback Input This is the name of a log callback function It may bea user defined function error Output This is the pointer to the diagnostic error structure in which to return information for diagnosing errors For more information about this structure please refer to iLoader API Data Structures 7 4 2 3 Return Values ALTIBASE ILO SUCCESS or ALTIBASE ILO ERROR 7 4 2 4 Diagnostics When altibase iloader dataout returns ALTIBASE ILO ERROR the associated error information is returned in error 7 4 2 5 Description altibase iloader dataout is used to download data from a database table and write the data to a file The value of the versio
3. Use a specific user name and password User name EEN Password Blank password IW A 3 Enter the initial catalog to use Test Connection Microsoft Data Link N This action will save your password to a file The password will be unencrypted This action is not recommended Click Yes if you want to save your password anyway Click No if you want to return to Data Links and deselect Allow saving password Eel 5 2 3 Creating a Connection String This section explains how to create and use OLE DB connection strings for accessing an Altibase database in an ADO or ADO net environment It includes the following topics Typical Connection Strings ADO Connection Strings ADO net Connection Strings 5 2 3 1 Typical Connection Strings A typical connection string consists of these keywords Application Program Interface Users Manual 74 5 2 Installation Keyword Description Provider This specifies the OLE DB Provider of ALTIBASE HDB In order to access ALTIBASE HDB this must always be set to Altibase OLEDB Data Source This specifies the database path or the name of an ODBC DSN in which information about the database path is stored User ID This specifies the user name Password This specifies the user password Extended Properties This is used to specify multiple keywords other than the Provider User ID and Password It follows this format keyword value
4. 6 6 2 Processing In doubt Transactions The TM is responsible for providing functionality for detecting problems that give rise to in doubt and pending transactions and automatically completing in doubt transactions The RM in which the in doubt or pending transaction is taking place maintains a lock on all resources associated with the prepared transaction until the transaction has been completed and it receives an instruction to com mit the transaction However if another transaction requires the data locked by an in doubt transaction or if a transac tion remains in an in doubt or pending status for an excessive amount of time it will be necessary for the DBA to manually handle the transaction Application Program Interface Users Manual 118 6 6 How to Solve Problems of Application Using XA ALTIBASE HDB provides the VSDBA 2PC PENDING performance view which displays information about the state of in doubt transactions so that they can be dealt with For more information about this and other performance views please refer to the ALTIBASE HDB General Reference To manually process such transactions the DBA can forcefully commit or rollback transaction as shown below COMMIT FORCE global tx id ROLLBACK FORCE global tx id 6 6 2 1 Example This example shows how to check the state of in doubt transactions and manually commit a transac tion as desired iSQL gt SELECT FROM v dba 2pc pending LOCAL TRAN ID G
5. xa_commit This is used to commit a transaction SOLDisconnect This is used to switch the internal state to disconnected However the physical connection established by XA remains active xa_close This is used to close the XA connection 97 XA Interface 6 3 Using XA 6 3 1 1 SQLSetConnectAttr Calling SQLSet ConnectAttr enables an XA connection to use an ODBC connection so that an application can access a distributed transaction via ODBC The following parameters are provided to enable an XA connection to be configured using SOL SetConnectAttr SOLRETURN SQLSetConnectAttr SOLHDBC hdbc SOLINTEGER fAttr SOLPOINTER vParam SOLINTEGER sLen fAttr ALTIBASE XA RMID Setting the fAttr parameter to ALTIBASE XA RMID enables the connection specified using the hdbe parameter to use a specified XA connection Detailed information about the XA con nection is set by specifying a pointer for the vParam parameter which is described below vParam This must be set to the rmid value that was specified when a connection was established using xa open To establish an XA connection with a server without specifying a value for rmid use one of the following settings for the fAttr parameter fAttr SQL_ATTR_ENLIST_IN_DTC or SQL_ATTR_ENLIST_IN_XA Setting the fAttr parameter to SQL_ATTR_ENLIST_IN_DTC or SQL_ATTR_ENLIST_IN_XA associates the current database connection with the first XA connection 6 3 2
6. 8 4 The CheckServer API This section describes each of the functions in the CheckServer API The following information is provided for each function The name and purpose of the function The function syntax A list of arguments for the function The function s return values Diagnostics for the function Notes related to use of the function A list of related functions An example of use of the function in code 8 4 1 altibase check server This function checks whether the ALTIBASE HDB process is running 8 4 1 1 Syntax int altibase check server ALTIBASE CHECK SERVER HANDLE handle 8 4 1 2 Arguments Argument In Out Description handle Input The CheckServer handle 8 4 1 3 Return Values ALTIBASE CS SERVER STOPPED ALTIBASE CS ERROR or ALTIBASE CS INVALID HANDLE If the ALTIBASE HDB server terminates abnormally this function returns ALTIBASE CS SERVER STOPPED 8 4 1 4 Description When CheckServer is started or this function is called a file named checkserver pid file is cre atedinthe SALTIBASE HOME trc directory The presence of the checkserver pid file pre 147 The CheckServer API 8 4 The CheckServer API vents another instance of the CheckServer API application from being started while the current instance is running Calling altibase check server final removes this file If this function is called while the ALTIBASE HDB server is running the application that call
7. ALTIBA CLI Because the NET Data Provider uses CLI libraries to connect to databases the CLI library of ALTIBASE HDB must be installed 4 1 3 Considerations The dependency of the NET Data Provider on CLI libraries means that it is essential that the version of the odbccli_sl dll library is correct for the ALTIBASE HDB server with which it is asso ciated A different NET Data Provider is built for each version of the NET Framework so be sure to use the version of the NET Data Provider that is intended for use with the version of the NET Framework that you are using When using the ColumnName property with classes such as DataReader and Command Builder remember that it is case sensitive When creating a table any column names that are Application Program Interface Users Manual 52 4 1 An Overview of the NET Data Provider not placed inside double quotation marks will be changed to all upper case letters Columns created in this way can still be used normally as long as they are referenced by their actual names that is in upper case letters Data loss may occur when using the DataReader GetValue function to retrieve data from NUMBER NUMERIC FLOAT and DECIMAL type columns The reason for this is that this function converts numeric data to the NET System Decimal type whose capacity is less than those of the above data types 53 NET Data Provider 4 2 Using the ALTIBASE HDB NET Data Provider 4 2 Using
8. Application Program Interface Users Manual 26 1 7 JDBC 2 1 Core API and JDBC 2 0 Optional Package API Return Function Name Support void updateClob int columnindex Clob x A void updateClob String columnName Clob x A void updateDate int columnindex Date x X void updateDate String columnName Date x X void updateDouble int columnindex double x X void updateDouble String columnName double x X void updateFloat int columnindex float x X void updateFloat String columnName float x X void updatelnt int columnindex int x X void updatelnt String columnName int x X void updateLong int columnindex long x X void updatel ong String columnName long x X void updateNull int columnindex X void updateNull String columnName X void updateObject int columnindex Object x X void updateObject int columnindex Object x int scale X void updateObject String columnName Object x X void updateObject String columnName Object x int scale X void updateRef int columnindex Ref x X void updateRef String columnName Ref x X void updateRow X void updateShort int columnindex short x X void updateShort String columnName short x X void updateString int columnindex String x X void updateString String columnName String x X void updateTime int columnindex Time x X void updateTime String columnName Time x X void updateTimestamp int
9. Create an XAResource object by calling the getXAResource method in the XAConnection class XAResource xaResource xaConnection getXaResource 4 Create a Connection Object 99 XA Interface 6 3 Using XA Create a connection object to use for executing SQL statements by calling the get Connec tion method in the XAConnection dlass Connection connl xaConnection getConnection 5 Use the XAResource Object to Execute XA Functions XA functions such as xa start and xa_end can be executed using the methods in the XAResource class xaResource start xid XAResource TMNOFLAGS 6 Execute SQL Statements using the Connection Object Statement stmt conn createStatement int ent st mt executeUpdate insert into t1 values 4321 This section describes how to control transactions in an ALTIBASE HDB XA environment When using the XA library the SQL COMMIT and ROLLBACK statements are not used to commit and roll back transactions Instead the users must use the TX interface that is provided by the TM in application programs as shown below The TM typically controls a transaction using the XA interface Table 6 3 The TX Interface niere Description Entry Point tx open This logs on to an RM tx close This logs off from an RM tx begin This starts execution of a new transaction tt commit This commits a transaction tx_rollback This rolls back a transaction The process o
10. O tions boolean supportsDataManipulationTransactionsOnly O boolean supportsDifferentTableCorrelationNames O boolean SupportsExpressionslnOrderBy O boolean supportsExtendedSQLGrammar O boolean supportsFullOuterJoins O boolean supportsGetGeneratedKeys O boolean supportsGroupBy O boolean supportsGroupByBeyondSelect O boolean supportsGroupByUnrelated O boolean supportsintegrityEnhancementFacility O boolean supportsLikeEscapeClause O boolean supportsLimitedOuterJoins O boolean supportsMinimumSQLGrammar O boolean supportsMixedCaseldentifiers O boolean supportsMixedCaseQuotedldentifiers O 21 JDBC 1 7 JDBC 2 1 Core API and JDBC 2 0 Optional Package API Return Type Function Name Support boolean supportsMultipleOpenResults O boolean supportsMultipleResultSets O boolean supportsMultipleTransactions O boolean supportsNamedParameters O boolean supportsNonNullableColumns O boolean supportsOpenCursorsAcrossCommit O boolean supportsOpenCursorsAcrossRollback O boolean supportsOpenStatementsAcrossCommit O boolean supportsOpenStatementsAcrossRollback O boolean supportsOrderByUnrelated O boolean supportsOuterJoins O boolean supportsPositionedDelete O boolean supportsPositionedUpdate O boolean supportsResultSetConcurrency int type int concur O rency boolean supportsResultS
11. Read Only VARIANT TRUE DBPROP OGIS WITHIN Read Only VARIANT TRUE DBPROP OGIS CONTAINS Read Only VARIANT TRUE DBPROP_OGIS_CROSSES Read Only VARIANT TRUE DBPROP_OGIS_OVERLAPS Read Only VARIANT TRUE DBPROP_OGIS_DISJOINT Read Only VARIANT TRUE DBPROP_OGIS_INTERSECTS Read Only VARIANT TRUE DBPROP_OGIS_ENVELOPE_INTERSECTS Read Only VARIANT TRUE DBPROP_OGIS_INDEX_INTERSECTS Read Only VARIANT_TRUE The following table summarizes the OLE DB properties in the DBPROPSET_ROWSET property set that are currently supported by ALTIBASE HDB Property State Initial Value DBPROP_ACCESSORDER Read Only DBPROPVAL_AO_RANDOM DBPROP_BLOCKINGSTORAGEOBJECTS Read Only VARIANT_TRUE DBPROP_CANHOLDROWS Read Only VARIANT_FALSE DBPROP_CANFETCHBACKWARDS Read Only VARIANT_FALSE DBPROP_CANSCROLLBACKWARDS Read Only VARIANT_FALSE DBPROP_CLIENTCURSOR Read Only VARIANT_TRUE DBPROP_COMMANDTIMEOUT Read Only 30 DBPROP Accessor Read Only VARIANT TRUE DBPROP_IColumnsinfo Read Only VARIANT_TRUE DBPROP_IColumnsRowset Read Only VARIANT_TRUE DBPROP_IConvertType Read Only VARIANT_TRUE DBPROP_IGetSession Read Only VARIANT_TRUE DBPROP_IMultipleResults Read Only VARIANT FALSE DBPROP_IRowset Read Only VARIANT_TRUE DBPROP_IRowsetChange Read Only VARIANT_FALSE Application Program Interface Users Manual
12. This terminates the connection to the specified RM and returns XA OK int xa close char xa info int rmid long flags xa info is a null terminated character string that contains information about the server Its maxi mum length is 256 bytes Note XA_OK is returned even if xa_close is executed on a connection that is already closed flags has no specific purpose in this function and must be set to the following value TMNOFLAGS This is used to start the execution of a transaction branch XID is the identifier of a global transaction int xa start XID xid int rmid long flags flags can be set to one or more of the following values In order to specify multiple flags delimit them with a single vertical bar TMRESUME This is used to resume execution of a previously suspended transaction branch TMNOWAIT If the execution of xa start is blocked this specifies that XA RETRY is to be returned with 93 XA Interface 6 2 The XA Interface out waiting TMASYNC This specifies that the transaction branch is to be executed in asynchronous mode not sup ported in ALTIBASE HDB TMNOFLAGS If flags is not set to any other value it must be set to this value TMJOIN This specifies that the transaction branch is to be connected to an existing transaction branch This is used to terminate the execution of a transaction branch int xa end XID xid int rmid long flags flags can be set to one or more of t
13. lt MinPoolSize gt 4 lt MinPoolSize gt lt InitialPoolSize gt 4 lt InitialPoolSize gt lt MaxPoolSize gt 20 lt MaxPoolSize gt lt PropertyCycle gt 1 lt PropertyCycle gt lt Sets the Idle connection check interval gt lt MaxIdleTime gt 300 lt MaxIdleTime gt lt ResizingPeriod gt 60 lt ResizingPeriod gt lt Sets the Maximum DB operation timeout gt lt OperationTimeout gt 500 lt OperationTimeout gt lt ConnectionPool gt lt Database gt lt DataSource gt 1 6 2 Setting up the JDBC Driver The following sample program shows how to set up a connection pool using the JDBC driver and the ABPoolingDataSource class This section also explains how to run the sample program 1 6 2 1 Example import java sql Application Program Interface Users Manual 12 1 6 Setting up a Connection Pool import Altibase jdbc driver ABPoolingDataSource class poolTest public static void main String args int sMinPoolSize 3 int sMaxPoolSize 5 int sConnCount 5 String sURL jdbc Altibase localhost args 0 mydb String sSql JDBC ABPoolingDataSource mConnPool null mConnPool new ABPoolingDataSource SELECT COUNT FROM VSSESSION WHERE client type like Connection sTestConn new Connection sConnCount PreparedStatement sStmt null ResultSet sRs null try mConnPool setUrl SURL mConnPool setUser SYS mConnPool setPassword MANAGER
14. Coumm Pred Application Program Interface Users Manual 54 4 2 Using the ALTIBASE HDB NET Data Provider 2 Toregisterthe ALTIBASE HDB NET Data Provider Figure 4 2 right click on References and click Add Reference Figure 4 2 Add a Reference to the DLL KENNEN Edit Project Debug Data Tools Window Help VE A 4 AAS u gt I VERE ID Ra Consolespplication Program using System using System Col lect ions Generic GP Main stringl args There are no usable controls in this group Drag an tem onto this te to add System Ling it to the toolbox using Systen Lina using System Text Einamespace Consoleappl icat iont pnan i Add Service Reference System 0 System Coe o System Data 0 System Data DataSetEstensions 3 System Xml 2 System xml Ling B Program cs class Program static void Maintstringl args Properties Description Une Coumm Project 3 Locate and register Altibase Data AltibaseClient dll in the lib subdirectory in the directory in which ALTIBASE HDB is installed The installation directory of ALTIBASE HDB can be found using the environment variable ALTIBASE_HOME 55 NET Data Provider 4 2 Using the ALTIBASE HDB NET Data Provider Figure 4 3 Register ALTIBASE HDB NET Data Provider with Project E ConsoleApplication1 Microsoft Visual C 2010 Express Administrator File Edit View Project Debug Data
15. Ex Client tx begin 101 XA Interface 6 3 Using XA tpm service SERVICE tmp service SERVICE2 tx commit Ex Server SERVICE lt get service specific data gt EXEC SQL UPDATE lt return service status back to the client gt SERVICE2 lt get service specific data gt EXEC SQL UPDATE lt return service status back to the client gt 6 3 5 Changing an Existing Application into a TPM Application To change an existing application Precompiler or ODBCCLI application into a TPM Transaction Pro cessing Monitor application that uses the XA library of ALTIBASE HDB follow the procedure out lined below 1 Convert the application into one that incorporates a service framework Here the term framework means one in which a client requests a service from an application server In some TPMs the tx_openand tx_close functions must be explicitly called while in other TPMs the logging on and off takes place implicitly 2 General connection statements must be changed into a TPM compatible form For example when working with APRE replace the EXEC SQL CONNECT statement with a call to tx_open and when working with ODBCCLI replace the SQLDriverConnect statement with calls to both tx open and SQLConnect The ODBCCLI SQLDriverConnect statement must be replaced by both tx_ open and SQLConnect Although the actual connection is achieved using tx_open the SQLCon nect task is
16. Properties sProps new Properties sProps put user SYS sProps put password MANAGER sProps put PREFER_IPV6 FALSE String sURL jdbc Altibase localhost 20300 mydb Connection sCon DriverManager getConnection sURL sProps 1 3 2 Notes java net preferlPv4Stack In order to connect using an IPv6 address the java net preferlPv4Stack property on the client must be set to FALSE If this property is set to TRUE the client application will not be able to connect to a database server using an IPv6 address Ex java Djava net preferIPv4Stack false sample 1 java net preferlPv6Addresses Setting the java net preferlPv6Addresses property to TRUE or FALSE on the client has no effect in ALTIBASE HDB JDBC Windows Application Program Interface Users Manual 6 1 3 Internet Protocol Version 6 IPv6 Support The use of IPv6 addresses with the ALTIBASE HDB JDBC driver which is implemented using the java NIO library is not supported on Windows systems due to an NIO channels bug For more information about this problem please visit http bugs sun com bugdatabase view_bug do bug_id 6230761 Note however that the use of IPv6 addresses is supported in JDK 7 and later versions in Windows Vista and later versions 7 JDBC 1 4 Handling National Character Sets 1 4 Handling National Character Sets 1 4 1 Character Set Conversion When the JBDC driver of ALTIBASE HDB connects to a databas
17. String getExtraNameCharacters A String getldentifierQuoteString ResultSet getimportedKeys String catalog String schema String O table ResultSet getindexinfo String catalog String schema String O table Boolean unique Boolean approximate int getJDBCMajorVersion O int geUDBCMinorVersion O int getMaxBinaryLiteralLength O int getMaxCatalogNameLength O int getMaxCharLiteralLength O int getMaxColumnNameLength O Int getMaxColumnsinGroupBy O Int getMaxColumnsinindex O int getMaxColumnslnOrderBy O int getMaxColumnsinSelect O int getMaxColumnsinTable O int getMaxConnections O int getMaxCursorNameLength O Application Program Interface Users Manual 18 1 7 JDBC 2 1 Core API and JDBC 2 0 Optional Package API Return Type Function Name Support int getMaxIndexLength O int getMaxProcedureNameLength O int getMaxRowSize O int getMaxSchemaNameLength O int getMaxStatementLength O int getMaxStatements O int getMaxTableNameLength O int getMaxTablesinSelect O int getMaxUserNameLength O String getNumericFunctions O ResultSet getPrimaryKeys String catalog String schema String O table ResultSet getProcedureColumns String catalog String sche O maPattern String procedureNamePattern String columnNamePattern ResultSet getProcedures String catalog String schemaPattern O Strin
18. mConnPool setMinPoolSize sMinPoolSize mConnPool setMaxPoolSize sMaxPoolSize catch Exception e e printStackTrace ry t for int i 0 i lt sConnCount i sTestConn i mConnPool getConnection if sTestConn null System out println SUCCESS Connection sStmt sTestConn i prepareStatement sSql sRs sStmt executeQuery while sRs next System out printin PooledConnection Count sRs getString 1 sStmt close else System out printin ERROR Connection for int i 0 i lt sConnCount i sTestConn i close catch Exception e e printStackTrace The sample program is executed as follows javac poolTest java java poolTest 20300 13 JDBC 1 6 Setting up a Connection Pool SUCCESS Connection PooledConnection Count 3 SUCCESS Connection PooledConnection Count 3 SUCCESS Connection PooledConnection Count 3 SUCCESS Connection PooledConnection Count 4 SUCCESS Connection PooledConnection Count 5 Application Program Interface Users Manual 14 1 7 JDBC 2 1 Core API and JDBC 2 0 Optional Package API 1 7 JDBC 2 1 Core API and JDBC 2 0 Optional Package API This section indicates which functions are currently supported by each version and package of the ALTIBASE HDB JDBC driver O which functions are to be supported in the future A and w
19. O String typeName void registerOutParameter String parameterName int sql O Type void registerOutParameter String parameterName int sql O Type int scale void registerOutParameter String parameterName int sql A Type String typeName void setAsciiStream String parameterName InputStream x A int length void setBigDecimal String parameterName BigDecimal x O void setBinaryStream String parameterName InputStream A x int length void setBoolean String parameterName Boolean x O void setByte String parameterName byte x O void setBytes String parameterName bytel x O void setCharacterStream String parameterName Reader A reader int length void setDate String parameterName Date x O void setDate String parameterName Date x Calendar cal A void setDouble String parameterName double x O void setFloat String parameterName float x O void setint String parameterName int x O void setLong String parameterName long x O void setNull String parameterName int sqlType O 33 JDBC 1 7 JDBC 2 1 Core API and JDBC 2 0 Optional Package API Return Type Function Name Support void setNull String parameterName int salType String type A Name void setObject String parameterName Object x void setObject String parameterName Object x int tar O getSalType void setObject String parameterName Object x int tar O getSa
20. and must be set to the following value TMNOFLAGS When operating in asynchronous mode this is used to determine whether to keep waiting for an operation to terminate This is not supported in ALTIBASE HDB and thus an error will always be returned Application Program Interface Users Manual 96 6 3 Using XA 6 3 Using XA This section describes the basic procedures for using ODBC APRE and JDBC in an XA environment 6 3 1 Executing ODBC XA Xa open This is used to connect to the specified server SQLAllocHandle This is used to create the connection and environment handles for connecting via ODBC SOLSetConnectAttr This is used to associate the connection handle with the XA connection SQLConnect SQLConnect does not actually establish a physical connection between the TM and the RM because that is accomplished by calling xa_open SQLConnect merely changes the internal state of the connection within ODBC This is a necessary step in order to be able to perform DML operations using ODBC xa_start This is used to commence execution of the transaction branch corresponding to the given XID executing SQL statements Here operations such as SQLPrepare and SQLExecute are performed If an attempt is made to execute a commit statement here the server will return an error message xa end This is used to terminate execution of a transaction branch xa_prepare This is used to prepare a transaction branch for commit
21. readSize size iloBool informix iloBool flock iloBool mssql iloBool getTotalRowCount int setRowFrequency ALTIBASE ILOADER OPTIONS V1 Member Description version This must be set to the same value as the version argument that is passed by altibase iloader options init tableOwner This is used to specify the name of the table owner loadModeType ILO_APPEND This is the same as APPEND one of the possible values for the iLoader mode option ILO REPLACE This is the same as REPLACE one of the possible values for the iLoader mode option ILO TRUNCATE This is the same as TRUNCATE one of the possible values for the iLoader mode option The default value is ILO_APPEND 127 The iLoader API 7 3 iLoader API Data Structures Member Description atomic This is used to specify whether to use Atomic Array INSERT It can be either ILO_TRUE or ILO_FALSE The default value is ILO_FALSE directLog This is used to specify whether to use direct path INSERT If it is set to ILO DIRECT NONE Direct Path INSERT is not used If it is set to ILO DIRECT LOG Direct Path INSERT is executed in log ging mode If it is set to ILO DIRECT NOLOG Direct Path INSERT is executed in nologging mode The default value is ILO DIRECT NONE dataFileNum This is used to specify the number of datafiles for the dataFile member in this structure getTotalRowCount This specifies whether to get the total number of rows in th
22. to Log Structure turn Values If ILO STATISTIC LOG is specified for type when a user defined callback function is called and the user defined callback function returns anything other than 0 zero execution of the current upload or download task will stop 7 4 Description The ALTIBASE HDB iLoader API has the capability to execute user specific code in addition to iLoader API calls This functionality allows users to control execution of their applications based on the con tents of iLoader logs When altibase iloader datain or altibase iloader dataout is called a callback function which may be a user defined function can be registered When the callback function is called it receives the following iLoader log information the time at which the task started the total number of rows to be uploaded or down loaded the number of rows that have been successfully uploaded or downloaded and the number of rows that could not be uploaded or downloaded due to the occurrence of an error The application s callback function will be called at the following times When an error occurs during the course of an upload or download operation At this time the structure that is passed to the callback function is ILO LOG ALTIBASE ILOADER LOG The ALTIBASE ILOADER LOG structure contains an Error Structure which contains an errorCode member If the value of that member is not 0 this means that an error has occurred After a
23. 127 0 0 1 u sys p manager T T1 f t1 fmt Creating a Format File Using an Application that Calls the iLoader API int main 135 The iLoader API 7 4 The iLoader API ALTIBASE ILOADER HANDLE handle ALTIBASE ILOADER NULL HANDLE ALTIBASE ILOADER OPTIONS V1 opt ALTIBASE ILOADER ERROR err int rc Allocate an iLoader handle rc altibase iloader init amp handle if re Ie ALTIBASE ILO SUCCESS printf Failed to altibase iloader init failed d n rc return 1 Initialize an option structure altibase iloader options init ALTIBASE ILOADER V1 amp opt strcpy opt serverName 127 0 0 1 strcpy opt loginID sys strcpy opt password manager strcpy opt tableName t1 strcpy opt formFile t1 fmt formout rc altibase iloader formout amp handle ALTIBASE ILOADER V1 amp opt amp err if rc ALTIBASE ILO SUCCESS else printf SUCCESS n printf ERR 05X Ss s n err errorCode err errorState err errorMessage if handle ALTIBASE ILOADER NULL HANDLE return 0 altibase iloader final amp handle 7 4 5 altibase iloader init This function allocates an iLoader handle 7 4 5 1 Syntax int altibase iloader init ALTIBASE ILOADER HANDLE handle Application Program Interface User s Manual 136 7 4 The iLoader API 7 4 5 2 Arguments Argument In Out Descriptio
24. 2 2 Verifying the OLE DB Installation To verify the installation of the ALTIBASE HDB OLE DB provider follow the steps outlined below To verify that the OLE DB provider of ALTIBASE HDB has been installed 1 Get all connection properties pertaining to the ALTIBASE HDB server to which to connect including the server IP address the port number and the user account of ALTIBASE HDB 2 Create an OLE DB Universal Data Link UDL file Go to the folder where the UDL file is to be created Create a new text document in this folder The name of the text file must have the udl file name extension i e the file must be named udl Therefore rename the empty file that was created in the previous step as desired making sure that you change the extension from txt to udl Double clicking this file should cause the panel of data access properties for the ud file to appear 3 Go to the Provider tab and select the provider to use As you can see there is a wide variety of OLE DB providers to choose from In this example we will use the OLE DB Provider for ALTI BASE HDB Then click the Next button 71 OLE DB 5 2 Installation Provider Connection Advanced All Select the data you want to connect to OLE DB Provider s Microsoft OLE DB Provider for Indexing Service Microsoft OLE DB Provider for SQL Server Microsoft OLE DB Simple Provider MSDataShape OLE DB Provider for Altibase OLE DB Provider for M
25. 5 2 1 Installing and Uninstalling OLE DB 5 2 2 Verifying the OLE DB Installation nn 71 523 Creating a Connection String ta GEK Re EER ee Ge ka de ee ended 74 5 2 4 ALTIBASE HDB and OLE DB Data Types nn 76 5 3 Propertie SERE RE OE EE ER ER OD EE OD 5 3 1 DBPROPSET DATASOURCEINFO 5 3 2 DBPROPSET_DBINIT sesse 5 3 3 DBPROPSET OGIS SPATIAL OPS sig 5 34 DBPR PSET ea ER EO EE denn int i 5 3 5 DBPROPSET isdie EE EE EE soussnsassdausstuvanbassdsassaut npasseassshavetbeassbassbadscndseasisbasss Br The OLE DB ET ER EE EE OE 54 1 The Data Source Object ke ee ES GEK Rene EE ed GEK genee EE eene ds Gee 5 4 2 The Session Object 5 4 3 The Command Object 5 4 4 The Multiple Results Object D 5 4 5 Th Rowset Object ES EE ER EE Ge ETAN EEA RAN 5 4 6 The Te EO ol ea EE EN OE N 54 7 The Error Object N N reaa iE A AE Aea E SAE E EEES EEN Custom Error OBj ed OE EE NE EN N 5 5 EXAaMpPlES seen seen sense ee 5 5 1 ADO Example 5 5 2 ADO NET Example is 6 XA Interface susse see sesse see se se ee EE EE EE EE EE ee Ee EE EE RE EE EE EE EE ee EE Ee Ge ee EE De Be ee EE GE Re EE EE AE Ee ee eio Ge Ge Ee ee ee ee 6AKAINterface ER Ge ee ee ee ede 6A 1XAGIOSSAP RE eden dende 6V2 LES le dl EO EE miens 6 1 3 XA and 2PC Two Phase Commit 6 1 4 Xa SwWitch t Structure EG EG OE Ee bee 6 1 5 The XA Library N 6 2 The XA Interface N IE EE Ee aai 6 2 T XA RUNCU OSa Ge ed eN Gee EA EE AEE Do ee De EN 63 Using N OE OR N eee 6 3 1 EXEC
26. 80 5 3 Properties Property State Initial Value DBPROP Rowsetldentity Read Only VARIANT TRUE DBPROP_IRowsetinfo Read Only VARIANT_TRUE DBPROP_ISequentialStream Read Only VARIANT_TRUE DBPROP ISupportErrorinfo Read Only VARIANT TRUE DBPROP LITERALIDENTITY Read Only VARIANT TRUE DBPROP MAXROWS Read Only 0 DBPROP_OTHERINSERT Read Only VARIANT_FALSE DBPROP_OTHERUPDATEDELETE Read Only VARIANT_FALSE DBPROP_OWNINSERT Read Only VARIANT_FALSE DBPROP_OWNUPDATEDELETE Read Only VARIANT_FALSE DBPROP_REMOVEDELETED Read Only VARIANT_FALSE DBPROP_SERVERCURSOR Read Only VARIANT_FALSE DBPROP_UPDATABILITY Read Only VARIANT_FALSE The following tables summarizes the OLE DB properties in the DBPROPSET_SESSION property set that are currently supported by ALTIBASE HDB Property State Initial Value DBPROP SESS AUTOCOMMITISOLEVELS Read Only ISOLATIONLEVEL_READCOMMITTED 81 OLE DB 5 4 The OLE DB Interfaces 5 4 The OLE DB Interfaces This sections discusses the use of objects and their interfaces The following objects are the OLE DB interfaces that are currently supported by ALTIBASE HDB Data Source Object Session Object Command Object Multiple Results Object Rowset Object Row Object Error Object Custom Error Object 5 4 1 The Data Source Object The data source object is necessary in ord
27. Decimal Double DOUBLE Double Float FLOAT Decimal Geometry GEOMETRY Byte Integer INT Int32 NChar NCHAR String Nibble NIBBLE Byte Number NUMBER Decimal Numeric NUMERIC Decimal NVarChar NVARCHAR String Real REAL Float Smallint SMALLINT Int16 VarBit VARBIT Bytel VarChar VARCHAR String To use a character string constant in an SQL statement when working with a national character set add the character N in front of the character string 61 NET Data Provider 4 3 Interface Settings for NET Data Provider 4 3 Interface Settings for NET Data Provider 4 3 1 Interface Settings Version 2 0 of ADO NET introduced a facility for supporting provider independent programming The DbProviderFactories class enables the user to create instances of a desired data provider s DbProviderFactory class The user can then use the DbProviderFactory class instance to create and use DbConnection and DbCommand objects However in order to use the DbProviderFactories class and related classes information about the NET Data Provider must first be registered in the NET Framework settings file There are two ways to register information about data providers to enable the factory model Registering the information in the NET Framework settings file Using an application s environment settings file An application s environment settings file is in XML format The provider information can be found in the system data DbProviderFact
28. Executing APRE XA 6 3 2 1 How to Author an Application depending on the Setting of XA_NAME in xa_open In XA applications a cursor is valid only for a single transaction This means that a cursor must be opened after the start of execution of a transaction and must be closed before the transaction is completed i e committed or rolled back How to Author an Application when Using the Default Connection If it is desired to use the default connection the XA NAME keyword must not be present in xa_info which is the character string parameter of xa open that contains the connection infor mation An example of xa info without XA NAME is shown below DSN 127 0 0 1 UID SYS PWD MANAGER lt is therefore not possible to use the AT clause when executing SQL queries The following query is acceptable because it does not contain an AT clause EXEC SQL UPDATE emp SET empno 5 Application Program Interface Users Manual 98 6 3 Using XA How to Author an Application when Using XA NAME to Specify One or More Connections If it is desired to specify a connection when using APRE to author an application the XA NAME key word and a corresponding value must be present in the xa info connection character string parameter of xa open An example of a valid keyword value pair is shown below XA NAME conn1 It is possible to write an application that uses a default connection and one or more additional con nections specified using XA_NAME This
29. HDB aborts these transactions in order to shut down Recovery tasks are then performed when the server is subse quently restarted and these prepared transactions are restored to their previous state In contrast if there are no prepared transactions when the server is shut down normally recovery tasks will not be performed when the server is restarted Application Program Interface Users Manual 106 6 5 JDBC Distributed Transactions 6 5 JDBC Distributed Transactions ALTIBASE HDB JDBC can be used to implement distributed transactions as it complies with the OpenXA standards related to connection pooling and distributed transaction processing as set forth in the JDBC 2 0 extension API The jdbc driver package of ALTIBASE HDB includes classes for realizing all of the distributed transaction processing functionality in accordance with the XA stan dard 6 5 1 JTA Java Transaction API and Application Server The method by which an application processes a distributed transaction through an application server is shown in the following figure Figure 6 3 Distributed Transaction Processing Application Transaction Resource Application gt Server Manager Adapter The application server supports the use of XAConnections that make it possible to connect to respective resources An application connects to an application server establishes a connection and executes queries The application server
30. Perl package was uncom pressed make From the directory in which the Perl package was decompressed install the package using the root account make install Download the Event package e g Event 1 00 tar gz to install the Event module a Uncompress Event 1 00 tar gz in the directory in which it is desired to install the Event module gzip cd Event 1 00 tar gz tar xvf Execute the configure command in the directory in which the Event package was uncompressed configure Execute the make command in the directory in which the Event package was uncom pressed make From the directory in which the Event package was decompressed install the module using the root account make install 47 PERL DBD DBI 3 3 Installing the ALTIBASE HDB DBD 3 3 Installing the ALTIBASE HDB DBD 3 3 1 The ALTIBASE HDB PERL DBD Installation Procedure 3 3 1 1 Check the Perl Installation Execute per1 on the command line with the V option to check the value of the dlext configuration variable It must be s1 on HP UX and so on other platforms If this value is not correct it will be nec essary to reinstall Perl 3 3 1 2 Install the Perl DBI Install the Perl DBI package which is a prerequisite for compiling the Perl DBD Method 1 Using the root account perl MCPAN e shell prompt gt install DBI Method 2 If the above method does not work download the package via ftp from the address shown below compile it and install it
31. application that uses the CheckServer API The location of this server is specified using the home dir argu ment If home_dir is set to NULL the value of the ALTIBASE HOME environment variable is used Only one CheckServer handle can be used within one application Additionally a CheckServer han dle cannot be shared by more than one thread at the same time 8 4 3 5 Related Functions altibase check server 8 4 3 6 Example See altibase check server 8 4 4 altibase check server cancel This function cancels the processing of the altibase check server function associated with the specified handle 8 4 4 1 Syntax int altibase check server cancel ALTIBASE CHECK SERVER HANDLE handle Application Program Interface User s Manual 150 8 4 The CheckServer API 8 4 4 2 Arguments Argument In Out Description handle Input This is the CheckServer handle to be canceled 8 4 4 3 Return Values ALTIBASE CS SUCCESS or ALTIBASE CS ERROR or ALTIBASE CS INVALID HANDLE 8 4 4 4 Description In a multithreaded application one thread can call altibase check server cancel to cancelthealtibase check server function that is running on another thread If the call to altibase check server cancel issuccessful altibase check server is stopped and the value ALTIBASE CS ABORTED BY USER is returned It might take some time from the time that altibase check server cancel is called until the execution o
32. columnindex Timestamp x X void updateTimestamp String columnName Timestamp x X boolean wasNull O 27 JDBC 1 7 JDBC 2 1 Core API and JDBC 2 0 Optional Package API Application Program Interface Users Manual 28 Return Type Function Name Support String getCatalogName int column A String getColumnClassName int column O Int getColumnCount O int getColumnDisplaySize int column O String getColumnLabel int column O String getColumnName int column O int getColumnTypelint column O String getColumnTypeName int column O int getPrecision int column O int getScale int column O String getSchemaName int column O String getTableName int column O boolean isAutolncrement int column O boolean isCaseSensitive int column O boolean isCurrency int column O boolean isDefinitelyWritable int column O int isNullable int column O boolean isReadOnly int column O boolean isSearchable int column O boolean isSigned int column O boolean isWritable int column O Return Type Function Name Support void addBatch String sql O void cancel O void clearBatch O void clearWarnings O 1 7 JDBC 2 1 Core API and JDBC 2 0 Optional Package API Return Type Function Name Support void close O boolean execute String
33. in a database and writes the data toa file altibase_iloader_datain Uploads data into a table in a database CallbackFunctionName A user defined callback function Application Program Interface User s Manual 122 7 2 Using the iLoader API 7 2 Using the iLoader API 7 2 1 Header Files SALTIBASE HOME include iloaderApi h 7 2 2 Libraries The iLoader API library files that are required in order to develop an application that uses the iLoader API reside in the SALTIBASE HOME 1ib directory The iLoader API applications must always link with the following libraries UNIX libiloader a libodbccli a Windows iloader lib odbccli lib 7 2 3 Samples Sample iLoader API applications can be found in the SALTIBASE HOME sample ILOADERAPI directory 123 The iLoader API 7 3 iLoader API Data Structures 7 3 iLoader API Data Structures This section describes the C types that are provided for use in applications written using the iLoader API These types are The iLoader Handle Error Structure Log Structure Option Structure iLoader API Enumerators 7 3 1 The iLoader Handle The iLoader handle is an opaque data structure that is defined by the iLoader API library It is used to store information pertaining to the behavior of applications that use the iLoader API ALTIBASE_ILOADER_HANDLE This is an iLoader handle The iLoader handle is primarily used when downloading data uploading data and creating FORM files Th
34. is accomplished as shown below If for example the names of the connections specified using XA NAME are conn1 and conn2 the value of open string in the TM Transaction Manager environment settings would be as follows DSN 127 0 0 1 UID SYS PWD MANAGER XA NAME conn1 DSN 127 0 0 1 UID SYS PWD MANAGER XA NAME conn2 DSN 127 0 0 1 UID SYS PWD MANAGER This permits the application to execute SQL statements that contain the AT clause thereby accessing multiple servers as shown below EXEC SQL AT connl UPDATE emp SET empno 5 EXEC SQL AT conn2 UPDATE emp SET empno 5 EXEC SQL UPDATE emp SET empno 5 6 3 3 Executing JDBC XA The XA classes that are defined by the jdbc driver of ALTIBASE HDB are as shown below Altibase jdbc driver ABXADataSource Altibase jdbc driver ABXAResource Altibase jdbc driver XID The ABXADataSource class is the only one that the user accesses directly The user does not need to directly access the other classes as they are implemented in the JTA interface class 1 Create an ABXADataSource Object ABXADataSource xaDataSource new ABXADataSource xaDataSource setUrl args 0 xaDataSource setUser SYS xaDataSource setPassword MANAGER 2 Create an XAConnection Object Create an XAConnection object by calling the get XAConneet ion method in the XAData Source class XAConnection xaConnection xaDataSource getXAConnection SYS MAN AGER 3 Create an XAResource Object
35. is the pointer to the iLoader handle version Input This is the version of the iLoader API options Input This is the pointer to the option structure Application Program Interface User s Manual 134 7 4 The iLoader API Argument In Out Description error Output This is the pointer to the error structure in which to return information for diagnosing errors For more information about this structure please refer to iLoader API Data Structures 7 4 4 3 Return Values ALTIBASE ILO SUCCESS or ALTIBASE ILO ERROR 7 4 4 4 Diagnostics When altibase iloader formout returns ALTIBASE ILO ERROR the associated error information is returned in error 7 4 4 5 Description altibase iloader formout is used to create a format file FORM file that describes a data base table This function can be called only after altibase iloader init and altibase iloader options init have been called The value of the version argument must be ALTIBASE ILOADER V1 7 4 4 6 Related Functions altibase iloader init altibase iloader options init altibase iloader datain altibase iloader dataout altibase iloader final 7 4 4 7 Example The following example shows how to create a format file that describes table T7 both when using the iLoader utility directly and when calling the iLoader API from within an application Creating a Format File Using the iLoader Utility iloader formout s
36. manages the transaction using the TM Transaction Manager The TM accesses required resources using a Resource Adapter provided by the DBMS vendor When the resource to which a connection is to be established using the Resource Adapter is a DBMS the JDBC driver package can be used as the Resource Adapter A Resource Adapter has 4 classes namely the ResourceFactory Transactional Resource XAConnection Connection and XAResource classes The ResourceFactory class is used to create an XAConnection object In the case of JDBC the factory that is used to create XAConnection objects is XADataSource The application server obtains an XAConnection object for connecting to a DBMS from the XADataSource factory The application server then obtains an instance of a connection object java sal Connection to be used by the application and an instance of a XAResource object to be used by the TM from the XAConnection object 6 5 2 XA Components In this section the standard XA interfaces provided in the JDBC 2 0 Optional Package are explained along with the ALTIBASE HDB classes in which they are implemented 6 5 2 1 XADataSource Interface The javax sal XADataSource interface is a factory for creating XAConnection objects This interface s getXAConnect ion method returns an XAConnection object public interface XADataSource XAConnection getXAConnection throws SQLExcept ion 107 XA Interface 6 5 JDBC Distributed Transactions XA
37. method an improvement in speed can be expected when processing multiple rows At present array binding is supported for input parameters only the binding of output and input output parameters is not supported The procedure for binding arrays is as follows 1 Ensure that all of the variables to be bound are in array form The size of each array must be greater than or equal to the setting of the ArrayBindCount property in the AltibaseCommand class 2 Bind the array variable s to the parameter s If the column to be bound is a CHAR VARCHAR or BLOB type column the value of the ArrayBindSize property in the AltibaseParameter class must be set to the same size as the largest of the elements in the array 3 Setthe value of the ArrayBindCount property in the AltibaseCommand class For example to insert 100 values at a time set the value of the ArrayBindCount property to 100 Application Program Interface Users Manual 56 4 2 Using the ALTIBASE HDB NET Data Provider 4 Execute SOL statements using the bound array s 4 2 2 1 Considerations When binding arrays it is important to keep the following in mind The valid range of the ArrayBindCount property is from 1 to 65535 No performance benefit is realized by creating very large arrays so this property should be set appropriately for the amount of data being handled If the length of the data for a single element of a CHAR VARCHAR or BLOB type array exceeds the v
38. must guarantee that a resource deadlock does not occur between tightly coupled threads 6 4 3 No Support for Association Migration Association migration in which the TM associates a suspended branch with another branch and resumes its execution isn t supported in ALTIBASE HDB 6 4 4 No Support for Asynchronous Calls Asynchronous XA calls are not supported in XA applications of ALTIBASE HDB 6 4 5 No Support for Dynamic Registration The ALTIBASE HDB server does not support dynamic registration Only static registration is sup ported In so called dynamic registration an RM registers a global transaction with the TM before it starts executing a transaction branch In static registration it is necessary to use xa start to tell an RM that a transaction has com menced 6 4 6 Server Shutdown 6 4 6 1 Abnormal Server Shutdown Suppose that the server terminates abnormally or that the shutdown abort command is exe cuted on the server and that there are one or more transactions that are in a prepared state at that time When the server is subsequently restarted recovery tasks will be performed after which it will be possible to execute these transactions using the xa recover statement 105 XA Interface 6 4 Limitations when using XA 6 4 6 2 Normal Server Shutdown If the server is shut down normally using the shutdown immediate or shutdown normal command while there are one or more transactions in a prepared state ALTIBASE
39. such as table names col umn names file names etc SELECT e_lastname FROM employ ees Upper Case Let Keywords and all elements pro ters vided by the system appear in upper case DESC SYSTEM SYS INDICES For additional technical information please refer to the following manuals ALTIBASE HDB Installation Guide ALTIBASE HDB Administrator s Manual e ALTIBASE HDB Replication Manual ALTIBASE HDB Precompiler User s Manual ALTIBASE HDB ODBC Reference ALTIBASE HDB iSQL User s Manual Preface ALTIBASE HDB Utilities Manual ALTIBASE HDB Error Message Reference Online Manuals Online versions of our manuals PDF or HTML are available from the Altibase Customer Support http support altibase com Altibase Welcomes Your Comments Please feel free to send us your comments and suggestions regarding this manual Your comments and suggestions are important to us and may be used to improve future versions of the manual When you send your feedback please make sure to include the following information The name and version of the manual that you are using Any comments that you have about the manual Your full name address and phone number For immediate assistance with technical issues please contact the Altibase Customer Support http support altibase com We always appreciate your comments and suggestions Application Program Interface Users Manual vi 1 JDBC
40. to install JDBC use JDBC to con nect to ALTIBASE HDB deal with international Unicode character sets and configure a JDBC connection pool Chapter2 The PHP Interface This chapter explains how to integrate PHP pages with ALTIBASE HDB using ODBC functional ity of PHP Chapter3 PERL DBD DBI This chapter explains how to use the Perl DBD Database Driver and DBI Database Interface with ALTIBASE HDB It describes in detail how to install Perl and the ALTIBASE HDB Perl DBD and how to check the status of the ALTIBASE HDB Perl DBD Chapter4 NET Data Provider This chapter describes how to Microsoft s ADO NET interface with Altibase DBMS Chapter5 OLE DB Application Program Interface Users Manual ii This chapter describes support for the OLE DB within ALTIBASE HDB and explains how to install and uninstall OLE DB and how to use OLE DB to access data in a variety of environments Chapter6 XA Interface This chapter introduces the data structures and functions that are needed to use the XA func tions supported by ALTIBASE HDB and provides basic procedures for using ODBC APRE and JDBC in an XA environment Chapter7 The iLoader API This chapter introduces the ALTIBASE HDB iLoader API which is an application programming interface that lets you create applications that use function calls to download data from or upload data to an Altibase database server Chapter8 The CheckServer API This chapter introd
41. transaction doesn t change any of the data on the RM i e DBMS The transaction does not need to be committed or rolled back XA OK This is returned when the prepare task is performed normally commit Ka CC This is used to commit a particular transaction branch int xa_commit XID xid int rmid long flags flags can be set to either of the following values TMONEPHASE This is set to specify one phase commit TMNOFLAGS If flags is not set to any other value it must be set to this value KI 1 Qwva ra 6 2 1 6 Xa re This obtains a list of the XIDs corresponding to branch transactions that are in a prepared state on an ALTIBASE HDB server int xa recover XID xids long count int rmid long flags The return value indicates the number of XIDs that were recovered The count parameter is used to set the maximum number of XIDs that fit into the xids array flags can be set to one or more of the following values 95 XA Interface 6 2 The XA Interface TMSTARTRSCAN For more information please refer to the XA Specification documentation TMENDRSCAN For more information please refer to the XA Specification documentation TMNOFLAGS XIDs are returned starting at the current cursor position This instructs the ALTIBASE HDB server i e the RM to stop managing a heuristically completed transaction branch int xa forget XID xid int rmid long flags flags has no specific purpose in this function
42. using the following commands ftp ftp nuri net pub CPAN modules by module DBI 1 perl Makefile PL 2 make die make install 3 3 1 3 Download and Uncompress the ALTIBASE HDB Perl DBD Files Visit http support altibase com and download the file from the location shown below Because the ALTIBASE HDB Perl DBD is a 32 bit driver the ALTIBASE HDB 32 bit client package or 32 bit server package must already be installed on the system on which the DBD is being installed Additionally the value of the SALTIBASE HOME environment variable must be correctly set download back altibase PERL DBD altibase perlDBD YYYYMMDD tar gz Uncompress the file gzip cd altibase perlDBD YYYYMMDD tar gz tar xvf 3 3 1 4 Make the ALTIBASE HDB Perl DBD Execute make on the install mk file which was included in the compressed file downloaded in the previous step to create the Makefile which will be used to create the DBD make f install mk Execute make again without any arguments to specify that Makefile is to be used as the source This creates the shared library that is used as the Perl DBD of ALTIBASE HDB On HP UX the resultant file name is altibase sl On platforms other than HP UX the resultant filename is altibase so and it is cre Application Program Interface Users Manual 48 3 3 3 3 Installing the ALTIBASE HDB DBD ated in blib arch auto DBD altibase make Execute make install as root This installs the Perl DBD of AL
43. 3 Internet Protocol Version 6 IPv6 Support 1 3 Internet Protocol Version 6 IPv6 Support This release of the ALTIBASE HDB JDBC Driver supports the use of IPv6 addresses in the JDBC URL as well as the use of host names that resolve to IPv6 addresses 1 3 1 Using IPv6 Addresses To specify an IPv6 address as a URL the address must be enclosed in square brackets 1 For example when localhost meaning the same computer is specified using an IP address brack ets are not used to denote the IPv4 address 127 0 0 1 whereas they are used to denote the IPv6 address 1 For more information about IPv6 address notation please refer to the ALTIBASE HDB Administrators Manual The PREFER IPV6 property determines whether to first attempt to resolve a host name to an IPv4 address or an IPv6 address when a host name is given for the server ip property If this property is set to TRUE and a host name is given for the server ip property the client applica tion will first attempt to resolve the host name to an IPv6 address If this property is omitted or if it is set to FALSE the client application will first attempt to resolve the host name to an IPv4 address That is the default behavior is to attempt to resolve the host name to an IPv4 address If the client application fails to connect using the preferred IP address type it then attempts to con nect using the other IP address type 1 3 1 Example Connection sCon null
44. 82 1 Header Fil SE ER DE ER EG enk handen 145 822 The Ch ckSserverLibrari s iese ss se ES ae ske eg EG ode OARS 145 ES ro TE EA N N eN N 145 8 3 CheckServer API Data Structure 2eme ESE RR GE a ee ee Ge es ee ee ke 146 83 1 The CheckServer Handle ie GE EE Re GR Ee EE ee ee Ee Re N se Ge 146 8AThe Ch ckServer APl zaanstad en eN ar dee beste l 147 84 1 altibds check server ee sn denderde bestandenset eenden 147 8 4 2 altibase check server finaliste Gee GO ke ee ee Ge ke Be ge ede 148 8 4 3 altibase check server _init sesse ee ee ee ee ee ee ee ee ee ee ee ee ee oe ee eg ee ee ee ee ee eg ee ee n 149 8 4 4 altibase check server Cancel 150 Preface About This Manual This manual explains how to use the ALTIBASE HDB API Audience This manual has been prepared for the following users of ALTIBASE HDB Database administrators Application developers Programmers It is recommended that those reading this manual possess the following background knowledge Basic knowledge in the use of computers operating systems and operating system utilities Experience in using relational databases and an understanding of database concepts Computer programming experience Software Environment This manual has been prepared assuming that ALTIBASE HDB 6 will be used as the database server Organization This manual is organized as follows Chapter1 JDBC This chapter briefly describes the JDBC API and explains how
45. AS SOON ECH Data Source Type XADataSource wl HOE 421 EH Database Name mydb GIOIEHIOI 2 DIS Orade BS database SID Port Number 25226 Database listener 2 ZE HS Server Name 192 168 1 31 Database SET SAE OS LEP User SYS DB ABAH ID EHAA Hel SS SOMME EEE HSS PAID OO Sth Password plain lv eee DB AFB At password 6 5 4 4 JEUS Application Example step 1 JNDI Lookup and get UserTransaction Object Context ctx null Hashtable env new Hashtable Parameter for weblogic env put Context INITIAL CONTEXT FACTORY jeus jndi JNSContextFactory env put Context URL PKG PREFIXES jeus jndi jns url env put Context PROVIDER_URL 127 0 0 1 env put Context SECURITY PRINCIPAL jeus env put Context SECURITY CREDENTIALS jeus etx new InitialContext env System out printlin Context Created ctx step 2 get User Transaction Object UserTransaction tx UserTransaction ctx lookup java comp UserTransaction 113 XA Interface 6 5 JDBC Distributed Transactions step 3 start Transaction System out printin Start Transaction tx tx begin try step 4 doing query step 4 1 get Datasource DataSource xads1 DataSource ctx lookup altiTXDS 6 5 5 Example The following example illustrates how to implement distributed transactions using ALTIBASE HDB XA In this example the operations are executed in the following or
46. Altibase Application Development Application Program interface User s Manual Release 6 1 1 February 4 2013 ALTIBASE Altibase Application Development Application Program Interface User s Manual Release 6 1 1 Copyright 2001 2012 Altibase Corporation All rights reserved This manual contains proprietary information of Altibase Corporation it is provided under a license agreement containing restric tions on use and disclosure and is also protected by copyright patent and ofher intellectual property law Reverse engineering of the software is prohibited All trademarks registered or otherwise are the property of their respective owners Altibase Corporation 10F Daerung PostTower Il 182 13 Guro dong Guro gu Seoul 152 847 South Korea Telephone 82 2 2082 1000 Fax 82 2 2082 1099 Homepage http www altibase com Contents Pr face ese ee de DE EG Ge EG GR E Ee GE GR Ge E ie ee i About This Manuali sae ee Ge Ge ee ed ee ee ii AUdience ni n oree A AE Ee Ee a eenander O des ii Software Environment se ees ees ARER T E En a N ee ii GAZAL ON SR eenheden O eneen De ii Documentation Conventions ss ds Ee AG Se age des ne e ana ae iii Related Reddi ginea oeni e EO T EE EN E v OnlineManuals ES GE Gee ee Be EE deduce Re Se EE hr A ATATA ARREA vi Altibase Welcomes Your COMMENTS nr vi 1 JDBC ssnses 1 1 1 Installation 2 1 1 1 Checking the JDBC Driver Version sad 1 1 2 JAVA Application iad 1 1 3
47. AltibaseFactory M CreateDataSourceEnumerator M CreatePermission AltibaseConnection M EnlistTransaction Transaction transcation P DataSource P ServerVersion AltibaseDataReader M GetDbDataReader M GetProviderSpecificFieldType M GetProviderSpecificValue M GetProviderSpecificValues P HasRows P VisibleFieldCount AltibaseDataAdapter M AddToBatch IDbCommand command M CrearBatch M ExecuteBatch M GetBatchedParameter M GetBatchedRecordsAffected int commandl dentifier out int recordsAffected out Excep tion error M InitializeBatching M TerminateBatching AltibaseParameter M ResetDbType AltibaseDataSourceEnumera A tor AltibasePermission A AltibasePermissionAttribute Methods that are derived from base constructors in abstract classes that are inherited are the same as the corresponding base methods The members that provide base constructors are as follows CreateCommandBuilder CreateConnectionStringBuilder CreateDataSourceEnumerator CreatePermission GetProviderSpecificFieldType GetProviderSpecificValue Application Program Interface Users Manual 64 4 3 Interface Settings for NET Data Provider GetProviderSpecificValues VisibleFieldCount GetBatchedRecordsAffected int commandidentifier out int recordsAffected out Excep tion error All members that are not based on base constructors will raise a NotimplementedException 65 NET Data Provider 4 4 NET Data Pro
48. Boolean dataDefinitionCausesTransactionCommit O Boolean dataDefinitionlgnoredlnTransactions O Boolean deletesAreDetected int type O Boolean doesMaxRowSizelncludeBlobs O ResultSet getAttributes String catalog String schemaPattern A String typeNamePattern String attributeNamePattern ResultSet getBestRowldentifier String catalog String schema O String table int scope boolean nullable ResultSet getCatalogs O String getCatalogSeparator A String getCatalogTerm A ResultSet getColumnPrivileges String catalog String schema O String table String columnNamePattern ResultSet getColumns String catalog String schemaPattern O String tableNamePattern String columnNamePattern Connection getConnection O 17 JDBC 1 7 JDBC 2 1 Core API and JDBC 2 0 Optional Package API Return Type Function Name Support ResultSet getCrossReference String primaryCatalog String pri O marySchema String primaryTable String foreignCata log String foreignSchema String foreignTable Int getDatabaseMajorVersion O Int getDatabaseMinorVersion O String getDatabaseProductName O String getDatabaseProductVersion O int getDefaultTransactionlsolation O int getDriverMajorVersion O int getDriverMinorVersion O String getDriverName O String getDriverVersion O ResultSet getExportedKeys String catalog String schema String O table
49. CallableStatement prepareCall String sql O CallableStatement prepareCall String sql int resultSetType int result X SetConcurrency CallableStatement prepareCall String sql int resultSetType int result X SetConcurrency int resultSetHoldability PreparedStatement prepareStatement String sql O PreparedStatement prepareStatement String sal int autoGeneratedKeys X PreparedStatement prepareStatement String sql int columnindexes X PreparedStatement prepareStatement String sql int resultSetType int O resultSetConcurrency PreparedStatement prepareStatement String sql int resultSetType int A resultSetConcurrency int resultSetHoldability PreparedStatement prepareStatement String sql String columnNames Void releaseSavepoint Savepoint savepoint O Application Program Interface Users Manual 16 1 7 JDBC 2 1 Core API and JDBC 2 0 Optional Package API Return Function Name Support Void rollback O Void rollback Savepoint savepoint O Void setAutoCommit boolean autoCommit O Void setCatalog String catalog X Void setHoldability int holdability X Void setReadOnly boolean readOnly X Savepoint setSavepoint O Savepoint setSavepoint String name O Void setTransactionlsolation int level O Void setTypeMap Map map X Return Type Function Name Support Boolean allProceduresAreCallable O Boolean allTablesAreSelectable O
50. Conn CreateCommand Processing the transaction TODO Terminating the transaction s sTrans Commit Application Program Interface Users Manual 58 4 2 Using the ALTIBASE HDB NET Data Provider In ALTIBASE HDB the use of the ADO NET GetSchema method can of course be used to return gen eral schema information such as information about the MetaDataCollections DataSourcelnforma tion DataTypes Restrictions and ReservedWords collections It can additionally be used to query the following Altibase specific schema information pertaining to meta tables and performance views Table 4 1 Altibase Specific Meta Table and Performance View Schema supported for Use with GetSchema Meta Table or Performance Schema View Description Users SYS_USERS_ A meta table containing infor mation about users Tables SYS_TABLES_ A meta table containing infor mation about all kinds of tables Views SYS_VIEWS_ A meta table containing infor mation about views Sequences VSSEQ A performance view contain ing information related to sequences Synonyms SYS_SYNONYMS_ A meta table containing infor mation about synonyms Indexes SYS_INDICES _ A meta table containing infor mation about indexes Columns SYS COLUMNS _ A meta table containing infor mation about columns Constraints SYS CONSTRAINTS A meta table containing infor mation about constraints Procedures SYS _ PROCEDURES _ A meta table containin
51. Connection getXAConnection String user String password throws SOLException Altibase jdbc driver ABXADataSource is the class in which the XADataSource interface is imple mented and is included in the JDBC driver provided by ALTIBASE HDB It is derived from the Alti base jdbc driver ABConnectionPoolDataSource class The ABConnectionPoolDataSource class is in turn derived from the Altibase jdbc driver DataSource class Therefore the ABXADataSource class includes all the connection properties that the DataSource and ABConnectionPoolDataSource classes have Figure 6 4 ABXADataSource Class DataSource lt nterface gt t XADataSource ABConnectionPoolDataS ource A l METAAL EE l l ABXADataSource The getXAConnection method of the ABXADataSource class returns an instance of the XACon nection type Because this is actually an instance of the ABPooledConnection class the ABPooled Connection class is the implementation of the XAConnection interface An XA data source can be registered in the Java Naming and Directory Interface JNDI and used onne n int e The XAConnection interface is a child interface of the PooledConnection interface It includes the getConnection close addConnectionEventListener and removeConnec tionEventListener methods public interface XAConnection extends PooledConnection javax jta xa XAResource getXAResource throws SQLExcept
52. DbType AnsiString prm2 Direction ParameterDirection Input prm2 Value c2 57 NET Data Provider 4 2 Using the ALTIBASE HDB NET Data Provider prm2 ArrayBindSize 12 max element size in bytes cmd Parameters Add prm1 cmd Parameters Add prm2 execute Gf ER se E ee E E nn cmd ArrayBindCount arrayBindCount cmd ExecuteNonQuery IDataReader sDataReader null cmd Parameters Clear cmd CommandText select from tl sDataReader cmd ExecuteReader while sDataReader Read for int i 0 i lt sDataReader FieldCount i Console Write sDataReader GetValue i Console WriteLine sDataReader Close con Close con Dispose 4 2 3 Declaring the ALTIBASE HDB NET Data Provider In order to use the ALTIBASE HDB NET Data Provider classes it is first necessary to declare the ALTI BASE HDB NET Data Provider as shown below using Altibase Data AltibaseClient 4 2 4 Processing Transactions Transactions can be processed using the transaction processing interface provided with ADO NET To process transactions using the ADO NET interface use the AltibaseConnection BeginTransaction method and the AltibaseTransaction class AltibaseConnection sConn new AltibaseConnection sConnStr sConn Open Commencing a transaction AltibaseTransaction sTrans sConn BeginTransaction AltibaseCommand sCmd s
53. E Place the upper case character N in front of national character type character string con stants in SOL statements 1 5 2 1 Example create table t1 c1 nvarchar 1000 Properties sProps sProps put user SYS sProps put password MANAGER sProps put NcharLiteralReplace true Connection sCon DriverManager getConnection sURL sProps Statement sStmt sCon createStatement sStmt execute insert into t1 values N AB7 t ResultSet sRS sStmt executeQuery select from t1 where cl like N 7 2 SIN 9 JDBC 1 6 Setting up a Connection Pool 1 6 Setting up a Connection Pool A connection pool can be set up and managed in either of the following two ways Using ABConnectionPoolDataSource When connection pooling is used in a WAS Web Appli cation Server set this class to the JDBC connection pooling configuration option on the WAS Using ABPoolingDataSource In situations where a WAS is not being used use this class to manage a connection pool and obtain a PooledConnection from it These tasks are performed by the JDBC Driver This section includes the following topics Setting up a WAS Web Application Server Setting up the JDBC Driver 1 6 1 Setting up a WAS Web Application Server Some Web Application Servers support the creation of a connection pool using a GUI interface However in this section only the configuration method in which the configuration text fi
54. FLAGS axar2 start xid2 XAResource TMNOFLAGS Execute SQL operations using connl and conn2 doSomeWork1 conn1 doSomeWork2 conn2 END both the branches IMPORTANT axarl end xid1 XAResource TMSUCCESS axar2 end xid2 XAResource TMSUCCESS Prepare the RMs int prpl axarl prepare xid1 int prp2 axar2 prepare xid2 System out println Return value of prepare 1 is prpl System out println Return value of prepare 2 is prp2 boolean do_commit true if prpl XAResource XA OK prpl XAResource XA RDONLY do_commit false if prp2 XAResource XA OK prp2 XAResource XA RDONLY do_commit false System out println do commit is do commit System out printin Is axarl same as axar2 axarl isSameRM axar2 if prpl XAResource XA OK if do commit axarl commit xidi false else axarl rollback xid1 j if prp2 XAResource XA OK if do commit axar2 commit xid2 false else axar2 rollback xid2 Close connections conni close connl null conn2 close conn2 null pci close pci null pc2 close pe2 null Application Program Interface Users Manual 116 6 5 JDBC Distributed Transactions ResultSet rset stmta executeQuery select coll from my table while rset next System out println Col1 is rset getInt 1 rset close rset null rset stmtb executeQuery sele
55. It is responsible for commit ting and rolling back transactions and performing recovery The TM has a two phase commit Application Program Interface Users Manual 88 6 1 XA Interface engine to ensure that all of the RMs are consistent with each other Transaction Processing Monitor TPM A Transaction Processing Monitor TPM coordinates the flow of transaction requests from one or more APs see above for resources managed by one or more RMs see above The RMs can be heterogeneous and can be distributed across a network The TPM completes distributed transactions by coordinating commit and rollback operations The TM portion of the TPM is responsible for determining the timing of distributed commit and rollback operations that is the TPM is responsible for controlling two phase commit Because the TM manages distributed commit and rollback operations it must be aware of and able to communicate directly with all RMs The TM uses the XA interface for this In the case of ALTIBASE HDB the TM uses XA library functions of ALTIBASE HDB to control transaction pro cessing by ALTIBASE HDB e TX Interface An AP see above controls a transaction through the TM using the TX interface An AP does not use the XA interface directly APs are not aware of the operations of individual transaction branches and application threads do not participate directly in transaction branch tasks The branches of a global transaction are managed on be
56. LOBAL TX ID 9280 69 FAEDFAED 00000001 21315 69 FAEDFAED 00000002 2 rows selected iSOL COMMIT FORCE 69 FAEDFAED 00000002 Commit force success 6 6 3 Checking Heuristically Completed Transactions It is possible to check information about heuristically completed transactions A so called heuristi cally completed transaction is a transaction that is either committed or rolled back at the discretion of the RM after the RM fails to receive a transaction completion instruction such as commit or roll back from the TM for whatever reason If an in doubt transaction is forcibly committed or rolled back it is said to be a heuristically commit ted or heuristically rolled back transaction Information about this transaction will be visible in the SYS_XA_HEURISTIC_TRANS_ meta table To delete this information call xa_forget after the execution of xa_recover or execute remove xid 6 6 3 1 Example After the DBA commits an in doubt transaction information about the transaction is visible in the SYS XA HEURISTIC TRANS metatable iSQL gt SELECT FROM v dba 2pc pending V DBA 2PC PENDING LOCAL TRAN ID V DBA 2PC PENDING GLOBAL TX ID 100421 69 FAEDFAED 00000001 1 row selected iSQL gt COMMIT FORCe 69 FAEDFAED 00000001 Commit force success iSQL gt SELECT FROM system sys xa heuristic trans SYS XA HEURISTIC TRANS FORMAT ID SYS XA HEURISTIC TRANS GLOBAL TX ID SYS XA HEURISTIC TRANS BRANCH OUALIFIER 119 XA In
57. OMETRY Not Support INTEGER DBTYPE 4 NIBBLE Not Support NUMERIC DBTYPE STR DECIMAL DBTYPE STR REAL DBTYPE R4 SMALLINT DBTYPE 12 VARBIT DBTYPE BOOL VARCHAR DBTYPE STR Application Program Interface Users Manual 76 5 2 Installation The ALTIBASE HDB data types BLOB CLOB GEOMETRY and NIBBLE have no corresponding OLE DB types and thus cannot be accessed via OLE DB The BIT and VARBIT ALTIBASE HDB types are converted to the BOOL type in OLE DB The following table shows the ALTIBASE HDB data types to which OLE DB data types are mapped when using OLE DB to write to an Altibase database OLE DB ALTIBASE HDB DBTYPE 12 SMALLINT DBTYPE 14 INTEGER DBTYPE R4 REAL DBTYPE_R8 DOUBLE DBTYPE_CY BIGINT DBTYPE_UI1 SMALLINT DBTYPE 11 SMALLINT DBTYPE UI2 INTEGER DBTYPE_UI4 BIGINT DBTYPE_I8 BIGINT DBTYPE_UI8 BIGINT DBTYPE_BYTES BYTE DBTYPE_STR VARCHAR DBTYPE_WSTR VARCHAR DBTYPE_DBDATE DATE DBTYPE_DBTIME DATE DBTYPE_DBTIMESTAMP DATE Note To use a character string constant in an SQL statement when working with a national character set add the character N in front of the character string 77 OLE DB 5 3 Properties 5 3 Properties This section lists the properties in each property set that are currently supported by ALTIBASE HDB Property Set Description DBPROPSET DATASOURCEINFO These properties constitute a set of stati
58. TIBASE HDB in Perl make install In this example the ALTIBASE HDB DBD can be seen in the folder shown below opt perl 5 8 8 bin lib site perl 5 8 8 IA64 ARCHREV 0 auto DBD altibase 5 Make Additional Environment Settings Set the SLD PRELOAD environment variable This task must be performed on HP UX and certain other platforms On these platforms if this environment variable is not set an error message will be displayed 3 3 1 6 Test the ALTIBASE HDB Perl DBD Installation After starting the ALTIBASE HDB server change the values of the DSN and PORT_NO keyword value pairs in the test pl file to suitable values my dbh DBI gt connect dbi altibase DSN 127 0 0 1 UID SYS PWD MANAGER CONN TYPE 1 NLS USE US7ASCIT PORT NO 20999 HM MI RaiseError gt 1 Finally test the Perl installation by executing Perl on the test pl file perl test pl 49 PERL DBD DBI 3 3 Installing the ALTIBASE HDB DBD Application Program Interface Users Manual 50 4 NET Data Provider This chapter describes how to use Microsoft s ADO NET interface with ALTIBASE HDB 51 NET Data Provider 4 1 An Overview of the NET Data Provider 4 1 An Overview of the NET Data Provider 4 1 1 Overview The ALTIBASE HDB 5 NET Data Provider is an implementation of Microsoft s ADO NET interface for use with ALTIBASE HDB That is the ALTIBASE HDB 5 NET Data Provider is required in order for appli cations based on the NET Framework to be
59. TION READ ONLY Not allowed 103 XA Interface 6 4 Limitations when using XA 6 4 Limitations when using XA The use of XA is limited in the following ways Limitations on Use of SOL Limitations related to Transaction Branches No Support for Association Migration No Support for Asynchronous Calls No Support for Dynamic Registration 6 4 1 Limitations on Use of SQL 6 4 1 1 Rollback and Commit Because global transactions are managed by the TM the ALTIBASE HDB transaction control state ments COMMIT and ROLLBACK must not be used within an XA application to control global trans actions Instead tx commit and tx rollback must be used to complete global transactions This means that the EXEC SQL ROLLBACK and EXEC SQL COMMIT statements can t be used within appli cations authored using APRE Similarly SOLEndTran can t be used within an ODBCCLI application to commit or roll back a transaction 6 4 1 2 DDL Because DDL SQL statements are implicitly committed they can t be used within XA applications of ALTIBASE HDB 6 4 1 3 The AUTOCOMMIT Session Property Because global transactions execute in non autocommit mode the AUTOCOMMIT property can t be changed using the ALTER SESSION SET AUTOCOMMIT TRUE statement 6 4 1 4 SET TRANSACTION The ALTIBASEHDB SET TRANSACTION READ ONLY READ WRITE ISOLATION LEVEL data control statement can t be used within an XA application of ALTIBASE HDB 6 4 1 5 Connection o
60. This chapter describes how to install the JDBC driver of ALTIBASE HDB connect to ALTIBASE HDB using JDBC handle national character sets configure a connection pool and enable failover in a JDBC environment 1 JDBC 1 1 Installation 1 1 Installation 1 Download the Client package of ALTIBASE HDB from the Altibase Customer Support http support altibase com and install it 2 Copy the JDBC driver to the resource directory of each WAS Web Application Server If neces sary edit the configuration file for each WAS 1 1 1 Checking the JDBC Driver Version The following shows how to check the version of the JDBC and JDK driver that are currently being used java jar SALTIBASE HOME lib Altibase jar JDBC Driver Info Altibase Ver 6 1 1 1 for JavaVM v1 4 CMP 5 6 2 SRevi sion 14502 Mar 12 2012 17 45 32 1 1 2 JAVA Application Add the path and the filename Altibase jar to the CLASSPATH environment variable as shown in the following example export CLASSPATH CLASSPATH SALTIBASE HOME lib Altibase jar 1 1 3 Tomcat Copy the Altibase jar file to the STOMCAT HOME common lib directory STOMCAT HOME is the home directory for the Apache Tomcat installation so that all web applications will be able to use the JDBC driver of ALTIBASE HDB 1 1 4 WebLogic Copy the Altibase jar file to the SWL_HOME lib folder SWL_HOME is the home directory for the Weblogic installation In the startWebLogic sh script ad
61. Tomcat 2 1 1 4 WebLogic 2 ld PAUSE EE ee EG ee GE GE heee E EE OS 2 1 2 Using JDBC to Connect to ALTIBASE HDB rennes 3 1 2 1 ConnectionS quence smart nine ns as neren 3 1 3 Internet Protocol Version 6 IPV6 Support nee 6 1 3 1 Using IPv6 Addresses N N N EE EE 6 ERA el EO en nn AE OR ON rien a A nn tm it ten trie ent 6 1 4 Handling National Character Sets nine 8 14 1 Character Set Conversion eminente ande ned noten ee ee 8 VAD Settings in EE EO Oe EE EE OO den 8 1 5 Using National Character Sets in SQL with JDBC rene 9 1 5 1 Querying and Changing Data nn 9 1 5 2 Using Character String Constants ss es ER sg Ee eht be res 9 1 6 Setting up a Connection Pool oe EG ee ee Ge edere 10 1 6 1 Setting up a WAS Web Application Server rennes 10 1 6 2 S tting Up the JDBC Drive tt nanne ndr Es aA SES skede kke E Gene 12 1 7 JDBC 2 1 Core API and JDBC 2 0 Optional Package API nr 15 171 JDBC od de EE ss 15 1 7 2 java sql Package Support Status 15 1 7 3 javax sal package Support Status 35 1 7 4 javax transaction xa package Support Status 37 1 7 5 Data Size Consideration uses seen ee 37 1 8 JDBC Connection Failover 38 2 The PHP Interface 39 2 1 About the PHP Module of ALTIBASE HDB csssssssscssssssccssseccsssecssusecssnsesesssecessscecssecsssseecsssecessuscessuscessseesssusecssneesesuseessneesees 40 2 2 Installing the ODBC Manager for Integration With PHP nn 41 2 2 1 The ODBC Manager in Un
62. Tools Window Help IH Gda kaala JRA BE i a a ae E x MA Solution Exporer vax FP consoteapplicationt Program TE Maintatringl arg Be eel Eusing System od Solution ConsoleApplicationt 1 project There are no usable controls in this a i gh using System Col lect ions Generic N El consoleApplcationi group Drag an item onto this text to add Unie Syetan Lines E Eu Properties Cie using Systen Texts Se 5 Microsoft CSharp 3 System 2 Systern Core 3 System Data static void Main string args a System Data DataSetExtensions 3 System Xml Enanespace Conso leappl ication class Program 22 System ml Ling a C Add Reference Program cs NET COM projects Browse Recent RE AAC bib HE UR 28 ala adl pe Alibase Data Atibaseclient di Bj attiodbc all 3 altoledb dl Bi altiutl sill chin stall Ey dloader sd 8 ispapi sel odes dll Altibase Data AlbaseCient dll AT Component Files a dll stb 01b 0cx exe manifest z us Error List 1Q 0 Errors AA 0 Warnings i 0 Messages Description Une Column Projet 4 Build the project and execute the resulting executable file 4 2 2 Array Binding The ALTIBASE HDB NET Data Provider supports array binding that is binding data that are in the form of arrays to parameters Because this reduces the use of network resources when compared to the usual binding
63. Two Phase Commit The XA Interface of ALTIBASE HDB supports 2PC Two Phase Commit transaction processing Two phase commit comprises separate prepare and commit steps In the prepare step which is the first step of 2PC the TM queries all database nodes RMs participat ing in a distributed transaction to determine whether it is possible to commit the transaction If an individual RM is able to commit the transaction branch that has been assigned to it it sends a mes sage to the TM indicating that it is in a prepare state If however an RM is not able to commit its transaction branch it sends a corresponding message to the TM so that the transaction can be rolled back In the commit step which is the second step of 2PC the TM waits until it has received prepare acknowledgements from all RMs If it receives such acknowledgements from all RMs it sends an instruction to all RMs to commit the transaction However if there is even one RM that has not sent a prepare acknowledgement the TM sends an instruction to all RMs to roll back the transaction 6 1 4 xa switch _ t Structure Every RM has a switch that contains various information about the RM including its entry points This information is used by the TM The structure of an RM s switch is known as xa switch t In ALTIBASE HDB the name of the xa switch tisaltibase xa switch ltsstructureis as fol lows struct xa switch t char name RMNAMESZ nam
64. URL jdbc Altibase ip port dbname jdbc Altibase ip port dbname Application Program Interface Users Manual 110 6 5 JDBC Distributed Transactions NON XA XA Driver Classname Altibase jdbc driver AltibaseDriver Altibase jdbc driver ABXADataSource Properties User username User username Figure 6 7 Entering JDBC Connection Information workshop gt JDBC Connection Pools gt altixAPool Connected to localhost 7001 You are logged in as Configuration General Connections weblogic Logout This page allows you to define the general configuration of this JDBC connection pool Name altiXAPool The name of this JDBC connection pool amp URL jdbc Altibase 192 168 1 31 25226 The URL of the database to connect to The format of the URL varies by JDBC driver Driver Classname Alibase jdbc driver ABXADataSourd The full package name of JDBC driver class used to create the physical database connections in the connection pool Note that this driver class must be in the classpath of any server to which it is deployed A Properties user 5s The list of properties passed to the JDBC driver that are used to create physical database connections For example server dbserverl List each property value pair on a separate line amp Password Confirm Password The database account password used in the physical database connection Crea
65. UTING ODBC XA se csssssssasscisssvesenvusccnsderuuensssnansessissavnapoubescuseeapesnvonouscdvadsvuspavnasousscraacndoosctdessuasavaborbasotdietnendeitseenecdvaice 6 3 2 EXec ting APRE XA EE EE OE EE EE a E O 323 EXECUTING IDBE KA A rat Ee eden eneen Ges 6 3 4 XA Transaction Control 6 3 5 Changing an Existing Application into a TPM Application 6 4 Limitations when using XA uses 6 4 1 Limitations on Use of SQL nn 104 6 4 2 Limitations related to Transaction Branches me 105 6 4 3 No Support for Association Migration 105 6 4 4 No Support for Asynchronous Calls rennes 6 4 5 No Support for Dynamic Registration 6 4 6 Server dk ele ii EE 6 5 JDBC Distributed Transactions uses see seen eek ee eke ee ek eek ee ee ek eek ee reiia ee Re Re Rek eek ee ee Re Re ee ek Rek ee Rek ek ee 107 6 5 1 JTA Java Transaction API and Application Server een 107 6 5 2 XA Components sneden ddr deet LNA Eden 107 6 5 3 Error Handling dede eenden 110 6 5 4 Making XA Settings in Application Servers rennes 110 6 5 5Exampl morenen seerde de tranen Ee EE Ge Ge sn s ness assen 114 6 6 How to Solve Problems of Application Using XA aaan nn 118 6 6 1 Checking XA Tracking Information sn 118 6 6 2 Processing In doubt Transactions sense 118 6 6 3 Checking Heuristically Completed Transactions sn 119 7 The iloader APIs nice eed is ge oge See ge dee ie doe oe sak ce eo be sre d cris nest ed Ge ons esta de etes 121 ZV Overvi
66. able to access ALTIBASE HDB The ADO NET interface uses the NET Framework to access data sources such as DBMS The NET Framework already supports the ODBC and OLEDB interfaces and provides methods for accessing SQL Server and Oracle The role of a NET Framework based Data Provider is to access data sources execute commands and return the results Developers use the ADO NET DataSet class to process results returned in this way and to write data to the data sources The biggest advantage of the ADO NET interface is that when ALTIBASE HDB is upgraded the Data Provider and client applications can continue to be used without having to change them as long as the CLI library is also upgraded to match the new version of ALTIBASE HDB For more information on ADO NET please refer to the Microsoft website http www msdn com 4 1 2 Requirements NET Framework The NET Framework must be installed Additionally the version of the NET Framework must be compatible with the version of ADO NET that is being used For example if ADO NET 1 0 is being used the version of the NET Framework must be version 1 1 or a subsequent release If using ADO NET 2 0 the version of the NET Framework must be version 2 0 SP1 or a subsequent release Different NET Data Provider library files are provided for different versions of ADO NET and thus it is essential that you use a version of the library that is suitable for the version of ADO NET to be used
67. ally a distributed transaction e Heuristic Completion In some situations when an RM does not receive an expected command pertaining to an in doubt transaction such as a COMMIT command or the like the RM proceeds to commit or roll back the transaction of its own accord Completion of transactions in this way is referred to as Heuristic Commit or Heuristic Rollback or collectively as Heuristic Completion Typical causes are network failure and transaction timeouts In doubt Transaction An in doubt transaction is a transaction branch that has been prepared on an RM i e DBMS and for which a commit or rollback message has not yet been received It is also known as a pending transaction Resource Manager RM A Resource Manager RM controls a resource that is accessed by an XA transaction It must be possible to restore the resource to its original state in the event of a failure An RM can be for example a relational database a transactional queue or a file system Transaction Branch A transaction branch is essentially a sub transaction that is part of the global transaction It is executed on one of the Resource Managers see above participating in the global transaction There is a one to one relationship between a transaction branch and a so called XID i e a Transaction ID in XA parlance Transaction Manager TM A transaction manager provides an API that defines a transaction
68. alue of ArrayBindSize an error occurs When working with the NCHAR and NVARCHAR i e Unicode character data types the value of the ArrayBindSize property is the number of characters not bytes For arrays of BLOB type data handle the array within the application as an object and each array element as a bytel Ex byte vari bytel var2 Object var new Object 2 vari var2 e Array binding is not supported for CLOB BYTE NIBBLE BIT VARBIT and GEOMETRY type arrays 4 2 2 2 Example using System using System Data using Altibase Data AltibaseClient class ArrayBind static void Main AltibaseConnection con new AltibaseConnection con ConnectionString DSN 127 0 0 1 UID sys PWD man ager NLS USE KO16KSC5601 con Open Console WriteLine Connected successfully const int arrayBindCount 3 int cl new int arrayBindCount 100 200 300 String c2 new Stringl arrayBindCount APPLE ORANGE GRAPE AltibaseCommand cmd new AltibaseCommand cmd Connection con table info orange needs 12 bytes utf16 create table t1 cl int c2 varchar 12 Yop ae MEI EA EE ee NET EEN EA bind parameters RA sie aR EE EN cmd CommandText insert into tl values AltibaseParameter prml new AltibaseParameter cl1 DbType Int32 prml Direction ParameterDirection Input prml Value cl AltibaseParameter prm2 new AltibaseParameter c2
69. an sPreStmt setString 2 Davenport sPreStmt setInt SZ es sPreStmt execute sPreStmt setString 1 Ken sPreStmt setString 2 Kobain sPreStmt setInt eae A sPreStmt execute sPreStmt setString 1 Aaron sPreStmt setString 2 Foster sPreStmt setInt 3 4 sPreStmt execute sPreStmt setString 1 Farhad sPreStmt setString 2 Ghorbani sPreStmt setInt 3 5 E sPreStmt execute Application Program Interface Users Manual 4 1 2 Using JDBC to Connect to ALTIBASE HDB sPreStmt setString 1 Ryu sPreStmt setString 2 Momoi sPreStmt setInt 3 6 sPreStmt execute sRS sStmt executeQuery SELECT EMP FIRST EMP LAST EMP NO FROM TEST EMP TBL Fetch all data while sRS next System out println EmpName sRS getString 1 nm SRS getString 2 System out printlin EmpNO SRS getInt 3 Finalize process sStmt close sPreStmt close sCon close catch SQLException e System out println ERROR CODE M e getErrorCode System out println ERROR MESSAGE e getMessage e printStackTrace The sample program is executed as follows javac SimpleSOL java java EE EA 20300 EmpName Susan Davenport EmpNO 5 2 EmpName Ken Kobain EmpNO x 3 EmpName Aaron Foster EmpNO 2A EmpName Farhad Ghorbani EmpNO 45 EmpName Ryu Momoi EmpNO s6 5 JDBC 1
70. an onePhase void rollback Xid xid public void forget Xid xid public Xid recover int flag For more detailed information please refer to the description of the javax transaction xa XAResource class in the Java API Specifications 6 5 2 4 The Xid interface The TM creates instances of the Xid interface and uses them to coordinate the branches of a distrib uted transaction Each transaction branch is assigned a unique transaction ID which includes the following information Format identifier Global transaction identifier Branch qualifier In ALTIBASE HDB the javax transaction xa Xid interface is implemented as the XID class in the Alti base jdbc driver package Note Altibase jdbc driver XID does not need to be used to make ABXAResource calls Any class in which the javax transaction xa Xid interface is implemented can be used for this 6 5 3 Error Handling When errors occur XA related methods throw the ABXAException class The ABXAException class is a subclass of the javax transaction xa XAException class 6 5 4 Making XA Settings in Application Servers 6 5 4 1 Making XA Settings in WebLogic 1 Inthe WebLogic console expand Services gt JDBC gt Connection Pools gt Configure a new JDBC Connection Pool and then enter the required JDBC connection information The required information is shown in Figure 6 7 Table 6 4 Connection Information for Non XA and XA Environments NON XA XA
71. ase check server final frees all resources associated with the specified Check Server handle Additionally this function removes the checkserver pid file which was created when altibase check server was called If the application using the CheckServer API is termi nated abnormally using a command such as kil1 the checkserver pid file may be left in the file system In this case it will be necessary to manually delete the file before it will be possible to run the CheckServer utility or for the application that uses the CheckServer API to call altibase check server 8 4 2 5 Related Functions altibase check server init 8 4 2 6 Example See altibase check server 8 4 3 altibase check server init This function allocates a CheckServer handle 8 4 3 1 Syntax int altibase check server init ALTIBASE CHECK SERVER HANDLE handle char home dir 149 The CheckServer API 8 4 The CheckServer API 8 4 3 2 Arguments Argument In Out Description handle Output This is a pointer to a buffer in which the handle to the newly allocated data structure is returned home dir Input This must be set to the SALTIBASE HOME directory 8 4 3 3 Return Values ALTIBASE CS SUCCESS or ALTIBASE CS ERROR 8 4 3 4 Description This function allocates memory for information related to CheckServer and passes a pointer to this memory back in handle Only one ALTIBASE HDB server can be monitored by one
72. ata O ParameterMetaData getParameterMetaData O void setArray int i Array x X void setAsciiStream int parameterlndex InputStream x int O length void setBigDecimal int parameterlndex BigDecimal x O void setBinaryStream int parameterlndex InputStream x int O length void setBlob int i Blob x O void setBoolean int parameterlndex Boolean x O void setByte int parameterlndex byte x O void setBytes int parameterlndex bytel x O void setCharacterStream int parameterlndex Reader reader O int length void setClob int i Clob x O void setDate int parameterlndex Date x O void setDate int parameterlndex Date x Calendar cal A void setDouble int parameterlndex double x O void setFloat int parameterlndex float x O void setint int parameterlndex int x O void setLong int parameterindex long x O Application Program Interface Users Manual 30 1 7 JDBC 2 1 Core API and JDBC 2 0 Optional Package API Return Type Function Name Support void setNull int parameterlndex int sqlType O Void setNull int paramlndex int salType String typeName O Void setObject int parameterlndex Object x O Void setObject int parameterlndex Object x int targetSql O Type Void setObject int parameterlndex Object x int targetSql O Type int scale void setRef int i Ref x X void setShort int parameterlndex short x O void se
73. axi mum length is 256 bytes It has the same format as the parameters to the SOLDriverConnect function and has the additional parameters XA_NAME and XA LOG DIR For detailed information about the other parameters please refer to the description of the SOLDriverConnect function in the ODBC Reference NAME value NAME value NAME value Example DSN 127 0 0 1 UID SYS PWD MANAGER XA NAME conn1 Application Program Interface Users Manual 92 6 2 The XA Interface Table 6 2 Additional XA Interface Parameters XA Parameter Description XA NAME This is the name that is used by the ALTIBASE HDB Precompiler to identify the connection If this value is omitted when writing an application with the ALTI BASE HDB Precompiler the default connection will be used If a name is speci fied here it can be used in the AT clause of a subsequently executed SQL statement This value is specified in this way XA NAME conn1 XA LOG DIR This is used to specify the directory in which information about ALTIBASE HDB XA library errors is logged If the SALTIBASE HOME environment variable has been set then the default value of XA LOG DIR is SALTIBASE_HOME trc If SALTIBASE HOME has not been set the default is the current directory rmid is used to specify an identifier for the server to be accessed This can be set to any arbitrary value If flags is not set to any other value it must be set to the following value TMNOFLAGS
74. ble 2 The port number in db php the sample program must be changed so that it matches the port number that is actually being used on the ALTIBASE HDB server Application Program Interface Users Manual 40 2 2 Installing the ODBC Manager for Integration with PHP 2 2 Installing the ODBC Manager for Integration with PHP In order to integrate ALTIBASE HDB with a PHP server the ODBC Manager must be installed This sec tion describes how to install the ODBC Manager in Unix Linux and Windows environments 2 2 1 The ODBC Manager in Unix and Linux In a Unix or Linux environment complete the following steps to install the ODBC Manager 1 Download unixODBC It can be downloaded from the unixODBC website http www unixodbc org Install unixODBC After downloading the unixODBC source files it is necessary to compile unixODBC Move the source files to the desired location and run the following commands from a command prompt configure prefix installation path enable gui no enable drivers no make make install Configure the unixODBC environment a Set the SODBCSYSINI environment variable Set its value to the same value as the SHOME environment variable for the user that was used to install ALTIBASE HDB export ODBCSYSINI b Add an environment variable indicating the path where the unixODBC Driver Manager is installed as shown below Depending on the platform and whether the OS is a 32 bit or 64 bit OS the libra
75. c information about the data source DBPROPSET_DBINIT These properties are used to initialize the data source DBPROPSET_OGIS_SPATIAL_OPS These properties describe OpenGIS spatial data DBPROPSET_ROWSET These properties describe rowsets DBPROPSET_SESSION These properties describe sessions The specific properties within each property set that are currently supported by ALTIBASE HDB are listed in the tables that follow The following table summarizes the OLE DB properties in the DBPROPSET_ DATASOURCEINFO prop erty set that are currently supported by ALTIBASE HDB Property State Initial Value DBPROP_ACTIVESESSIONS Read Only 0 DBPROP_BYREFACCESSORS Read Only VARIANT_FALSE DBPROP_CONNECTIONSTATUS Read Only DBPROPVAL_CS_COMMUNICATIONFAIL URE DBPROP_DATASOURCENAME Read Only This should be set at run time DBPROP_DATASOURCEREADONLY Read Only VARIANT_TRUE DBPROP_DBMSNAME Read Only This should be set at run time DBPROP_DBMSVER Read Only This should be set at run time DBPROP_DSOTHREADMODEL Read Only DBPROPVAL_RT_FREETHREAD DBPROP_MAXTABLESINSELECT Read Only 32 DBPROP_MULTIPLERESULTS Read Only DBPROPVAL_MR_SUPPORTED DBPROP_MULTIPLESTORAGEOBJECTS Read Only VARIANT_TRUE DBPROP_OLEOBJECTS Read Only DBPROPVAL_OO_BLOB DBPROPVAL_OO_SINGLETON Application Program Interface Users Manual 78 5 3 Properties Prope
76. can execute global transactions and ax routines which allow the RMs to make requests to the TM Note Because ALTIBASE HDB does not support dynamic registration each RM Altibase database must be called with xa_ start before the start of a transaction un In ALTIBASE HDB the XA related functions are provided in altibase xa switch which is ALTI BASE HDB s implementation of xa switch t Table 6 1 XA Interface XA Interface Description Xa open This is used to connect to an RM xa close This is used to close a connection with an RM xa start This is used to start a new transaction branch or restart an existing one and to link the branch to a given XID xa end This is used to end an association with a transaction branch xa_rollback This is used to roll back a transaction branch corresponding to a given XID xa_prepare This is used to prepare a transaction branch to be committed xa_commit This is used to commit a transaction branch xa_recover This is used to show a list of XIDs corresponding to transactions that have been prepared heuristically committed or heuristically rolled back xa_forget This is used to instruct an RM to discard information about a heuristically com pleted transaction branch This is used to connect to an RM int xa open char xa info int rmid long flags xa_infois a null terminated character string that contains information about the server Its m
77. ck the status of the ALTIBASE HDB Perl DBD 45 PERL DBD DBI 3 1 Overview of the Perl DBD and DBI 3 1 Overview of the Perl DBD and DBI A Perl DBI Database Interface is a database API written in the form of a PERL5 module This module defines a series of methods and attributes for accessing a database for which a DBD Database Driver has been created This DBD is also available in the form of a PERL5 module The DBI enables an application to access various databases via respective DBDs The entity that actu ally handles communication with the database is the DBD The DBD driver of ALTIBASE HDB is called DBD altibase The available attributes and methods are classified as either database attributes and methods or statement attributes and methods DBD I I ee oem ee Do Altibase rece DB2 mysql Application Program Interface Users Manual 46 3 2 Perl Package Installation 3 2 Perl Package Installation 3 2 1 The Perl Package Installation Procedure 1 Download the Perl package that is suitable for the OS on which the server is running For example the Perl package for SunOS can be downloaded from http www sunfreeware com a Uncompress the package e g perl 5 8 5 tar gz in the desired directory gzip cd perl 5 8 5 tar gz tar xvf Execute the configure command in the directory in which the Perl package was uncompressed configure Execute the make command in the directory in which the
78. ct coll from my tab while rset next System out printin Coll is rset getString 1 rset close rset null stmta close stmta null stmtb close 1 stmtb null conna close conna null connb close connb null catch SQLException sqe 1 sgqe printStackTrace catch XAException xae System out println XA Error is xae getMessage static Xid createXid int bids throws XAException bytel gid new byte 1 gid 0 byte bid new byte 1 bid 0 byte gtrid new byte 4 byte bqual new byte 4 System arraycopy gid 0 gtrid 0 1 System arraycopy bid 0 bqual 0 1 Xid xid new XID 0x1234 gtrid bgual return xid byte 9 byte bids private static void doSomeWork1 Connection conn throws SQLException String sql Statement stmt conn createStatement sql insert into my table values 1 stmt executeUpdate sql stmt close private static void doSomeWork2 Connection conn throws SQLException String sql Statement stmt conn createStatement sql insert into my tab values test stmt executeUpdate sql stmt close 117 XA Interface 6 6 How to Solve Problems of Application Using XA 6 6 How to Solve Problems of Application Using XA This section explains how to determine the cause of any XA related errors that may arise 6 6 1 Checking XA Tracking Information The XA libra
79. d the path to the Altibase jar file to CLASS PATH 1 1 5 Jeus Copy the Altibase jar file to the SJEUS HOME lib datasource folder SJEUS HOME is the home directory for the Jeus installation Application Program Interface Users Manual 2 1 2 Using JDBC to Connect to ALTIBASE HDB 1 2 Using JDBC to Connect to ALTIBASE HDB 1 2 1 Connection Seduence 1 Loading the Driver Load the JDBC driver of ALTIBASE HDB Class forName Altibase jdbc driver AltibaseDriver Here there is no need to use the DriverManager to create and register an instance of the driver When the driver is loaded using the call to Class forName as shown above an instance of the driver is created and registered automatically Loading the driver in this way makes it possible to connect to ALTIBASE HDB Connecting to a Database When connecting use the database URL format that is supported by the JDBC driver of ALTI BASE HDB The Database URL format for JDBC Driver of ALTIBASE HDB when connecting via TCP IP is jdbc Altibase server_ip server_port dbname server ip can be a host name an IPv4 address or an IPv6 address For more information about IPv6 please refer to Internet Protocol Version 6 IPv6 Support 1 2 1 1 Example The following is a sample JDBC program that illustrates how to connect to an Altibase database It can be found at ALTIBASE_HOME sample JDBC SimpleSQL SimpleSQL java import java util Properties import java sq
80. der 9 10 Start transaction branch 1 Start transaction branch 2 Execute DML operations on branch 1 Execute DML operations on branch 2 End transaction branch 1 End transaction branch 2 Prepare branch 1 Prepare branch 2 Commit branch 1 Commit branch 2 import java sql import javax sql import Altibase jdbc driver import javax transaction xa class XA4 public static void main String args throws SQLException try String URL1 jdbc Altibase localhost 25226 mydb You can put a database name after the sign in the connection URL String URL2 jdbc Altibase localhost 25226 mydb Create first DataSource and get connection Altibase jdbc driver DataSource adsl new Altibase jdbc driver DataSource ads1 setUrl URL1 ads1 setUser SYS ads1 setPassword MANAGER Connection conna adsl getConnection Application Program Interface Users Manual 114 6 5 JDBC Distributed Transactions Create second DataSource and get connection Altibase jdbc driver DataSource ads2 new Altibase jdbc driver DataSource ads2 setUrl URL2 ads2 setUser SYS ads2 setPassword MANAGER Connection connb ads2 getConnection Prepare a statement to create a table Statement stmta conna createStatement Prepare a statement to create a table Statement stmtb connb createStatement try Drop the test table s
81. e O long getLong int columnindex O long getLong String columnName O ResultSetMetaData getMetaData O Object getObject int columnindex O Object getObject int i Map map X Object getObject String columnName O Application Program Interface Users Manual 24 1 7 JDBC 2 1 Core API and JDBC 2 0 Optional Package API Return Function Name Support Object getObject String colName Map map X Ref getRef int i X Ref getRef String colName X int getRow O short getShort int columnindex O short getShort String columnName O Statement getStatement O String getString int columnindex O String getString String columnName O Time getTime int columnindex O Time getTime int columnindex Calendar cal A Time getTime String columnName O Time getTime String columnName Calendar cal A Timestamp getTimestamp int columnindex O Timestamp getTimestamp int columnindex Calendar cal A Timestamp getTimestamp String columnName O Timestamp getTimestamp String columnName Calendar cal A int getTypel O InputStream getUnicodeStream int columnindex X InputStream getUnicodeStream String columnName X URL getURL int columnindex X URL getURL String columnName X SOLWarning getWarnings O void insertRow X boolean isAfterLast O boolean isBeforeFirst O boolean isFirst O boolean isLast O boolean last O void moveToCurrentRow O void
82. e CheckServer API at the same time will cause application errors Application Program Interface User s Manual 144 8 2 Using the CheckServer API 8 2 Using the CheckServer API 8 2 1 Header File SALTIBASE HOME include chksvr h 8 2 2 The CheckServer Libraries The library files that are required in order for applications to use the CheckServer API reside in the SALTIBASE HOME 1ib directory Ensure that applications are always linked with the following libraries UNIX libchksvr a libaltiutil a Windows chksvr lib libaltiutil lib 8 2 3 Samples Sample applications that use the CheckServer API can be found in the SALTIBASE HOME sam ple CHECKSERVER directory 145 The CheckServer API 8 3 CheckServer API Data Structure 8 3 CheckServer API Data Structure This section describes the C type that is made available to applications that use the CheckServer API 8 3 1 The CheckServer Handle The CheckServer handle is an opaque data structure that is defined in the CheckServer API library It is used to store information pertaining to the behavior of applications that use the CheckServer API ALTIBASE CHECK SERVER HANDLE This is the CheckServer handle The CheckServer handle is primarily used when monitoring an ALTIBASE HDB server The CheckServer handle is allocated with altibase check server init and freed with altibase check server final Application Program Interface User s Manual 146 8 4 The CheckServer API
83. e datafiles and set the totalCount member in the ALTIBASE ILOADER STATISTIC LOG structure to this number when uploading data It can be either ILO TRUE or LO FALSE The default value is ILO FALSE setRowFrequency The user callback function is called every time the number of rows specified here is uploaded or downloaded The default value is 0 If this value is set to 0 the callback function is never called typedef enum ILO FALSE 0 false ILO TRUE 1 true iloBool typedef enum ILO APPEND ILO REPLACE ILO TRUNCATE iloLoadMode typedef enum LO DIRECT NONE LO DIRECT LOG LO DIRECT NOLOG iloDirectMode typedef enum HHH ILO_LOG ILO STATISTIC LOG ALTIBASE ILOADER LOG TYPE Application Program Interface User s Manual 128 7 4 The iLoader API This section describes each of the functions in the iLoader API The following information is provided for each function The name and purpose of the function The function syntax A list of arguments for the function The function s return values Diagnostics for the function Notes related to use of the function A list of related functions An example of use of the function in code 7 4 1 altibase iloader datain This function is used to upload data into a database table 7 4 1 1 Syntax 7 4 The iLoader API int altibase iloader datain ALTIBASE ILOADER HANDLE handle int void version op
84. e iLoader handle is allocated with altibase iloader init and freed with altibase iloader final 7 3 2 Error Structure ALTIBASE_ILOADER_ERROR This structure is used to store information for diagnosing errors that occur during the execu tion of an application that was written using the iLoader API This structure is defined as follows typedef struct ALTIBASE ILOADER ERROR int errorCode Error Code char errorState SQLSTATE Code char errorMessage Error Message ALTIBASE ILOADER ERROR 7 3 3 Log Structure The iLoader API provides the following two structures for use in logging the progress of an iLoader task Application Program Interface User s Manual 124 ALTIBASE ILOADER LOG 7 3 iLoader API Data Structures This structure is passed to an application s callback function every time an error occurs during the execution of an iLoader task It is also passed to a callback function upon completion of an iLoader task At this time the record recordData recordColCount and errorMgr members are not passed The purpose of this structure is to report errors that occur during the execution of an iLoader task and to provide information about the results of execution of a task This structure is defined as follows typedef struct ALTIBASE ILOADER LOG char tableName 50 int totalCount int loadCount int errorCount int record char r
85. e iloader datain amp handle ALTIBASE ILOADER V1 opt print callback amp err 141 The iLoader API 7 4 The iLoader API Application Program Interface User s Manual 142 8 The CheckServer API The CheckServer API 8 1 Overview of the CheckServer API 8 1 Overview of the CheckServer API The CheckServer API of ALTIBASE HDB is an application programming interface for creating applica tions that use function calls to monitor whether the ALTIBASE HDB server has terminated abnor mally The CheckServer API provides the same functionality as the CheckServer utility For more information about the CheckServer utility please refer to the ALTIBASE HDB Utilities Manual The following table summarizes the CheckServer API functions Function Name Purpose altibase check server init This function allocates a CheckServer handle altibase check server final This function frees a handle and all associated resources altibase check server This function monitors whether an ALTIBASE HDB server has terminated abnormally altibase check server cancel This function is used to terminate the execution of Check Server 8 1 1 Restrictions The CheckServer API does not support multi threaded programs An application that uses the CheckServer API can only be used to monitor an Altibase data base server on the local host i e on the same machine as the application Running two or more applications that use th
86. e of resource manager long flags resource manager specific options long version must be 0 int xa open entry char int long xa open fn pointer int xa close entry char int long xa close fn pointer int xa start entry XID int long xa start fn pointer int xa end entry XID int long xa end fn pointer int xa rollback entry XID int long xa rollback fn pointer int xa prepare entry XID int long xa prepare fn pointer int xa commit entry XID int long xa commit fn pointer int xa recover entry XID long int long xa recover fn pointer int xa forget entry XID int long xa forget fn pointer int xa complete entry int int int long xa complete fn pointer 1 Application Program Interface Users Manual 90 6 1 XA Interface 6 1 5 The XA Library No additional library is required in order for applications to connect to ALTIBASE HDB using the ALTI BASE HDB XA The required functionality is included in the odbccli library All that is needed in order to use the XA related functionality with ALTIBASE HDB is to link the XA dependent applications with the libodbccli a library file 91 XA Interface 6 2 The XA Interface 6 2 The XA Interface The XA Interface is the two way interface that sits between the TM and the RMs This interface consists of xa routines which the TM uses to control RMs so that it
87. e row object cotype is defined as follows CoType TRow interface interface interface interface interface IColumnsInfo IConvertType IGetSession TRow ISupportErrorInfo 5 4 7 The Error Object The error object cotype is defined as follows CoType TError interface IErrorInfo 83 5 4 The OLE DB Interfaces OLE DB 5 4 The OLE DB Interfaces 5 4 8 The Custom Error Object The custom error object cotype is defined as follows CoType TCustomError interface ISOLErrorinfo Application Program Interface Users Manual 84 5 5 Examples 5 5 Examples 5 5 1 ADO Example Dim adoRst Dim adoCnn Dim rsAddRtn Dim strSQL Dim strCnnStr Dim a b c strSQL SELECT FROM T1 WScript StdOut Write Program Start WScript StdOut WriteBlankLines 1 set adoCnn CreateObject ADODB Connection set adoRst CreateObject ADODB Recordset adoRst cursorlocation 3 This indicates to access adoCnn Open Provider Altibase OLEDB Data Source altibase odbc This indicates to output records adoRst Open strSQL adoCnn For a 0 To adoRst RecordCount 1 b adoRst Fields 0 c adoRst Fields 1 WScript StdOut Write b WScript StdOut WriteBlankLines 1 WScript StdOut Write c WScript StdOut WriteBlankLines 1 adoRst MoveNext Next WScript StdOut Write adoRst RecordCount WScript StdOut WriteBlankLines 1 adoRst Close 5 5 2 ADO NET Example using System using System Text u
88. e server the driver obtains information about the character set that is in use on the database server and then internally converts strings in java programs from UTF16 to the character set being used on the server UTF16 Java String lt gt Altibase Server DB Character Set 1 4 2 Settings in JSP Place a line of text that indicates the national character set at the top of JSP pages In the following example the Korean character set euc kr is specified lt page contentType text html charset euc kr gt The following command is usually executed in order for Korean characters to be properly handled in JSP and Servlet programs request setCharacterEncoding KSC5601 Application Program Interface Users Manual 8 1 5 Using National Character Sets in SOL with JDBC 1 5 Using National Character Sets in SOL with JDBC This section describes how to handle national character types that is Unicode types such as the NCHAR and NVARCHAR character types in JDBC 1 5 1 Querying and Changing Data In JDBC NCHAR and NVARCHAR type data can be gueried and updated in the same way that CHAR and VARCHAR type data are That is methods such as getString and setString can be used nor mally 1 5 2 Using Character String Constants How to use character string constants with national character types in SOL statements is explained below When connecting to the server set the value of the NcharLiteralReplace property to TRU
89. eader dr command ExecuteReader Console WriteLine GNO GNAME LOCATION STOCK PRICE Console WriteLine while dr Read for int i 0 i lt dr FieldCount i Console Write t o drlil This outputs the retrieved data Console WriteLine catch Exception ex Application Program Interface Users Manual 66 Console WriteLine ex ToString 4 4 NET Data Provider Example conn Close This closes the connection to the database Execution Results GNO GNAME LOCATION STOCK PRICE A111100001 IM 300 A111100002 IM 310 B111100001 NT H5000 AC0001 1000 DDOOO1 100 AC0002 780 67 78000 98000 35800 NET Data Provider 4 4 NET Data Provider Example Application Program Interface Users Manual 68 9 OLE DB This chapter describes current support of ALTIBASE HDB for OLE DB It explains how to install and uninstall OLE DB and how to use OLE DB to access data in a variety of environments such as ADO ADO NET etc This chapter also explains the data types and properties that are supported in ALTI BASE HDB for use with OLE DB 69 OLE DB 5 1 Overview of OLE DB 5 1 Overview of OLE DB OLE DB Object Linking and Embedding Database is an open interface developed by Microsoft for accessing a wide variety of data sources Although a universal database access API already exists in the form of ODBC it is limited in its ability to supp
90. ecordData int recordColCount ALTIBASE ILOADER ERROR errorMgr ALTIBASE ILOADER LOG Member Description tableName This is the name of the table being uploaded or down loaded totalCount This is the total number of rows for which an upload or download attempt has been made loadCount This is the total number of rows that have been success fully uploaded or downloaded errorCount This is the number of rows that could not be uploaded or downloaded due to the occurrence of an error Note that when an error occurs this count does not include the current error That is it is a count of all errors preceding the current error record When an error occurs this indicates the position of the record that could not be uploaded or downloaded recordData When an error occurs this is the data stored in the record that could not be uploaded or downloaded recordColCount When an error occurs this is the number of columns in the record that could not be uploaded or downloaded errorMgr When an error occurs this is an error structure that con tains information about the error ALTIBASE ILOADER STATISTIC LOG 125 The iLoader API 7 3 iLoader API Data Structures This structure is periodically passed to an application s callback function during the execution of an iLoader task The frequency with which it is passed is determined by the setRowFre quency option in the Option Structure This structure is used to pass statistics about the
91. ed this function will be nonresponsive until an error occurs until it is detected that the ALTIBASE HDB server is shutting down or until altibase check server cancel is called 8 4 1 5 Related Functions altibase check server init altibas check server final altibase check server cancel 8 4 1 6 Example int main ALTIBASE CHECK SERVER HANDLE handle ALTIBASE CHECK SERVER NULL HANDLE char homeDir NULL int rc rc altibase check server init amp handle homeDir if rc ALTIBASE CS SUCCESS rc altibase check server handle printf altibase check server init failed d n re if rc ALTIBASE CS SERVER STOPED else if handle ALTIBASE CHECK SERVER NULL HANDLE return 0 printf Server stopped n printf An error has occured d n re altibase check server final amp handle 8 4 2 altibase check server final This function frees a handle and all associated resources 8 4 2 1 Syntax int altibase check server final ALTIBASE CHECK SERVER HANDLE handle Application Program Interface User s Manual 148 8 4 The CheckServer API 8 4 2 2 Arguments Argument In Out Description handle Input This is the pointer to the CheckServer handle to be freed 8 4 2 3 Return Values ALTIBASE CS SUCCESS ALTIBASE CS ERROR 8 4 2 4 Description or ALTIBASE CS INVALID HANDLE altib
92. element comprised of options ASC DESC Indicates an optional element in which multiple elements may be specified A comma must precede all but the first element ASC DESC CN y The code examples explain SQL statements stored procedures iSQL statements and other com mand line syntax The following table describes the printing conventions used in the code examples Application Program Interface Users Manual iv Convention Meaning Example Indicates an optional item VARCHAR size FIXED VARIABLE Indicates a mandatory field for ENABLE DISABLE COMPILE which one or more items must be selected A delimiter between optional or mandatory arguments ENABLE DISABLE COMPILE ENABLE DISABLE COMPILE Indicates that the previous argu ment is repeated or that sample code has been omitted iSQL gt select e lastname from employees E LASTNAME Moon Davenport Kobain 20 rows selected Other symbols Symbols other than those shown above are part of the actual code EXEC pl 1 acc NUMBER 11 2 Italics Statement elements in italics indi cate variables and special values specified by the user SELECT FROM table_name CONNECT userID password Lower Case Let Indicate program elements set by ters the user
93. encoding utf 8 gt lt configuration gt lt system data gt lt DbProviderFactories gt lt remove invariant Altibase Data AltibaseClient gt Application Program Interface Users Manual 62 4 3 Interface Settings for NET Data Provider lt add name Altibase Data Provider invariant Altibase Data AltibaseClient description Altibase Data Provider type Altibase Data AltibaseClient AltibaseFactory Alti base Data AltibaseClient gt lt DbProviderFactories gt lt system data gt lt configuration gt Depending on the version of ADO NET there are certain interfaces that are not supported for use with ALTIBASE HDB These are listed in detail in the following two tables Any attempt to use an unsupported component will incur a NotlmplementedException Class Identification Component AltibaseConnection M ChangeDatabase M Clone P Database AltibaseCommand M Cancel M Clone P CommandTimeout P CommandType AltibaseDataReader M GetData P Depth AltibaseParameter M Clone AltibaseParameterCollection M AddRange M Method P Property A All the class AltibaseDataReader Depth always returns 0 The interfaces that are not supported in ADO NET 1 X are not supported in ADO NET 2 0 either 63 NET Data Provider 4 3 Interface Settings for NET Data Provider Class Identification Component
94. er String password O void setLoginTimeout int seconds A void setLogWriter PrintWriter out O Return Type Function Name Support Connection getConnection O Connection getConnection String username String password O int getLoginTimeout A PrintWriter getLogWriter O 35 JDBC 1 7 JDBC 2 1 Core API and JDBC 2 0 Optional Package API Return Type Function Name Support void setLoginTimeout int seconds void setLogWriter PrintWriter out Return Type Function Name Support void addConnectionEventListener ConnectionEventLis O tener listener void close Connection getConnection void removeConnectionEventListener ConnectionEventList ener listener Return Type Function Name Support XAResource getXAResource O Return Type Function Name Support int getLoginTimeout A PrintWriter getLogWriter O XAConnection getXAConnection O XAConnection getXAConnection String user String password O void setLoginTimeout int seconds A void setLogWriter PrintWriter out O Application Program Interface Users Manual 36 1 7 JDBC 2 1 Core API and JDBC 2 0 Optional Package API Return Type Function Name Support void commit Xid xid Boolean onePhase O void end Xid xid int flags O void forget Xid xid O int getTransactionTimeout O boolean isSameRM XAResource
95. er to connect to an Altibase database The data source object cotype is defined as follows CoType TDataSource interface IDBCreateSession interface IDBInitialize interface IDBProperties interface IPersist interface IDBInfo interface ISupportErrorInfo 5 4 2 The Session Object The session object cotype is defined as follows CoType TSession interface IDBGetDataSource interface IOpenRowset interface ISessionProperties interface IDBCreateCommand interface IDBSchemaRowset interface ISupportErrorInfo interface ITransactionLocal 5 4 3 The Command Object The command object cotype is defined as follows CoType TCommand Application Program Interface Users Manual 82 interface interface interface interface interface interface interface interface TAccessor IColumnsInfo ICommandPrepare ICommandProperties ICommandText ICommandWithParameters IConvertType ISupportErrorInfo 5 4 4 The Multiple Results Object The multiple results object cotype is defined as follows CoType TMultipleResults interface interface IMultipleResults ISupportErrorInfo 5 4 5 The Rowset Object The rowset object cotype is defined as follows CoType TRowset interface interface interface interface interface interface interface interface IAccessor IColumnsInfo IColumnsRowset IConverType TRowset IRowsetInfo IRowsetIdentity ISupportErrorInfo 5 4 6 The Row Object Th
96. etHoldability int holdability O boolean supportsResultSetType int type O boolean supportsSavepoints O boolean supportsSchemasinDataManipulation O boolean supportsSchemasinindexDefinitions O boolean supportsSchemasinPrivilegeDefinitions O boolean supportsSchemasInProcedureCalls O boolean supportsSchemasinTableDefinitions O boolean supportsSelectForUpdate O boolean supportsStatementPooling O boolean supportsStoredProcedures O boolean supportsSubqueriesinComparisons O boolean supportsSubqueriesinExists O boolean supportsSubqueriesinins O boolean supportsSubqueriesInQuantifieds O boolean supportsTableCorrelationNames O Application Program Interface Users Manual 22 1 7 JDBC 2 1 Core API and JDBC 2 0 Optional Package API Return Type Function Name Support boolean supportsTransactionlsolationLevel int level O boolean supportsTransactions O boolean supportsUnion O boolean supportsUnionAll O boolean updatesAreDetected int type O boolean usesLocalFilePerTable O boolean usesLocalFiles O Return Function Name Support boolean absolute int row O void afterLast O void beforeFirst O void cancelRowUpdates X void clearWarnings O void close O void deleteRow X int findColumn String columnName O boolean first O Array getArray int i X Array getArray String colName X Inp
97. ew of the NES el NI OE EE OE EO OE eaae 122 1 2 Using the iLoaderAP li ED N ede os 123 12 VHeader Fils ann eeen en eeen 123 1 22 Libraries amandel N es 123 12 3 Samples sise EG EE ede ER nt GR Os ee Ge ene bee GE be EE Re se eed eek 123 7 3 iboaderAPl Data Structures EE Ee ee EG ee EE 124 7 3 1 The iloaderHandle RE EE ee Be EG nt tr ee ee 124 ER dige Structure OE EE N Oo ed N 124 1 3 3 L09 Structure Re Oe N Oe N N 124 7 3 4 Option StrUCtUrE AE OE EE baratari EE ese 126 7 3 5 iLoader API EnumMerators nanssenneenseeneeneenneessorneenneenserseerseennersserseerneesseensenveenneessernsonweonsensserveersennserveervenn 128 FAM VC MORSE APE nn GE GE GOS SE OE Rennen 129 7 A 1altibase iloader dataiN Re Se Gee RR GEE Ged ee De Se ee See Ged Sons t s 129 1A2 altibasesiloddersdataott ie see ie Ee GE EG ee eek ee eg 131 7A 3 altibase iloader final ae MEES Ee EER geesten denderen EGO M delen 133 7A4Aaltibase iloader fOFMOUE ie Re EE ee ee RR Ke en Ge GR ee EG sn GE eene edge 134 7 A 5altibase iloader NIE SR EE Ge ee ee Ge Ee Ee 136 7 4 6 altibase_iloader_options_init esse 138 74 7 GallbackFunctionName Ee san RE nr dora e sed eee ne ete de 138 8 The CheckServer APIs issie soe esse ed gie dee oie ed ge gen eo Ge Dee nd Ge ge osio ee ee DER Ge as Go ed GE ede gees ged 143 8 1 Overview of the CheckServer API nn 144 GAM Mere es AL nt rte eN Oe Ee terne s 144 8 2 Using the CheckServer URE EE EE EE EE EESa Sasa 145
98. execution of an iLoader task These statistics are the time at which the task started the total number of rows to be uploaded or down loaded the number of rows that have been successfully uploaded or downloaded and the number of rows that could not be uploaded or downloaded due to the occurrence of an error This structure is defined as follows typedef struct ALTIBASE ILOADER STATISTIC LOG char tableName 50 time t startTime int totalCount int loadCount int errorCount ALTIBASE ILOADER STATISTIC LOG Member Description tableName The name of the table being uploaded or downloaded startTime This is the time at which the upload or download task started totalCount This is the total number of rows to be uploaded This member is not used when downloading data loadCount This is the total number of rows that have been successfully uploaded or downloaded errorCount This is the number of rows that could not be uploaded or down loaded due to the occurrence of an error ALTIBASE ILOADER OPTION V1 Most of the members of the ALTIBASE ILOADER OPTION V1 structure correspond to iLoader options The corresponding option is noted in the comment following each member For detailed information on the iLoader options please refer to the ALTIBASE HDB iLoader User s Manual The definitions of the iloBool iloLoadMode iloDirectMode and ALTIBASE ILOADER LOG TYPE enumerators can be found iLoader API En
99. f altibase check server is terminated Once altibase check server _cancel has been called if it is called again before altibase check server altibase check server cancel will execute correctly 8 4 4 5 Related Functions altibase check server 8 4 4 6 Example See altibase check server 151 returns a result there is no guarantee that either call to The CheckServer API 8 4 The CheckServer API Application Program Interface User s Manual 152 Index NET Data Provider 52 Array Binding 56 Compiling Applications 54 Data Type 60 Schema 59 A altibase check server 147 altibase check server cancel 150 altibase check server final 148 altibase check server init 149 altibase iloader datain 129 altibase iloader dataout 131 altibase iloader final 133 altibase iloader formout 134 altibase iloader init 136 altibase iloader options init 138 B Blob 34 C CallableStatement 31 CheckServer API Data Structure 146 Libraries 145 overview 144 restrictions 144 Samples 145 Clob 35 Connection 16 ConnectionPoolDataSource 35 D DatabaseMetaData 17 DataSource 35 Driver 15 E Executing JDBC XA 99 Executing ODBC XA 97 Executing SES XA 98 I iLoader API CallbackFunction 138 Data Structures 124 Libraries 123 overview 122 Samples 123 Installing Altibase PERL DBD 48 J JAVA Application 2 JDBC 3 0 API 15 JDBC Connection Fail over 38 JDBC Distributed Transactions 107 JDBC dr
100. f any previous connection instance that was created by the same XAConnection instance still exists it is closed It is nevertheless advisable to explicitly close a previous Connection instance before opening a new one Calling the close method of an XACon nection instance closes the physical connection to the database The TM uses instances of the ABXAResource object to coordinate all of the transaction branches An instance of the Altibse jdbc driver ABXAResource type is an instance of the class in which the javax transaction xa XAResource interface is implemented Figure 6 6 ABXAResource Class lt nterface gt Javax transaction xa XAResource A ABXAResource Whenever the getXAResource method of the ABPooledConnection class is called the JDBC driver of ALTIBASE HDB creates and returns an instance of the ABXAResource class and associates the ABXAResource instance with a Connection instance This is the Connection object that is used by the transaction branch 109 XA Interface 6 5 JDBC Distributed Transactions The ABXAResource class has several methods for controlling a transaction branch of a distributed transaction TM receives an instance of the ABXAResource class from a middle tier component such as an application server The ABXAResource class exposes the following methods void start Xid xid int flags void end Xid xid int flags int prepare Xid xid void commit Xid xid boole
101. f calling the TX and XA interfaces is as shown in the following diagram Application Program Interface Users Manual 100 6 3 Using XA Figure 6 2 The Process of Calling TX and XA Interfaces XA Interface AP TM tx_open xa_open tx_begin gt gt xa start N tx_com mit xa_end ERA gt gt xa_prepare xa com mit ALTIBASE tx close gt sl Xa_close xa_recover ma gt xa commit xa_rollback xa_forget Native Calls A A TPM Transaction Processing Monitor application has a client server structure in which a client requests a service provided by an application server Service is divided into logical work units When ALTIBASE HDB is used as the RM a logical work unit typically comprises a set of SQL statements 6 3 4 1 Example In the following example it is assumed that the application server has already logged on to the TPM system Starting a Transaction on an Application Server The following example shows the start of a transaction on an application server Ex Client tpm service SERVICE1 Ex Server SERVICE lt get service specific data gt tx begin EXEC SQL UPDATE tpm service SERVICE2 tx commit lt return service status back to the client gt Starting a Transaction on a Client The following example shows the start of a transaction on a client
102. g infor mation about stored proce dures and functions ProcedureParameters SYS PROC PARAS_ A meta table containing infor mation about the parameters for stored procedures and functions For more information about the meta tables and performance views provided in ALTIBASE HDB please refer to the chapter in the ALTIBASE HDB General Reference that explains the data dictionary The ALTIBASE HDB NET Data Provider provides functions for connecting to Altibase databases exe cuting queries and retrieving results These functions are based on the four classes shown in Table 59 NET Data Provider 4 2 Using the ALTIBASE HDB NET Data Provider 4 2 For detailed information on the functionality of the methods in each class please refer to the Microsoft ADO NET documentation Table 4 2 ALTIBASE HDB NET Data Provider Classes for Connecting to Databases Executing Oueries and Retrieving Results Class Description AltibaseConnection This class is used to make connection settings and establish a connec tion with a database so that transactions can be executed AltibaseCommand This class is used to execute a query in a database and set parameters AltibaseDataReader Once a command has been executed on a database this class is used to retrieve and output the results AltibaseDataAdapter This class is used to write data to an instance of a DataSet class and update a database with the data stored therein
103. g procedureNamePattern String getProcedureTerm O int getResultSetHoldability O ResultSet getSchemas O String getSchemaTerm O String getSearchStringEscapel O String getSQLKeywords O int getSQLStateType O String getStringFunctions O ResultSet getSuperTables String catalog String schemaPattern X String tableNamePattern ResultSet getSuperTypes String catalog String schemaPattern X String typeNamePattern String getSystemFunctions ResultSet getTablePrivileges String catalog String schemaPat tern String tableNamePattern ResultSet getTables String catalog String schemaPattern String O tableNamePattern String types 19 JDBC 1 7 JDBC 2 1 Core API and JDBC 2 0 Optional Package API Return Type Function Name Support ResultSet getTableTypes O String getTimeDateFunctions O ResultSet getTypelnfo O ResultSet getUDTs String catalog String schemaPattern String O typeNamePattern int types String getURL O String getUserName ResultSet getVersionColumns String catalog String schema X String table boolean insertsAreDetected int type O boolean isCatalogAtStart O boolean isReadOnly O boolean locatorsUpdateCopy O boolean nullPlusNonNulllsNull O boolean nullsAreSortedAtEnd O boolean nullsAreSortedAtStart O boolean nullsAreSortedHigh O boolean nullsAreSortedLow O boolean ot
104. half of APs by the TM APs merely request the TM to commit or roll back entire global transactions 6 1 2 XA Structure As shown in the following diagram the entities involved in a distributed transaction include one or more APs Applications the TM Transaction Manager and one or more RMs Resource Managers Figure 6 1 XA Structure Native Interface AP An Application that provides the functions required by the end user RM a provider of stored information that is connected to a network TM The entity responsible for assigning Transaction IDs and committing and rolling back global transactions 89 XA Interface 6 1 XA Interface If an AP announces the start of a distributed transaction to the TM using TX interface the TM deter mines which RMs databases are involved in the distributed transaction The TM internally gener ates XIDs to identify the transaction branches that are to be executed in respective RMs and then calls XA interface with the XIDs to the RMs The RMs i e database nodes then start to process the transaction branches corresponding to the respective XIDs To terminate the transaction the AP calls the TM via the TX interface The TM then uses the XA inter face to instruct the RMs on which the branches of the distributed transaction are running to either commit or roll back their respective transaction branches 112 YA and ID Tiun Dh aa fammit 6 1 3 XA and 2PC
105. he following values TMSUSPEND This specifies that execution of the transaction branch is to be merely suspended rather than permanently terminated Execution of this transaction branch can be resumed later using xa start with the TMRESUME flag TMSUCCESS This is used to specify successful termination of a transaction branch It can t be used together with TMSUSPEND or TMFAIL TMFAIL This is used to specify abnormal termination of a transaction branch The status of the transac tion branch becomes rollback only It can t be used together with TMSUSPEND or TMSUC CESS This is used to roll back the operations performed by the transaction branch int xa rollback XID xid int rmid long flags flags can be set to one of the following values TMASYNC This specifies that the transaction branch is to be rolled back in asynchronous mode not sup ported in ALTIBASE HDB TMNOFLAGS If flags is not set to TMASYNC it must be set to this value Application Program Interface Users Manual 94 6 2 The XA Interface When using the two phase commit protocol this is executed before committing or rolling back a transaction int xa prepare XID xid int rmid long flags flags can be set to one of the following values TMASYNC not supported in ALTIBASE HDB TMNOFLAGS If flags is not set to TMASYNC it must be set to this value xa_prepare can return the following values XA_RDONLY This is returned when the
106. hersDeletesAreVisible int type O boolean othersinsertsAreVisible int type O boolean othersUpdatesAreVisible int type O boolean ownDeletesAreVisible int type O boolean ownlnsertsAreVisible int type O boolean ownUpdatesAreVisible int type O boolean storesLowerCaseldentifiers O boolean storesLowerCaseOuotedldentifiers O boolean storesMixedCaseldentifiers O boolean storesMixedCaseOuotedldentifiers O boolean storesUpperCaseldentifiers O boolean storesUpperCaseQuotedidentifiers O boolean supportsAlterTableWithAddColumn O boolean supportsAlterTableWithDropColumn O Application Program Interface Users Manual 20 1 7 JDBC 2 1 Core API and JDBC 2 0 Optional Package API Return Type Function Name Support boolean supportsANSI92EntryLevelSQL O boolean supportsANSI92FullSQL O boolean supportsANSI92IntermediateSQL O boolean supportsBatchUpdates O boolean supportsCatalogsInDataManipulation O boolean supportsCatalogsInIndexDefinitions O boolean supportsCatalogsinPrivilegeDefinitions O boolean supportsCatalogsinProcedureCalls O boolean supportsCatalogsInTableDefinitions O boolean supportsColumnAliasing O boolean supportsConvert O boolean supportsConvert int fromType int toType O boolean supportsCoreSQLGrammar O boolean supportsCorrelatedSubqueries O boolean supportsDataDefinitionAndDataManipulationTransac
107. hich functions are unsupported X 1 7 1 JDBC 3 0 API java sql package gt JDBC core API javax sql package gt JDBC Optional Package API JDBC 3 0 API includes all previous JDBC API versions JDBC 2 1 core API JDBC 2 0 Optional Package API The above two combined are called JDBC 2 0 API JDBC 1 2 API JDBC 1 0 API 1 7 2 java sql Package Support Status ALTIBASE HDB JDBC Driver support status in JDBC 3 0 1 7 2 1 Driver Return Function Name Support boolean acceptsURL String url O Connection connect String url Properties info O Int getMajorversion O Int getMinorVersion O DriverPropertylnfo getPropertylnfo String url Properties info O boolean jdbcCompliant O 15 JDBC 1 7 JDBC 2 1 Core API and JDBC 2 0 Optional Package API Return Function Name Support Void clearWarnings O Void close O Void commit O Statement createStatement O Statement createStatement int resultSetType int resultSetConcur O rency Statement createStatement int resultSetType int resultSetConcur X rency int resultSetHoldability Boolean getAutoCommit O String getCatalog O Int getHoldability A DatabaseMetaData getMetaData O Int getTransactionlsolation O Map getTypeMap O SOLWarning getWarnings O Boolean isClosed O Boolean isReadOnly O String nativeSQL String sql O
108. icrosoft Directory Services SQL Native Client Next gt gt 4 Go to the Connection tab and add the data source name and login information E Data Link Properties xi Provider Connection Advanced Al Specify the following to connect to SQL Server data 1 Select or enter a server name I Befresh 2 Enter information to log on to the server C Use Windows NT Integrated security Use a specific user name and password User name Password I Blank password D Allow saving password 3 Select the database on the server zi C Attach a database file as a database name oo Using the filename Test Connection 5 Now click on the All tab It is a good idea at this point to change the values of the initialization properties for the OLE DB provider of ALTIBASE HDB Select Extended Properties and then click the Edit Value button to set the property value Application Program Interface Users Manual 72 5 2 Installation E Data Link Properties xi Provider Connection Advanced All These are the initialization properties for this type of data To edit a value select a property then choose Edit Value below Name Value Connect Timeout 3 Data Source 127 0 0 1 Extended Properties Password dis Persist Security Info True User Id sys Edit Value OK Cancel Help The Extended Properties value has the foll
109. ion 7 An XAConnection instance establishes a physical connection to a database It is used to manage a distributed transaction and to obtain an XAResource object that plays a role in managing the dis tributed transaction In the JDBC driver of ALTIBASE HDB the instance of the Alti base jdbc driver ABPooledConnection class is the actual instance of the XAConnection type The getXAResource method of the ABPooledConnection class returns an instance of the ABXARe source object The getConnect ion method returns an instance of the ABConnection object Application Program Interface Users Manual 108 6 5 JDBC Distributed Transactions Figure 6 5 ABPooledConnection Class lt nterface gt PooledConnection lt nterface gt XAConnection A ABPooled Connection The ABConnection instance returned by the get Connection method acts as a temporary handle for the physical database connection It acts like a normal connection until the transaction branch starts participating in the global transaction At the moment that the transaction branch partici pates in the global transaction AUTOCOMMIT becomes false After the global transaction termi nates AUTOCOMMIT is restored to its original state that is its state prior to the start of the global transaction Each time an XAConnection instance s get Connect ion method is called it returns a new instance of a Connection object At this time i
110. iver version 2 Jeus 2 N National Character Sets 9 P PERL DBD 46 PERL DBI 46 PERL Package Installation 47 PHP Installing ODBC Manager 41 Sample Test 43 Unix ODBC 41 Windows ODBC 42 PHP Functions for ODBC Connectivity 43 PHP Module 40 PooledConnection 36 PreparedStatement 30 Processing in doubt Transactions 118 R ResultSet 23 ResultSetMetaData 28 S SavePoint 35 Setting up Connection Pool 10 Settings in JSP 8 Statement 28 T Tomcat 2 TPM Application 102 U Using NET Data Provider 54 Using JDBC to Connect to Altibase 3 Using XA 97 Index W WAS 10 WebLogic 2 X XA Interface 92 Limitations 104 overview 88 XA Library 91 XA Tracking Information 118 XAConnection 36 XAConnection Interface 108 XADataSource 36 XAResource 37 xa_switch_t Structure 90 Xid 37 Xid interface 110 Index 154
111. ix and LINUX 41 2 2 2 The ODBC Manager in Windows rm 42 2 3 PHP Functions for ODBC Connectivity nr 43 EES ie EE nonsense senden OE EE N OO ER oe 43 3 PERL DBD DBI eeoe esse sesse ese EG GE GE GE GEGEE GE GE GAD GE Ge Gee 45 3 1 Overview of the Perl DBD and DBI nr 46 3 2 Perl Package Installation AE OE EE DO 47 3 2 1 The Perl Package Installation Procedure sn 47 3 3 Installing the ALTIBASE HDB DBD ann nana nn nn lent nine 48 3 3 1 The ALTIBASE HDB PERL DBD Installation Procedure ss Rea Rea RR ee RR ee RR Geek Gee 48 A NET Dat de OER EE EE N EE EE N EO EL ea teen 51 4 1 An Overview of the NET Data Provider nn 52 ATE OVENI EW DE ES GE DO earste 52 4 12 Reduirements Ge Ge ee Ee ee ne 52 4 1 3 Consideratien ss nn ee eg Gee Ge er ee ee ee ee ee ee Ee 52 4 2 Using the ALTIBASE HDB NET Data Provider 54 4 2 1 Compiling adVefs Ie io OR a a 54 4 2 2 Array Binding es ee nn ee ee ee ee end ees 56 4 2 3 Declaring the ALTIBASE HDB NET Data Provider inner 58 4 24 Processing Transaction S ana nn EG Ge nn nes GE besoe GE KERE OE EE GED E 425 Scheman RR GE an eet een ned 4 2 6 ALTIBASE HDB NET Data Provider Classes sy 4 2 7 ALTIBASE HDB NET Data Provider Data Types nn 60 4 3 Interface Settings for NET Data Provider unes 62 4 3 1 Interface ae ER N N eenn e 62 ed es eo ie Interfaces ED Oe DE 63 4 4 NET Data Provider Example 66 5 OLE DB sees sssoe sees sso esse sees 5 1 Overview of OLE DB 5 2 Installation
112. keyword value As shown multiple keywords are delimited using semicolons File Name This specifies the name of a data link file udl containing preset connection information For example if the user account is the sys account the password is manager and the IP and port number of the server are 192 168 2 1 20300 a typical connection string including all of this informa tion would look like this Provider Altibase OLEDB Data Source 192 168 2 1 User Id sys Password man ager Extended Properties PORT 20300 NLS USE US7ASCII If the connection information of ALTIBASE HDB is stored in an ODBC DSN it is possible to simply refer to the information in this DSN This obviates the need to specify a large number of keyword value pairs in the connection string and also make the connection string simpler and shorter In this example altibase_odbc is the name of the DSN containing the connection information A typical connection string containing this information looks like this Provider Altibase OLEDB Data Sourcesaltibase odbc This connection string can also be used to establish an OLE DB connection with ALTIBASE HDB via ADO or ADO net as explained below CON This section contains sample ADO connection strings used for connecting to ALTIBASE HDB via ADO As explained above the connection string can be modified so that it simply refers to a DSN rather than containing a large number of keyword value pair
113. l class SimpleSQL public static void main String args Properties sProps new Properties Connection sCon null Statement sStmt null PreparedStatement sPreStmt null ResultSet SRS if args length System err println Usage java class name port no System exit 1 String sport args 0 String sURL jdbc Altibase 127 0 0 1 sPort mydb String sUser SYS String sPassword MANAGER 3 JDBC 1 2 Using JDBC to Connect to ALTIBASE HDB sProps put user sUser sProps put password sPassword sProps put encoding sEncoding Deploy Altibase s JDBC Driver try catch Exception e Class forName Altibase jdbc driver AltibaseDriver System out println Can t register Altibase Driver System out println ERROR MESSAGE e getMessage System exit 1 Initialize environment try sCon DriverManager getConnection sURL sProps sStmt sCon createStatement catch Exception e System out println ERROR MESSAGE e getMessage e printStackTrace try sStmt execute DROP TABLE TEST EMP TBL catch SQLException e try sStmt execute CREATE TABLE TEST EMP TBL EMP FIRST VARCHAR 20 EMP LAST VARCHAR 20 EMP NO INTEGER sPreStmt sCon prepareStatement INSERT INTO TEST EMP TBL VALUES sPreStmt setString 1 Sus
114. lType int scale void setShort String parameterName short x O void setString String parameterName String x O void setTime String parameterName Time x O void setTime String parameterName Time x Calendar cal A void setTimestamp String parameterName Timestamp x O void setTimestamp String parameterName Timestamp x A Calendar cal void setURL String parameterName URL val X boolean wasNull Return Type Function Name Support InputStream getBinaryStream O bytel getBytes long pos int length O long length O long position Blob pattern long start X long position byte pattern long start X OutputStream setBinaryStream long pos O int setBytes long pos bytel bytes O int setBytes long pos bytel bytes int offset int len O void truncate long len O Application Program Interface Users Manual 34 1 7 JDBC 2 1 Core API and JDBC 2 0 Optional Package API Return Type Function Name Support int setString long pos String str int setString long pos String str int offset int len O Return Type Function Name Support int getSavepointld String getSavepointName O ALTIBASE HDB JDBC support status in JDBC 3 0 Return Type Function Name Support int getLoginTimeout A PrintWriter getLogWriter O PooledConnection getPooledConnection O PooledConnection getPooledConnection String us
115. les are directly edited will be described Because different Web Application Servers support the use of dif ferent configuration methods it will be necessary to check which methods are supported in your environment This section explains how to create a connection pool using the following Web Application Servers Tomcat 4x WebLogic 6 x Jeus 3 x 1 6 1 1 Tomcat 4 x This explanation assumes that the jakarta commons dbcp package is being used Procedure Install the jakarta commons dbcp package For more information on how to install the jakarta commons dbcp package please visit http jakarta apache org When the jakarta commons dbcp package has been successfully installed the following resource must be registered in the STOMCAT_HOME conf server xml file lt h ssssss server xml gt lt ResourceParams name jdbc altidb gt lt parameter gt lt name gt factory lt name gt lt value gt org apache commons dbcp BasicDataSourceFactory lt value gt lt parameter gt lt Maximum number of dB connections in pool gt lt parameter gt lt name gt maxActive lt name gt Application Program Interface Users Manual 10 1 6 Setting up a Connection Pool lt value gt 5 lt value gt lt parameter gt lt Maximum number of idle dB connections to retain in pool gt lt parameter gt lt name gt maxIdle lt name gt lt value gt 3 lt value gt lt parameter gt lt Maximum time to
116. ml gt lt JDBCConnectionPool CapacityIncrement 5 DriverName Altibase jdbc driver AltibaseDriver lt Initial connection count gt InitialCapacity 5 lt Maximum connection count gt 11 JDBC 1 6 Setting up a Connection Pool MaxCapacity 50 Name altiPool RefreshMinutes 10 ShrinkPeriodMinutes 15 ShrinkingEnabled true lt Set Custom Properties gt Properties user SYS password MANAGER encoding KSC5601 portNum ber 20300 databaseName mydb serverName 192 168 1 1 Targets myserver TestTableName dual URL jdbc Altibase 192 168 1 1 20300 mydb gt 1 6 1 3 Jeus 3 x Set up the connection pool by editing the lt DataSource gt element in the SJEUS_HOME config Jeus Main xmlI file Procedure lt JeusMain xml gt lt DataSource gt lt Database gt lt Vendor gt others lt Vendor gt lt ExportName gt Alti XA DB lt ExportName gt lt Sets Data Source Class gt lt DataSourceClassName gt Altibase jdbc driver ABConnectionPoolDataSource lt Data SourceClassName gt lt DatabaseName gt mydb lt DatabaseName gt lt User gt SYS lt User gt lt Password gt MANAGER lt Password gt lt PortNumber gt 20300 lt PortNumber gt lt ServerName gt 192 168 1 1 lt ServerName gt lt Sets the custom property gt lt DataSourceType gt Connect ionPoolDataSource lt DataSourceType gt lt Sets the connection pool gt lt ConnectionPool gt
117. moveTolnsertRow X 25 JDBC 1 7 JDBC 2 1 Core API and JDBC 2 0 Optional Package API Return Function Name Support boolean next O boolean previous O void refreshRow X boolean relative int rows O boolean rowDeleted X boolean rowlnserted X boolean rowUpdated X void setFetchDirection int direction A void setFetchSize int rows O void updateArray int columnindex Array x X void updateArray String columnName Array x X void updateAsciiStream int columnindex InputStream x int A length void updateAsciiStream String columnName InputStream A x int length void updateBigDecimal int columnindex BigDecimal x X void updateBigDecimal String columnName BigDecimal x X void updateBinaryStream int columnindex InputStream x A int length void updateBinaryStream String columnName Input A Stream x int length void updateBlob int columnindex Blob x A void updateBlob String columnName Blob x A void updateBoolean int columnindex Boolean x X void updateBoolean String columnName Boolean x X void updateByte int columnindex byte x X void updateByte String columnName byte x X void updateBytes int columnindex bytel x X void updateBytes String columnName bytel x X void updateCharacterStream int columnindex Reader x int A length void updateCharacterStream String columnName Reader A reader int length
118. n handle Output This is a pointer to a buffer in which the handle to the newly allocated data structure is returned 7 4 5 3 Return Values ALTIBASE ILO SUCCESS or ALTIBASE ILO ERROR 7 4 5 4 Description altibase iloader init allocates a handle that is used when creating a table format file downloading data or uploading data One handle cannot be shared by multiple threads even if the threads are part of the same process 7 4 5 5 Related Functions altibase iloader datain altibase iloader dataout altibase iloader formout altibase iloader final 7 4 5 6 Example int main ALTIBASE ILOADER HANDLE handle ALTIBASE ILOADER NULL HANDLE int re re altibase iloader init amp handle if re ILOADER SUCCESS printf altibase iloader init failed d n rc omit if handle ALTIBASE ILOADER NULL HANDLE altibase iloader final amp handle return 0 137 The iLoader API 7 4 The iLoader API 7 4 6 altibase iloader options init This function initializes an option structure to the default values 7 4 6 1 Syntax int altibase iloader options init int version void options 7 4 6 2 Arguments Argument In Out Description version Input This is the version of the iLoader API options Input This is the pointer to the option structure 7 4 6 3 Return Values ALTIBASE ILO SUCCESS or ALTIBASE ILO ERROR 7 4 6 4 Desc
119. n argument must be ALTIBASE ILOADER V1 If a user defined log callback function is being used specify the name of the function in logCallback Set logCallback to NULL when not using a user defined log callback function 7 4 2 6 Related Functions altibase iloader init altibase iloader options init altibase iloader formout altibase iloader final 7 4 2 7 Example The following example shows how to specify a format file and a data file when downloading data both when using the iLoader utility directly and when calling the iLoader API from within an applica tion Downloading Data Using the iLoader Utility Application Program Interface User s Manual 132 7 4 The iLoader API iloader out s 127 0 0 1 u sys p manager f t1 fmt d t1 dat Downloading Data Using an Application that Calls the iLoader API int main ALTIBASE ILOADER HANDLE handle ALTIBASE ILOADER NULL HANDLE ALTIBASE ILOADER OPTIONS V1 opt ALTIBASE ILOADER ERROR err int rc Allocate an iLoader handle rc altibase iloader init amp handle if re ALTIBASE ILO SUCCESS printf altibase iloader init failed d n rc return 1 Initialize an option structure altibase iloader options init ALTIBASE ILOADER V1 amp opt strcpy opt serverName 127 0 0 1 strcpy opt loginID sys strcpy opt password manager strcpy opt formFile t1 fmt strcpy opt dataFilel 0 t1 dat opt dataFileNum 1 Dow
120. n iLoader task has completely executed following a call to altibase iloader datain oraltibase iloader dataout At this time the structure that is passed to the callback function is ILO LOG ALTIBASE ILOADER LOG If the value of the record member of the log structure is 0 this means that execution has com pleted Every time the number of rows specified in setRowFrequency a member of the Option Structure is uploaded or downloaded At this time the structure that is passed to the callback function is ILO STATISTIC LOG ALTIBASE ILOADER STATISTIC LOG 139 The iLoader API 7 4 The iLoader API If a user defined callback function returns anything other than 0 zero execution of the cur rent upload or download task will stop Note that at that point the value of loadCount may be incorrect Note that although the user callback function is supposed to be called whenever the number of rows specified in the setRowFrequency member is uploaded or downloaded this behavior may not be exhibited in the following cases When the value of the arrayCount member of the option structure is greater than 1 a user callback function cannot be called during the execution of an upload task When the value of the paral lelCount member of the option structure is greater than 1 a user callback function may not be called for reasons related to synchronization between multiple threads 7 4 7 5 Related Functions altibase iloader datain al
121. necessary in order for it to be possible to make a connection internally within ODBC For more detailed information please refer to 6 3 1 Executing ODBC XA which outlines the required tasks in sequence 3 Disconnection statements must also be changed into a TPM compatible form Replace the EXEC SQL DISCONNECT statement when working with APRE or the SQLDisconnect statement when working with ODBCCLI with a call to tx close 4 Commit and rollback statements must also be changed into a TPM compatible form When working with APRE replace the EXEC SQL COMMIT statement with a call to tx commit and the EXEC SQL ROLLBACK statement with a call to tx_rollback When working with ODBCCLI replace the SOLEndTran statement with a call to either tx_ commit or tx _rollback as appropriate Use tx_begin to initiate the execution of a transaction 5 Before terminating a transaction the application must exit the state in which it is ready to fetch records That is after fetching data using a cursor and before ending the transaction the CLOSE RELEASE statement must be used to close the cursor and free all associated resources Application Program Interface Users Manual 102 6 3 Using XA ALTIBASE HDB Statement TPM Functions CONNECT tX Open Implicit commencement of transaction tx_begin Executing SQL statements Service that executes the SQL statements COMMIT tx_commit ROLLBACK tx_rollback DISCONNECT tx_close SET TRANSAC
122. neral concept of distributed transactions introduces the XA standard and describes the XA interface It explains how to use a global transaction manager to access ALTI BASE HDB via ODBC JDBC and APRE and specifies the support for the XA within ALTIBASE HDB It also describes the limitations of the XA distributed transaction processing model and how to deal with problems that can arise in applications 87 XA Interface 6 1 XA Interface 6 1 XA Interface XA is a standard interface that is used for processing distributed transactions also known as global transactions It was proposed by The Open Group formerly X Open A distributed transaction also known as a global transaction is a transaction that spans two or more nodes connected via a network The database systems provide the resources for the transac tion while a TM Transaction Manager creates and manages the global transaction which oversees all operations performed on these resources The XA standard thus enables distributed applications to share resources provided by multiple database servers and makes global transactions possible Application AP An application defines the necessary transactions and the operations that constitute a transac tion An application can be written using for example the precompiler or the ODBC CLI Global Transaction This refers to multiple transactions that are managed as a single transaction by a TM It is essenti
123. nload data rc altibase iloader dataout amp handle ALTIBASE ILOADER V1 amp opt NULL amp err if rc ALTIBASE ILO SUCCESS else printf SUCCESS n printf ERR 05X Ss s n err errorCode err errorState err errorMessage if handle ALTIBASE ILOADER NULL HANDLE return 0 altibase iloader final amp handle 7 4 3 altibase iloader final This function is used to free a handle and all associated resources 7 4 3 1 Syntax int altibase iloader final ALTIBASE ILOADER HANDLE handle 133 The iLoader API 7 4 The iLoader API 7 4 3 2 Arguments Argument In Out Description handle Input This is the pointer to the iLoader handle to be freed 7 4 3 3 Return Values ALTIBASE ILO SUCCESS or ALTIBASE ILO ERROR 7 4 3 4 Description altibase iloader finall frees the resources associated with the specified iLoader handle After a handle has been freed it cannot be used by the application 7 4 3 5 Related Functions altibase iloader init 7 4 3 6 Example Please refer to altibase iloader init This function is used to create a table format file i e FORM file 7 4 4 1 Syntax int altibase iloader formout 7 4 4 altibase iloader formout ALTIBASE ILOADER HANDLE handle int void version options ALTIBASE ILOADER ERROR error 7 4 4 2 Arguments Argument In Out Description handle Input This
124. oader init altibase iloader options init altibase iloader formout altibase iloader final 7 4 1 7 Example The following example shows how to specify a format file and a data file when uploading data both when using the iLoader utility directly and when calling the iLoader API from within an application Uploading Data using the iLoader Utility iloader in s 127 0 0 1 u sys p manager f t1 fmt d t1 dat Uploading Data Using an Application that Calls the iLoader API int main ALTIBASE TLOADER HANDLE handle ALTIBASE ILOADER NULL HANDLE ALTIBASE ILOADER OPTIONS V1 opt ALTIBASE TLOADER ERROR err int rc Allocate an ILOADER handle re altibase iloader init amp handle if rc ALTIBASE ILO SUCCESS Application Program Interface User s Manual 130 7 4 The iLoader API printf altibase iloader init failed d n rc return 1 Initialize an option structure altibase iloader options init ALTIBASE ILOADER V1 amp opt strcpy opt serverName 127 0 0 1 strcpy opt loginID sys strcpy opt password manager strcpy opt formFile t1 fmt strcpy opt dataFilel 0 t1 dat opt dataFileNum 1 Upload data re altibase iloader datain amp handle ALTIBASE ILOADER V1 NULL amp err if rc ALTIBASE ILO SUCCESS else printf SUCCESS n printf ERR 05X Ss s n err errorCode err errorState err errorMessage
125. ories subcategory within this file Add the information about the ALTIBASE HDB NET Data Provider in this subcategory 4 3 1 1 How to Register the ALTIBASE HDB NET Framework Settings File A file named machine config is saved in the CONFIG subfolder of the folder in which the NET Framework settings file is saved The location of the NET Framework settings file is typically a folder named after the version of the NET framework within the windir Microsoft NET Framework folder For version 2 0 of the NET Framework for example the location of the settings file is as fol lows c Windows Microsoft NET Framework v2 0 50727 CONFIG machine config Open the machine config file and add the following information about the ALTIBASE HDB NET Data Provider to the system data DbProviderFactories subcategory lt add name Altibase Data Provider invariant Altibase Data AltibaseClient description Altibase Data Provider type Altibase Data AltibaseClient AltibaseFactory Altibase Data AltibaseClient gt 4 3 1 2 Using Application Environment Settings Files Typically an application environment settings file can be found in the same directory as the execut able file and has the same name but with the config file name extension For example if the name of an executable file is AltiTest exe then the name of the environment settings file for the applica tion would be AltiTest exe config lt xml version 1 0
126. ort new ways of designing and building data dependent applications Its successor OLE DB supports open database access in a way that provides greater functionality OLE DB uses a COM based programming interface to support access to all types of data including relational non relational and hierarchical data Application Program Interface Users Manual 70 5 2 Installation 5 2 Installation This section covers how to install and uninstall OLE DB Additionally after OLE DB is installed there are a number of items to check before it is possible to use the ODBC driver These items are set forth here This section also explains how to use OLE DB to access an Altibase database in various operat ing environments and how to map OLE DB data types to ALTIBASE HDB data types Installing and Uninstalling OLE DB Verifying the OLE DB Installation Creating a Connection String ALTIBASE HDB and OLE DB Data Types 5 2 1 Installing and Uninstalling OLE DB The OLE DB provider of ALTIBASE HDB is not installed automatically when ALTIBASE HDB is installed Therefore it needs to be installed manually by running the command shown below This command registers the altioledb dll dynamic link library in which the OLE DB provider of ALTIBASE HDB is implemented This library file is located at SALTIBASE HOME lib regsvr32 exe altioledb dil Use the following command to uninstall the OLE DB provider of ALTIBASE HDB regsvr32 exe u altioledb dll 5
127. owing format keyword value keyword value ur When specifying multiple keywords they are delimited using a semicolon 7 In this example the port number is set to 20300 PORT 20300 Edit Property value xi Property Description E xtended Properties Property Value PORT 2030d Reset Value Cancel The settings are now complete Go back to the Connection tab and click on the Test Connec tion button to ensure that the connection works as expected The following box will appear if the connection has been correctly configured Microsoft Data Link xi LA JI Test connection succeeded Close this message box and check the Allow saving password checkbox in the Connection tab Then click on the OK button At this point another dialog box will appear asking you whether you want to save your password Saving your password is useful for subsequent con nection testing However for security reasons saving your password in this way in a produc 73 OLE DB 5 2 Installation tion environment is not recommended Because the UDL file is an unencrypted text file it could be opened and read by malicious users E Data Link Properties xi Provider Connection Advanced Al Specify the following to connect to this data 1 Enter the data source and or location of the data Data Source Location j 2 Enter information to log on to the server Use windows NT Integrated security
128. pages can be used with ALTIBASE HDB without any special considerations For a detailed explanation of the ODBC functions that can be used with PHP please refer to the official PHP online documentation which can be found at http php morva net manual en index php 2 3 1 Sample Test lt SYSTEM DSN USER ID USER PASSWORD conn odbc connect Altibase SYS MANAGER if conn direct execution echo now i create table t1 id integer name char 20 lt br gt odbe exec conn drop table t1 odbe exec conn create table t1 id integer name char 20 prepare execution echo now i insert into tl value 100 Lee lt br gt Sstmt odbc prepare conn insert into tl values insert array 100 Lee if lodbc execute stmt amp SInsert echo error single selection res odbc do conn select id name sysdate from T1 odbc fetch row res SID odbc result res 1 NAME odbc result res 2 DATE odbc result res 3 echo id SID name SNAME datetime SDATE lt br gt odbc_close conn gt 43 The PHP Interface 2 3 PHP Functions for ODBC Connectivity Application Program Interface Users Manual 44 3 PERL DBD DBI This chapter explains how to use the Perl DBD Database Driver and DBI Database Interface with ALTIBASE HDB It describes in detail how to install Perl and the ALTIBASE HDB Perl DBD and how to che
129. r Disconnection with EXEC SQL Statements The EXEC SQL CONNECT and EXEC SQL DISCONNECT statements can t be used to establish or terminate connections in applications authored using APRE Application Program Interface Users Manual 104 6 4 Limitations when using XA 6 4 2 Limitations related to Transaction Branches Multiple application threads participate in the execution of a single global transaction These threads have either tightly coupled or loosely coupled relationships between them Threads that have a tightly coupled relationship share a common resource In addition an RM han dles a pair of coupled threads as a single entity The RM must ensure that tightly coupled threads do not reach a resource deadlock in a transaction branch However there is no need to provide this guarantee for loosely coupled threads The RM handles loosely coupled transaction branches as though they were different global transactions Relationship between XID and Thread If the TM assigns a new XID branch qualifier to a thread this thread has a loosely coupled relation ship with the other threads in the same branch The RM handles this thread as though it were a sep arate global transaction In contrast if the TM joins a branch with an XID that is assigns an existing XID branch qualifier to a thread the thread has a tightly coupled relationship with the other threads sharing this branch The RM regards tightly coupled threads as one object and
130. ription altibase iloader options init initializes an option structure to the default values For detailed information about the default values please refer to iLoader API Data Structures and to the ALTIBASE HDB iLoader User s Manual The option structure must be initialized using this function before setting the option structure 7 4 6 5 Related Functions altibase iloader init 7 4 6 6 Example Please refer to the examples for the altibase_iloader_datain and altibase iloader dataout function 7 4 7 CallbackFunctionName This function is a user defined callback function for handling the log information that is generated during the execution of an application that uses the iLoader API 7 4 7 1 Syntax int CallbackFuncationName ALTIBASE ILOADER LOG TYPE type void log Application Program Interface User s Manual 138 LA N 7 4 The iLoader API Argument In Out Description type Input This is the type of the log structure to return It may be either ILO LOG or ILO STATISTIC LOG log Input This is the pointer to the log structure Depending on the value of type this argument will point to an ALTIBASE ILOADER LOG structure or to an ALTIBASE ILOADER STATISTIC LOG structure If type is ILO LOG log is a pointer to an ALTIBASE ILOADER LOG structure whereas if type is ILO STATISTIC LOG log is a pointer to an ALTIBASE ILOADER STATISTIC LOG structure For more information about the structures please refer
131. rty State Initial Value DBPROP_OUTPUTPARAMETERAVAILABI Read Only DBPROPVAL OA ATEXECUTE LITY DBPROP_PROVIDERFRIENDLYNAME Read Only This should be set at run time DBPROP PROVIDEROLEDBVER Read Only This should be set at run time DBPROP STRUCTUREDSTORAGE Read Only DBPROPVAL SS ISEOUENTIALSTREAM DBPROP SUPPORTEDTXNISOLEVELS Read Only DBPROPVAL TI READCOMMITED DBPROP_USERNAME Read Only This should be set at run time DBPROP_SQLSUPPORT Read Only DBPROPVAL_SQL_ODBC_MINIMUM DBPROPVAL_SQL_ANSI92_ENTRY DBPROPVAL_SQL_ESCAPECLAUSES The following table summarizes the OLE DB properties in the DBPROPSET_DBINIT property set that are currently supported by ALTIBASE HDB Property State Initial Value DBPROP_AUTH_PASSWORD Read Write K DBPROP_AUTH_PERSIST_SENSITIVE_AUTHINFO Read Write VARIANT FALSE DBPROP AUTH USERID Read Write dd DBPROP INIT DATASOURCE Read Write a DBPROP INIT HWND Read Write NULL DBPROP INIT OLEDBSERVICES Read Write DBPROPVAL OS ENABLEA LL DBPROP INIT PROMPT Read Write DBPROMPT NOPROMPT DBPROP INIT PROVIDERSTRING Read Write ee DBPROP INIT TIMEOUT Read Write 3 The following table summarizes the OLE DB properties in the DBPROPSET_OGIS_SPATIAL_OPS prop erty set that are currently supported by ALTIBASE HDB 79 OLE DB 5 3 Properties Property State Initial Value DBPROP OGIS TOUCHES
132. ry of ALTIBASE HDB records information that is useful for tracing errors in a trace file If you open this file you can check information such as error codes and messages For example if xa open fails checking the tracking information will help you determine whether the reason was that the xa info character string has errors in it or whether it was because the TP Manager couldn t find an ALTIBASE HDB server or whether the attempt to log on to the ALTIBASE HDB server failed 6 6 1 1 XA Trace File Name and Location altibase xa lt XA NAME gt lt date gt log XA_NAME This is the connection name specified in the xa_ info character string field XA_NAME value If XA_NAME is not specified in the xa info character string it will be NULL date This is the date specified in the trace file YYYYMMDD If the SALTIBASE HOME environment variable has been set this trace file will be created in SALTIBASE HOME trc If the SALTIBASE HOME environment variable has not been set the trace file will be created in the current directory 6 6 1 2 Example 104744 19381 1 ulxXaOpen XAER RMERR ERR 4102E Invalid password 104744 is the time the log was recorded HHMISS 19381 is the Process ID PID and 1 is the Resource Manager ID ulxXaOpen is the module name XAER RMERR is the XA error code ERR 4102E is the error code returned by the ALTIBASE HDB server and invalid password is the error message returned by the ALTIBASE HDB server
133. ry path will be one of LD_LIBRARY_PATH LD_LIBRARY_PATH_64 or SHLIB_PATH In the following example unixODBC is installed at usr local odbcDriverManager32 export LD LIBRARY PATH usr local odbcDriverManager32 lib LD_ LIBRARY PATH In the following example unixODBC is installed at usr local odbcDriverManager64 export LD LIBRARY PATH usr local odbcDriverManager64 lib LD LIBRARY PATH Create the following two files in the SODBCSYSINI path odbc ini odbcinst ini odbcinst ini must be an empty file having a size of 0 bytes In odbc ini specify the DSN name the path and directory where the ODBC driver of ALTIBASE HDB is installed and the server address and port number Here are some sample odbc ini file contents Altibase Driver home altibase altibase home lib libaltibase odbc so 41 The PHP Interface 2 2 Installing the ODBC Manager for Integration with PHP Server 127 0 0 1 Port 20300 2 2 2 The ODBC Manager in Windows On Windows systems ODBC data sources are managed using the ODBC Data Source Administrator which comes preinstalled When ALTIBASE HDB is installed the ODBC driver of ALTIBASE HDB is automatically registered in the ODBC Data Source Administrator Application Program Interface Users Manual 42 2 3 PHP Functions for ODBC Connectivity 2 3 PHP Functions for ODBC Connectivity ALTIBASE HDB supports all standard ODBC functions and thus all ODBC functions that are typically used in PHP
134. s In this example altibase_odbc is used as the name of the DSN containing the connection information As above the data provider must be set to Altibase OLEDB An ADO connection string containing this information looks something like this Dim con As New ADODB Connection con ConnectionString Provider Altibase OLEDB Data Source altibase_odbc con Open If a udl file exists it can be used to open an ADO connection To accomplish this modify the connec tion string to specify the name of the ud file using the File Name keyword 75 OLE DB 5 2 Installation Dim con As New ADODB Connection con ConnectionString File Name conn test udl con Open A sample ADO net connection string used for connecting to ALTIBASE HDB via ADO net is shown below using System Data OleDb Using OLE DB OleDbConnection connection new OleDbConnection connection ConnectionString Provider Altibase OLEDB Data Source 127 0 0 1 User ID sys Password manager Extended Proper ties PORT 20300 connection Open Opening an ADO net connection The following table shows the OLE DB data types to which data types of ALTIBASE HDB are mapped when using OLE DB to access a data source of ALTIBASE HDB ALTIBASE HDB OLE DB BIGINT DBTYPE_I8 BIT DBTYPE_BOOL BLOB Not Support BYTE DBTYPE_BYTES CHAR DBTYPE_STR CLOB Not Support DATE DBTYPE_STR DOUBLE DBTYPE_R8 FLOAT DBTYPE_STR GE
135. sing System Data using System Data Common using System Data OleDb namespace Open class Program static void Main string args IDbConnection sConnection null IDbCommand sCommand null IDataReader sDataReader null This specifies the connection string 85 OLE DB 5 5 Examples sConnection new OleDbConnection Provider Altibase OLEDB Data Source args 0 try sConnection Open This creates a connection to the DB Console WriteLine Connection Success sCommand sConnection CreateCommand Console WriteLine CreateCommand Success This specifies an SQL statement sCommand CommandText select from t1 sCommand CommandType CommandType Text sDataReader sCommand ExecuteReader Console WriteLine ExecuteReader Success This outputs data while sDataReader Read This iterates through the columns in the result set for int i 0 i lt sDataReader FieldCount i Console WriteLine GetDataTypeName sDataReader GetDataTypeName i Console WriteLine IsDBNull sDataReader IsDBNull i Console WriteLine Value sDataReader GetValue i j sDataReader Close This closes the connection to the DB sConnection Close Console WriteLine Close Success catch Exception e Console WriteLine e Message Wwe eee Application Program Interface Users Manual 86 6 XA Interface This chapter explains the ge
136. sql O boolean execute String sal int autoGeneratedKeys A boolean execute String sql int columnindexes X boolean execute String sal String columnNames X int executeBatch O ResultSet executeQuery String sql O int executeUpdate String sql O int executeUpdate String sql int autoGeneratedKeys X int executeUpdate String sql int columnindexes X int executeUpdate String sql String columnNames X Connection getConnection O int getFetchDirection O int getFetchSize O ResultSet getGeneratedKeys X int getMaxFieldSize O int getMaxRows O boolean getMoreResults O boolean getMoreResults int current O int getQueryTimeout O ResultSet getResultSet O int getResultSetConcurrency O int getResultSetHoldability O int getResultSetType O int getUpdateCount O SQLWarning getWarnings O void setCursorName String name X void setEscapeProcessing Boolean enable X void setFetchDirection int direction A void setFetchSize int rows O void setMaxFieldSize int max O 29 JDBC 1 7 JDBC 2 1 Core API and JDBC 2 0 Optional Package API Return Type Function Name Support void setMaxRows int max void setQueryTimeout int seconds Return Type Function Name Support void addBatch O void clearParameters O boolean execute O ResultSet executeQuery O int executeUpdate O ResultSetMetaData getMetaD
137. t int parameterlndex O float getFloat String parameterName O int getint int parameterlndex O int getint String parameterName O long getLong int parameterlndex O long getLong String parameterName O Object getObject int parameterlndex O Object getObject int i Map map A Object getObject String parameterName O Object getObject String parameterName Map map X Ref getRef int i X Ref getRef String parameterName X short getShort int parameterlndex O short getShort String parameterName O String getString int parameterlndex O String getString String parameterName O Time getTime int parameterindex O Time getTime int parameterlndex Calendar cal A Time getTime String parameterName O Time getTime String parameterName Calendar cal A Application Program Interface Users Manual 32 1 7 JDBC 2 1 Core API and JDBC 2 0 Optional Package API Return Type Function Name Support Timestamp getTimestamp int parameterlndex O Timestamp getTimestamp int parameterlndex Calendar cal A Timestamp getTimestamp String parameterName O Timestamp getTimestamp String parameterName Calendar cal A URL getURL int parameterlndex X URL getURL String parameterName X void registerOutParameter int parameterlndex int salType O void registerOutParameter int parameterlndex int sqlType O int scale void registerOutParameter int paramindex int sqlType
138. tString int parameterlndex String x O void setTime int parameterlndex Time x O void setTime int parameterlndex Time x Calendar cal X void setTimestamp int parameterlndex Timestamp x O void setTimestamp int parameterlndex Timestamp x Cal A endar cal void setUnicodeStream int parameterlndex InputStream x X int length void setURL int parameterlndex URL x X Return Type Function Name Support Array getArray int i X Array getArray String parameterName X BigDecimal getBigDecimal int parameterlndex O BigDecimal getBigDecimal int parameterlndex int scale O BigDecimal getBigDecimal String parameterName O Blob getBlob int i O Blob getBlob String parameterName O boolean getBoolean int parameterindex O boolean getBoolean String parameterName O byte getByte int parameterlndex O 31 JDBC 1 7 JDBC 2 1 Core API and JDBC 2 0 Optional Package API Return Type Function Name Support byte getByte String parameterName O bytel getBytes int parameterlndex O bytel getBytes String parameterName O Clob getClob int i O Clob getClob String parameterName O Date getDate int parameterlndex O Date getDate int parameterlndex Calendar cal A Date getDate String parameterName O Date getDate String parameterName Calendar cal A double getDouble int parameterlndex O double getDouble String parameterName O float getFloa
139. te a DataSource using the newly created Connection Pool Expand Services gt JDBC gt Data Sources and choose Configure a new JDBC Data Source Enter the Name and JNDI Name and check Honor Global Transactions For Pool Name enter the name of the pool created in the first step in the window shown in Figure 6 8 Note In versions of WebLogic prior to version 8 1 a new DataSource is created by expanding Ser vices gt JDBC gt XA Data Sources 111 XA Interface 6 5 JDBC Distributed Transactions Figure 6 8 Creating a Data Source workshop JDBC Data Sources gt altiTXDS AIN he Connected to localhost 7001 You are logged in as weblogic Logout Site Target and Deploy Notes This page allows you to define the configuration for this JDBC data source Name aliTXDS The name of this JDBC data source AN JNDI Name aliTXDS The JNDI path to where this JDBC data source is bound Pool Name altixAPool ls The JDBC connection pool associated with this data source The connection pool you select is used to supply database connections to client applications that request a connection from this data source Advanced Options Show Apply 6 5 4 2 Weblogic Application Example step 1 JNDI Lookup and get UserTransaction Object Context ctx null Hashtable env new Hashtable Parameter for weblogic env put Context INITIAL CONTEXT FACTORY weblogic jndi WLInitialContextFactory en
140. terface 6 6 How to Solve Problems of Application Using XA SYS XA HEURISTIC TRANS STATUS SYS XA HEURISTIC TRANS OCCUR TIME 69 FAEDFAED 00000001 1 2008 08 29 10 09 53 1 row selected ISQL gt EXEC remove xid 69 FAEDFAED 00000001 Execute success iSQL gt SELECT FROM system sys xa heuristic trans SYS XA HEURISTIC TRANS FORMAT ID SYS XA HEURISTIC TRANS GLOBAL TX ID No rows selected Application Program Interface Users Manual 120 1 The iLoader API The iLoader API 7 1 Overview of the iLoader API 7 1 Overview of the iLoader API The ALTIBASE HDB iLoader API is an application programming interface that lets you create applica tions that use function calls to download data from or upload data to an Altibase database server Data are downloaded or uploaded in units of tables The iLoader API provides the same functionality as the iLoader utility For more information about the iLoader utility please refer to the ALTIBASE HDB iLoader User s Manual The following table summarizes the functions available in the iLoader API Function Name Purpose altibase_iloader_init Allocates an iLoader handle altibase_iloader_final Frees a handle and all associated resources altibase_iloader_options_init Initializes the option structure to its default values altibase_iloader_formout Creates a table format file FORM file altibase_iloader_dataout Downloads data from a table
141. the ALTIBASE HDB NET Data Provider The ALTIBASE HDB NET Data Provider can be found in the lib subdirectory in the directory in which ALTIBASE HDB is installed which can be found using the environment variable ALTIBASE_HOME The complete path and filename are as follows SALTIBASE HOME lib Altibase Data AltibaseClient dl1 4 2 1 Compiling NET Applications An application that uses the ALTIBASE HDB NET Data Provider can be compiled in one of two ways 4 2 1 1 Compilation on the Command Line When compiling an application on the command line include a reference to the DLL as shown below csc r ALTIBASE HOMES lib Altibase Data AltibaseClient dll program name cs 4 2 1 2 Compilation in an IDE Environment The following example shows how to register the ALTIBASE HDB NET Data Provider in an IDE Inte grated Development Environment 1 Open a new project Figure 4 1 Figure 4 1 Opening a New Project General There are no usable controls in this group Drag an item onto this ted to add it to the toolbox Sort by Default al Search Installed Templates P f Type Visual C zef Windows Forms application Visual C pe Vla A project for cresting a command line application Ki WPF Application Visual C m Console Application Visual C Console Application FA ces ul c Pl wer Browser Application Visual c cl Empty Proet Visual C ConsoleApplication Bones Description Line
142. tibase iloader dataout 7 4 7 6 Example Defining User Callback int print callback ALTIBASE ILOADER LOG TYPE type void log int i ALTIBASE TLOADER LOG slog ALTIBASE ILOADER STATISTIC LOG statisticlog if type ILO LOG slog ALTIBASE ILOADER LOG log if slog gt record 0 printf LOG Total Count d n slog gt totalCount printf LOG Load Count d n slog gt loadCount printf LOG Error Count d n slog gt errorCount else printf LOG d n slog gt record for i 0 i lt slog gt recordColCount i printf sd s n i slog gt recordData i if slog gt errorMgr errorCode 0 printf ERR 05X Ss s n slog gt errorMgr errorCode slog gt errorMgr errorState slog gt errorMgr errorMessage Application Program Interface User s Manual 140 7 4 The iLoader API else if type ILO STATISTIC LOG statisticlog ALTIBASE ILOADER STATISTIC LOG log printf STATISTIC LOG Start Time s n ctime amp statisticlog gt startTime printf STATISTIC LOG Table Name s n statisticlog gt table Name printf STATISTIC LOG Total Count d n statisticlog gt totalc ount printf STATISTIC LOG Load Count d n statisticlog gt load Count printf STATISTIC LOG Error Count d n statisticlog gt error Count return 0 Registering User Callback upload data altibas
143. tions ALTIBASE ILOADER CALLBACK logCallback ALTIBASE ILOADER ERROR error 7 4 1 2 Arguments Argument In Out Description handle Input This is the pointer to the iLoader handle version Input This is the version of the iLoader API options Input This is the pointer to the option structure logCallback Input This is the name of a log callback function It may be a user defined function It can be NULL error Output This is the pointer to the error structure in which to return information for diagnosing errors For more information about the error structure please refer to iLoader API Data Structures 129 The iLoader API 7 4 The iLoader API 7 4 1 3 Return Values ALTIBASE ILO SUCCESS ALTIBASE ILO ERROR or ALTIBASE ILO WARNING If the overall upload operation succeeded but one or more errors occurred ALTIBASE ILO WARNINGis returned 7 4 1 4 Diagnostics When altibase iloader datain returnseither ALTIBASE ILO ERROR or ALTIBASE ILO WARNING the associated error information is returned in error 7 4 1 5 Description altibase iloader datain is used to upload data from a file into a database table The value of the version argument must be ALTIBASE ILOADER V1 If a user defined log callback function is being used specify the name of the function in logCallback Set logCallback to NULL when not using a user defined log callback function 7 4 1 6 Related Functions altibase il
144. tmta execute drop table my table catch SQLException e Ignore an error here try Create a test table stmta execute create table my_table coll int catch SQLException e Ignore an error here too try Drop the test table stmtb execute drop table my tab catch SQLException e Ignore an error here try Create a test table stmtb execute create table my_tab coll char 30 catch SQLException e Ignore an error here too Create XADataSource instances and set properties ABXADataSource axdsl new ABXADataSource j axds1 setUrl jdbc Altibase localhost 25226 mydb axdsl1 setUser SYS axds1 setPassword MANAGER ABXADataSource axds2 new ABXADataSource j axds2 setUrl jdbc Altibase localhost 25226 mydb axds2 setUser SYS axds2 setPassword MANAGER 115 XA Interface 6 5 JDBC Distributed Transactions Get XA connections to the underlying data sources XAConnection pcl axdsl getXAConnection XAConnection pc2 axds2 getXAConnection Get the physical connections Connection connl pcl getConnection Connection conn2 pc2 getConnection Get the XA resources XAResource axarl pcl getXAResource XAResource axar2 pc2 getXAResource Create the Xids With the Same Global IDs Xid xidl createXid 1 Xid xid2 createXid 2 Start the Resources axarl start xidl XAResource TMNO
145. uces the ALTIBASE HDB CheckServer API which is an application program ming interface for creating applications that use function calls to monitor whether the ALTI BASE HDB server has terminated abnormally This section describes the conventions used in this manual Understanding these conventions will make it easier to find information in this manual and in the other manuals in the series There are two sets of conventions Syntax Diagram Conventions Sample Code Conventions In this manual the syntax of commands is described using diagrams composed of the following ele ments Element Description Indicates the start of a command If a syntactic element starts with an arrow it is not a complete command Reserved word Indicates that the command continues to the next line If a syntactic element ends with this symbol it is not a complete gt command Indicates that the command continues from the previous line If a syntactic element starts with this symbol it is not a com gt plete command iii Preface Element Description Indicates the end of a statement s Indicates a mandatory element SELECT Indicates an optional element NOT A Indicates a mandatory element comprised of options One and only one option must be specified ADD DROP Indicates an optional
146. umerators This structure is defined as follows Application Program Interface User s Manual 126 7 3 iLoader API Data Structures typedef struct ALTIBASE ILOADER OPTIONS V1 int version char loginID 128 2 u login_id char password 128 p password char serverName 128 s server name int portNum port port_no char NLS 128 nls_use characterset char DBName 128 char tableOwner 50 char tableName 50 T table name char formFile 1024 formatfile char dataFile 32 1024 d datafile int dataFileNum int firstRow F firstrow int lastRow L lastrow char fieldTerm 11 t field_term char rowTerm 11 r row term char enclosingChar 11 e enclosing term iloBool useLobFile lob use_lob file iloBool useSeparateFile lob use separate file char lobFileSize 11 lob log file size char lobIndicator 11 lob lob_indicator iloBool replication replication true false iloLoadMode loadModeType mode mode_type char bad 1024 bad bad file char log 1024 log log file int splitRowCount split n int errorCount errors count int arrayCount array array size int commitUnit commit commit unit iloBool atomic atomic iloDirectMode directLog direct log nolog int parallelCount parallel count int readSize
147. utStream getAsciiStream int columnindex O InputStream getAsciiStream String columnName O BigDecimal getBigDecimal int columnindex O BigDecimal getBigDecimal int columnindex int scale O BigDecimal getBigDecimal String columnName O BigDecimal getBigDecimal String columnName int scale O InputStream getBinaryStream int columnindex O InputStream getBinaryStream String columnName O Blob getBlob int i O 23 JDBC 1 7 JDBC 2 1 Core API and JDBC 2 0 Optional Package API Return Function Name Support Blob getBlob String colName O boolean getBoolean int columnindex O boolean getBoolean String columnName O byte getByte int columnindex O byte getByte String columnName O bytel getBytes int columnindex O bytel getBytes String columnName O Reader getCharacterStream int columnindex O Reader getCharacterStream String columnName O Clob getClob int i O Clob getClob String colName O int getConcurrency O String getCursorName X Date getDate int columnindex O Date getDate int columnindex Calendar cal A Date getDate String columnName O Date getDate String columnName Calendar cal A double getDouble int columnindex O double getDouble String columnName O int getFetchDirection O int getFetchSize O float getFloat int columnindex O float getFloat String columnName O int getint int columnindex O int getint String columnNam
148. v put Context PROVIDER URL t3 localhost 7001 env put Context SECURITY PRINCIPAL weblogic env put Context SECURITY CREDENTIALS weblogic etx new InitialContext env System out println Context Created ctx step 2 get User Transaction Object UserTransaction tx UserTransaction ctx lookup javax transaction UserTransaction step 3 start Transaction System out println Start Transaction tx tx begin try step 4 executing query step 4 1 get Datasource DataSource xads1 DataSource ctx lookup altiTXDS 6 5 4 3 Making XA Settings in JEUS Here is how to make the basic settings to create a JDBC data source in JEUS 1 Under JEUS Manager Resource s choose JDBC and then select Create New JDBC Data Source 2 Enterthe following information in the basic setup window that appears Application Program Interface Users Manual 112 6 5 JDBC Distributed Transactions DBMS Other Available Data Source Data Source Class Name Altibase jdbc driver ABXADataSource Data Source Type XADataSource 3 Enter appropriate values for Database Name Port Number Server Name User and Password Figure 6 9 Setting a Data Source in JEUS ss JDBC Ge AA AIA 71 AB Aas Export Name altitxDS GIOIEL 242 anor DIE Vendor others x JBC Ecol HOS OIS Data Source Class Name Altibase jdbc driver ABXADataSource spac EPPO HOE AA SYAS OS HAN SS THS
149. vider Example 4 4 NET Data Provider Example Use the AltibaseConnection class to connect to an Altibase database create the test goods table insert some data and then guery the data using Altibase Data AltibaseClient class ConnectionTest static void Main string args string sConnectionString DSN 127 0 0 1 PORT NO 20091 UID sys PWD man ager This is the host IP address and port number of the database server used as the DSN AltibaseConnection conn new AltibaseConnection sConnectionString try conn Open This connects to the database AltibaseCommand command new AltibaseCommand drop table test goods conn try command ExecuteNonQuery This executes a query catch Exception ex command CommandText create table test goods gno char 10 gname char 20 location char 9 stock integer price numeric 10 2 command ExecuteNonQuery This executes a query command CommandText insert into test goods values A111100001 IM 300 ACOOO1 1000 78000 command ExecuteNonQuery This executes a query command CommandText insert into test goods values A111100002 IM 310 DDOO01 100 98000 command ExecuteNonQuery This executes a query command CommandText insert into test goods values B111100001 NT H5000 ACO002 780 35800 command ExecuteNonQuery This executes a query command CommandText select from test_goods AltibaseDataR
150. wait for a dB connection to become available unit milliseconds gt lt parameter gt lt name gt maxWait lt name gt lt value gt 10000 lt value gt lt parameter gt lt parameter gt lt name gt removeAbandoned lt name gt lt value gt true lt value gt lt parameter gt lt parameter gt lt name gt removeAbandonedTimeout lt name gt lt value gt 60 lt value gt lt parameter gt lt parameter gt lt name gt username lt name gt lt value gt SYS lt value gt lt parameter gt lt parameter gt lt name gt password lt name gt lt value gt MANAGER lt value gt lt parameter gt lt parameter gt lt name gt driverClassName lt name gt lt value gt Altibase jdbc driver AltibaseDriver lt value gt lt parameter gt lt parameter gt lt name gt url lt name gt lt value gt jdbc Altibase 127 0 0 1 20300 mydb lt value gt lt parameter gt lt ResourceParams gt 3 Append the following to the STOMCAT_HOME conf web xml file lt web xml gt lt resource ref gt lt description gt Altibase Datasource lt description gt lt res ref name gt jdbc altidb lt res ref name gt lt res type gt javax sql DataSource lt res type gt lt res auth gt Container lt res auth gt lt resource ref gt 1 6 1 2 WebLogic 6 x Create a JDBC connection pool by editing the lt JDBCConnectionPool gt element in the SWL_HOME config DomainName config xml file Procedure cheese config x
151. xares O int prepare Xid xid O Xidf recover int flag O void rollback Xid xid O boolean setTransactionTimeout int seconds X void start Xid xid int flags O Return Type Function Name Support bytel getBranchOualfier Int getFormatld bytel getGlobalTransactionld O There is an upper limit to the amount of data that can be uploaded using setByte to upload data When uploading more than 64kB of data use a BLOB stream 37 JDBC 1 8 JDBC Connection Failover 1 8 JDBC Connection Failover In an environment with multiple simultaneously operating ALTIBASE HDB servers if one server fails or if a network problem or the like occurs the JDBC driver of ALTIBASE HDB may become unable to provide service If this happens the clients that were connected to the server that failed are able to sense the outage and automatically connect to another server For information on how to use the Fail Over functionality within JDBC applications please refer to Chapter 4 in Replication Manual Application Program Interface Users Manual 38 2 The PHP Interface This chapter explains how to integrate PHP pages with ALTIBASE HDB using PHP s ODBC functional ity 39 The PHP Interface 2 1 About the PHP Module of ALTIBASE HDB 2 1 About the PHP Module of ALTIBASE HDB 1 The following data types are supported for use with ALTIBASE HDB and PHP e resource int e bool double e float string array e HashTa

Download Pdf Manuals

image

Related Search

Related Contents

ANNEXURE – I - India Institute of Medical Sciences, Rishikesh  ASUS Tablet  Manual del usuario  AN-X2-GENI User Manual      Da-Lite 79013LS projection screen  Whirlpool ER8MHKXRB00 User's Manual  Jwin JP-127 User's Manual  AC Servo Drives DC Power Input Σ  

Copyright © All rights reserved.
Failed to retrieve file