public class dbChannel
extends java.lang.Object
| Modifier and Type | Field and Description | 
|---|---|
| int | dbIDUnique RDBMS identifier. | 
| long | dbVer | 
| boolean | null_string | 
| int | sqlCode | 
| java.lang.String | sqlMsg | 
| java.lang.String | versionVersion string for included Trifox components | 
| Constructor and Description | 
|---|
| dbChannel(int maxLogicalCursors,
         int maxDbCursors,
         int maxColumns,
         int fetchBufferSize,
         java.util.Properties info)Allocate and initialize a dbChannel. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | cancel()Cancel an outstanding request. | 
| void | close(dbCursor cursor,
     boolean hard)Close a dbCursor. | 
| boolean | Command(dbCursor cursor,
       int command,
       java.lang.String sql)Send VORTEXchannel command. | 
| void | commit(boolean startUpdateTrans)Commit a transaction. | 
| void | connect(java.lang.String hostName,
       int port,
       java.lang.String hostProgram,
       java.lang.String dbConnectString,
       java.lang.String envVariables)Connect to a remote RDBMS. | 
| void | connect(java.lang.String hostName,
       int port,
       java.lang.String hostProgram,
       java.lang.String dbConnectString,
       java.lang.String envVariables,
       java.util.Properties info)Connect to a remote RDBMS. | 
| void | descparms(dbCursor cursor)Describe the bind parameters | 
| void | execute(dbCursor cursor)Execute a non-SELECT dbCursor. | 
| void | executeIO(dbCursor cursor)Execute a stored procedure dbCursor. | 
| void | executePX(dbCursor cursorPX,
         int fetDbcur)Execute a non-SELECT position exec dbCursor. | 
| void | fetch(dbCursor cursor)Open and fetch from a SELECT dbCursor. | 
| static java.io.File | findVortexPropFile() | 
| dbBlob | getBlob(dbCursor cursor,
       int blobColumn,
       int maxNumBytes)Get (receive) BLOB/CLOB data from the RDBMS. | 
| byte[] | getByte(dbCursor cursor)Get the next column as a byte array. | 
| java.util.Date | getDate(dbCursor cursor)Get the next column as a Date. | 
| dbNumber | getNumber(dbCursor cursor)Get the next column as a dbNumber. | 
| int | getRowsAffected()Get the number of rows affected by the last execute() call. | 
| void | getSkip(dbCursor cursor,
       int numColsToSkip,
       boolean stopOnColZero)Skip (pass over) columns. | 
| java.lang.String | getString(dbCursor cursor)Get the next column as a string. | 
| int | IPC(dbCursor cursor,
   java.lang.String sql)Send VORTEXchannel IPC. | 
| boolean | isClosed()Check if connection is closed. | 
| void | logMsg(java.lang.String msg)Write log message. | 
| java.lang.String | mask(java.lang.String buf,
    int key)Mask the given string. | 
| void | proxy(java.lang.String socksHost,
     java.lang.String socksPort)Set the SOCKS proxy. | 
| void | putBlob(dbCursor cursor,
       int blobColumn,
       dbBlob blob)Put (send) BLOB/CLOB data to the RDBMS. | 
| void | release()Release a connected RDBMS. | 
| void | rollback(boolean startUpdateTrans)Rollback a transaction. | 
| void | sql(dbCursor cursor,
   java.lang.String sqlStatement,
   int numDimensions,
   int numParameters)Associate a SQL statement to a dbCursor. | 
public final java.lang.String version
public boolean null_string
public int dbID
Each underlying RDBMS has a unique ID associated with it. This can be used for those cases when the application might want to generate RDBMS specific SQL syntax. The IDs are as follows:
public int sqlCode
public java.lang.String sqlMsg
public long dbVer
public dbChannel(int maxLogicalCursors,
         int maxDbCursors,
         int maxColumns,
         int fetchBufferSize,
         java.util.Properties info)
Allocate a connection with an 8Kb fetch buffer.
dbChannel db = new dbChannel(256,64,128,8192);
public static java.io.File findVortexPropFile()
public void proxy(java.lang.String socksHost,
         java.lang.String socksPort)
Set the SOCKS proxy to port 1080 on firewall.
db.proxy("firewall","1080");
public java.lang.String mask(java.lang.String buf,
                    int key)
public void connect(java.lang.String hostName,
           int port,
           java.lang.String hostProgram,
           java.lang.String dbConnectString,
           java.lang.String envVariables,
           java.util.Properties info)
             throws dbException
dbExceptionpublic void connect(java.lang.String hostName,
           int port,
           java.lang.String hostProgram,
           java.lang.String dbConnectString,
           java.lang.String envVariables)
             throws dbException
Connect to an Oracle database on a UNIX machine.
db.connect("orahost",1958,"/usr/local/bin/vtxhost.ora",
                          "scott/tiger",
                          "ORACLE_HOME=/usr/local/oracle,ORACLE_SID=A");
Connect to a SQL Server on a NT machine.
db.connect("sqlnt",1958,"vtx12","sa/sa/master2/SQLNT","");
Connect to a DB2 database on MVS with authentication.
db.connect("sys1(foobar/dung)",1958,"7","/","");
dbExceptionpublic void release()
             throws dbException
Before the actual RDBMS release request is sent a rollback() will be performed.
dbExceptionpublic void commit(boolean startUpdateTrans)
            throws dbException
dbExceptionpublic void rollback(boolean startUpdateTrans)
              throws dbException
dbExceptionpublic void sql(dbCursor cursor, java.lang.String sqlStatement, int numDimensions, int numParameters) throws dbException
This method does not call the RDBMS. It simply caches the SQL statement and other info. The SQL statement will be sent to the RDBMS on either a fetch() or execute() call.
Prepare a SELECT statment with no parameters.
db.sql(c1,"select * from staff",0,0);
Prepare a bulk INSERT statement with 7 parameters in batches of 50.
db.sql(c2,"insert into staff values (:1,:2,:3,:4,:5,:6,:7)",50,7);
dbExceptionpublic void executePX(dbCursor cursorPX, int fetDbcur) throws dbException
This method is typically called from VORTEXjdbc. VORTEXjava programs can simply call execute(). All the parameters specified in the sql method must be bound using dbCursor.setParam().
dbExceptionpublic void execute(dbCursor cursor) throws dbException
All the parameters specified in the sql method must be bound using dbCursor.setParam(). The SQL statement will only be sent to the RDBMS the first time. On subsequent calls only the parameters (if any) are sent.
dbExceptionpublic void executeIO(dbCursor cursor) throws dbException
All the input and ouput parameters specified in the stored precedure must be bound using dbCursor.setParam(). The stored procedure statement will only be sent to the RDBMS the first time. On subsequent calls only the parameters (if any) are sent.
dbExceptionpublic void putBlob(dbCursor cursor, int blobColumn, dbBlob blob) throws dbException
dbExceptionpublic dbBlob getBlob(dbCursor cursor, int blobColumn, int maxNumBytes) throws dbException
There are two ways to fetch blobs. The first (and recommended) method is to fetch the length and then the blob data. Call getString() to get the length and then getblob() to fetch the blob. The second method is to keep fetching the blob until a zero length blob is returned. When a zero length blob is returned, you must call getSkip(1) to move to the next column; otherwise the subsequent data columns will be incorrect.
dbExceptionpublic void fetch(dbCursor cursor) throws dbException
All the parameters specified in the sql method must be bound using dbCursor.setParam(). The SQL statement will only be sent to the RDBMS the first time. On subsequent calls only the parameters (if any) are sent.
Data is automatically retrieved into a fetch buffer (using the fetch buffer size specified when the dbChannel was created). The number of rows per fetch varies depending upon the total length of a row.
The column data must be retrieved sequentially using one of the getXxxxx() methods.
This method should only be called once.
dbExceptionpublic void close(dbCursor cursor, boolean hard) throws dbException
dbExceptionpublic void cancel()
            throws dbException
dbExceptionpublic boolean isClosed()
                 throws dbException
dbExceptionpublic int getRowsAffected()
public java.lang.String getString(dbCursor cursor) throws dbException
dbExceptionpublic dbNumber getNumber(dbCursor cursor) throws dbException
dbExceptionpublic byte[] getByte(dbCursor cursor) throws dbException, java.io.IOException
dbExceptionjava.io.IOExceptionpublic java.util.Date getDate(dbCursor cursor) throws dbException
dbExceptionpublic void getSkip(dbCursor cursor, int numColsToSkip, boolean stopOnColZero) throws dbException
dbExceptionpublic boolean Command(dbCursor cursor, int command, java.lang.String sql) throws dbException
dbExceptionpublic int IPC(dbCursor cursor, java.lang.String sql) throws dbException
dbExceptionpublic void descparms(dbCursor cursor) throws dbException
dbExceptionpublic void logMsg(java.lang.String msg)
Updated June 17 2024