|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object vortex.dbChannel
public class dbChannel
This is the main VORTEXjava class. Each dbChannel object corresponds to a RDBMS connection.
Field Summary | |
---|---|
int |
dbID
Unique RDBMS identifier. |
boolean |
null_string
|
int |
sqlCode
Last RDBMS error code |
java.lang.String |
sqlMsg
Last RDBMS error message |
java.lang.String |
version
Version string for included Trifox components |
Constructor Summary | |
---|---|
dbChannel(int maxLogicalCursors,
int maxDbCursors,
int maxColumns,
int fetchBufferSize)
Allocate and initialize a dbChannel. |
Method Summary | |
---|---|
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. |
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. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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
Constructor Detail |
---|
public dbChannel(int maxLogicalCursors, int maxDbCursors, int maxColumns, int fetchBufferSize)
Allocate a connection with an 8Kb fetch buffer.
dbChannel db = new dbChannel(256,64,128,8192);
Method Detail |
---|
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
dbException
public 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","/","");
dbException
public void release() throws dbException
Before the actual RDBMS release request is sent a rollback() will be performed.
dbException
public void commit(boolean startUpdateTrans) throws dbException
dbException
public void rollback(boolean startUpdateTrans) throws dbException
dbException
public 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);
dbException
public 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().
dbException
public 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.
dbException
public 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.
dbException
public void putBlob(dbCursor cursor, int blobColumn, dbBlob blob) throws dbException
dbException
public 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.
dbException
public 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.
dbException
public void close(dbCursor cursor, boolean hard) throws dbException
dbException
public void cancel() throws dbException
dbException
public boolean isClosed() throws dbException
dbException
public int getRowsAffected()
public java.lang.String getString(dbCursor cursor) throws dbException
dbException
public dbNumber getNumber(dbCursor cursor) throws dbException
dbException
public byte[] getByte(dbCursor cursor) throws dbException, java.io.IOException
dbException
java.io.IOException
public java.util.Date getDate(dbCursor cursor) throws dbException
dbException
public void getSkip(dbCursor cursor, int numColsToSkip, boolean stopOnColZero) throws dbException
dbException
public boolean Command(dbCursor cursor, int command, java.lang.String sql) throws dbException
dbException
public int IPC(dbCursor cursor, java.lang.String sql) throws dbException
dbException
public void descparms(dbCursor cursor) throws dbException
dbException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |