PK {Nu+ META-INF/PK {Nu+lDDMETA-INF/MANIFEST.MFManifest-Version: 1.0 Created-By: 1.2.2 (Sun Microsystems Inc.) PK Mi+7; RJAdmin.java /** * RmiJdbc client/server JDBC Driver * (C) GIE Dyade (Groupe BULL / INRIA Research Center) 1997 * * @version 1.0 * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com) */ import java.sql.*; import java.rmi.*; import RmiJdbc.*; import java.net.InetAddress; /** * This is a sample program for RmiJdbc client/server jdbc Driver * RmiJdbc relies on Java RMI for jdbc objects distribution */ public class RJAdmin { public static void main(String args[]) { if(args.length <= 0) { printUsage(); return; } String op = args[0]; String url = ""; if(args.length > 1) { url = args[1]; } String user = ""; if(args.length > 2) { user = args[2]; } String passwd = ""; if(args.length > 3) { passwd = args[3]; } try { RJAdmin adm = new RJAdmin(); // Register RmiJdbc Driver in jdbc DriverManager // The call to newInstance() is necessary on some platforms // (with some java VM implementations) Class.forName("RmiJdbc.RJDriver").newInstance(); //System.out.println(url); if(op.toUpperCase().equals("PING")) { boolean cnx=false, info=false; try { DriverPropertyInfo[] drv_inf = adm.pingDriverInfo(url); info = true; cnx = adm.pingDriverConnect(url, user, passwd); } catch(Exception e) { } if(cnx) { System.out.println("[" + url + "] server is alive."); } else { System.out.println("[" + url + "] server is responding, but database connection failed for [" + user + "," + passwd + "]"); } } else if(op.toUpperCase().equals("INFO")) { System.out.println("Asking for driver info, URL=" + url); DriverPropertyInfo[] drv_inf = adm.pingDriverInfo(url); System.out.println("\nJDBC driver info - RmiJdbc server is alive.\n"); if (drv_inf.length == 0) { System.out.println("No JDBC driver info available for this driver"); } else { for (int i = 0;i 0) System.out.print(","); System.out.print(drv_inf[i].choices[j]); } System.out.println("]"); System.out.println("----------------------------------------"); } } System.out.println("Trying database connection, URL=" + url); boolean ret = adm.pingDriverConnect(url, user, passwd); if(ret == true) System.out.println("Connection OK"); } } catch(Exception e) { e.printStackTrace(); } } static void printUsage() { System.out.println("Usage: RJAdmin op url [user] [passwd]"); System.out.println("op is one of PING or INFO"); System.out.println("example: RJAdmin PING jdbc:rmi:jdbc:idb=sample.prp"); } public DriverPropertyInfo[] pingDriverInfo(String driverURL) throws Exception { java.sql.Driver drv = DriverManager.getDriver(driverURL); java.util.Properties p = new java.util.Properties(); return drv.getPropertyInfo(driverURL, p); } public boolean pingDriverConnect(String driverURL, String usr, String passwd) throws Exception { Connection c = DriverManager.getConnection(driverURL, usr, passwd); c.close(); return true; } }; PK Ni+Mzz RJArray.java /** * RmiJdbc client/server JDBC Driver * (C) ExperLog 1999-2000 * * @version 1.0 * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com) */ package RmiJdbc; import java.sql.*; import java.io.InputStream; import java.rmi.RemoteException; import java.util.Map; /** * The mapping in the Java programming language for the SQL type ARRAY. * By default, an Array is a transaction duration reference to an SQL array. * By default, an Array is implemented using an SQL LOCATOR(array) internally. */ public class RJArray implements java.sql.Array, java.io.Serializable { RJArrayInterface rmiArray_; public RJArray(RJArrayInterface a) { rmiArray_ = a; } /** * Retrieves the contents of the SQL array designated by this Array object * in the form of an array in the Java programming language. */ public Object getArray() throws SQLException { try { return rmiArray_.getArray(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Returns an array containing a slice of the SQL array, beginning with the * specified index and containing up to count successive elements of the * SQL array. */ public Object getArray(long index, int count) throws SQLException { try { return rmiArray_.getArray(index, count); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Returns an array containing a slice of the SQL array object designated by * this object, beginning with the specified index and containing up to * count successive elements of the SQL array. */ public Object getArray(long index, int count, Map map) throws SQLException { try { return rmiArray_.getArray(index, count, map); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Retrieves the contents of the SQL array designated by this Array object, * using the specified map for type map customizations. */ public Object getArray(Map map) throws SQLException { try { return rmiArray_.getArray(map); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Returns the JDBC type of the elements in the array designated by this * Array object. */ public int getBaseType() throws SQLException { try { return rmiArray_.getBaseType(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Returns the SQL type name of the elements in the array designated by this * Array object. */ public String getBaseTypeName() throws SQLException { try { return rmiArray_.getBaseTypeName(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Returns a result set that contains the elements of the array * designated by this Array object. */ public java.sql.ResultSet getResultSet() throws SQLException { try { return new RJResultSet(rmiArray_.getResultSet()); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Returns a result set holding the elements of the subarray that starts * at index index and contains up to count successive elements. */ public java.sql.ResultSet getResultSet(long index, int count) throws SQLException { try { return new RJResultSet(rmiArray_.getResultSet(index, count)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Returns a result set holding the elements of the subarray that starts * at index index and contains up to count successive elements. */ public java.sql.ResultSet getResultSet(long index, int count, Map map) throws SQLException { try { return new RJResultSet(rmiArray_.getResultSet(index, count, map)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Returns a result set that contains the elements of the array designated * by this Array object and uses the given map to map the array elements. */ public java.sql.ResultSet getResultSet(Map map) throws SQLException { try { return new RJResultSet(rmiArray_.getResultSet(map)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } }; PK Mi+8ܝ0 0 RJArrayInterface.java /** * RmiJdbc client/server JDBC Driver * (C) ExperLog 1999-2000 * * @version 1.0 * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com) */ package RmiJdbc; import java.sql.*; import java.rmi.RemoteException; import java.util.Map; /** * The mapping in the Java programming language for the SQL type ARRAY. * By default, an Array is a transaction duration reference to an SQL array. * By default, an Array is implemented using an SQL LOCATOR(array) internally. */ public interface RJArrayInterface extends java.rmi.Remote { /** * Retrieves the contents of the SQL array designated by this Array object * in the form of an array in the Java programming language. */ Object getArray() throws RemoteException, SQLException; /** * Returns an array containing a slice of the SQL array, beginning with the * specified index and containing up to count successive elements of the * SQL array. */ Object getArray(long index, int count) throws RemoteException, SQLException; /** * Returns an array containing a slice of the SQL array object designated by * this object, beginning with the specified index and containing up to * count successive elements of the SQL array. */ Object getArray(long index, int count, Map map) throws RemoteException, SQLException; /** * Retrieves the contents of the SQL array designated by this Array object, * using the specified map for type map customizations. */ Object getArray(Map map) throws RemoteException, SQLException; /** * Returns the JDBC type of the elements in the array designated by this * Array object. */ int getBaseType() throws RemoteException, SQLException; /** * Returns the SQL type name of the elements in the array designated by this * Array object. */ String getBaseTypeName() throws RemoteException, SQLException; /** * Returns a result set that contains the elements of the array * designated by this Array object. */ RJResultSetInterface getResultSet() throws RemoteException, SQLException; /** * Returns a result set holding the elements of the subarray that starts * at index index and contains up to count successive elements. */ RJResultSetInterface getResultSet(long index, int count) throws RemoteException, SQLException; /** * Returns a result set holding the elements of the subarray that starts * at index index and contains up to count successive elements. */ RJResultSetInterface getResultSet(long index, int count, Map map) throws RemoteException, SQLException; /** * Returns a result set that contains the elements of the array designated * by this Array object and uses the given map to map the array elements. */ RJResultSetInterface getResultSet(Map map) throws RemoteException, SQLException; }; PK ej+誔@RJArrayServer.java /** * RmiJdbc client/server JDBC Driver * (C) ExperLog 1999-2000 * * @version 1.0 * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com) * Additional SSL Support * Douglas Hammond(djhammond@sympatico.ca) */ package RmiJdbc; import java.sql.*; import java.util.Map; import java.rmi.RemoteException; import java.rmi.server.UnicastRemoteObject; import java.rmi.server.Unreferenced; /** * The mapping in the Java programming language for the SQL type ARRAY. * By default, an Array is a transaction duration reference to an SQL array. * By default, an Array is implemented using an SQL LOCATOR(array) internally. */ public class RJArrayServer extends java.rmi.server.UnicastRemoteObject implements RJArrayInterface, Unreferenced { java.sql.Array jdbcArray_; public RJArrayServer(java.sql.Array a) throws RemoteException { super(RJJdbcServer.rmiJdbcListenerPort, RJJdbcServer.rmiClientSocketFactory, RJJdbcServer.rmiServerSocketFactory); jdbcArray_ = a; } public void unreferenced() { Runtime.getRuntime().gc(); } /** * Retrieves the contents of the SQL array designated by this Array object * in the form of an array in the Java programming language. */ public Object getArray() throws RemoteException, SQLException { return jdbcArray_.getArray(); } /** * Returns an array containing a slice of the SQL array, beginning with the * specified index and containing up to count successive elements of the * SQL array. */ public Object getArray(long index, int count) throws RemoteException, SQLException { return jdbcArray_.getArray(index, count); } /** * Returns an array containing a slice of the SQL array object designated by * this object, beginning with the specified index and containing up to * count successive elements of the SQL array. */ public Object getArray(long index, int count, Map map) throws RemoteException, SQLException { return jdbcArray_.getArray(index, count, map); } /** * Retrieves the contents of the SQL array designated by this Array object, * using the specified map for type map customizations. */ public Object getArray(Map map) throws RemoteException, SQLException { return jdbcArray_.getArray(map); } /** * Returns the JDBC type of the elements in the array designated by this * Array object. */ public int getBaseType() throws RemoteException, SQLException { return jdbcArray_.getBaseType(); } /** * Returns the SQL type name of the elements in the array designated by this * Array object. */ public String getBaseTypeName() throws RemoteException, SQLException { return jdbcArray_.getBaseTypeName(); } /** * Returns a result set that contains the elements of the array * designated by this Array object. */ public RJResultSetInterface getResultSet() throws RemoteException, SQLException { return new RJResultSetServer(jdbcArray_.getResultSet()); } /** * Returns a result set holding the elements of the subarray that starts * at index index and contains up to count successive elements. */ public RJResultSetInterface getResultSet(long index, int count) throws RemoteException, SQLException { return new RJResultSetServer(jdbcArray_.getResultSet(index, count)); } /** * Returns a result set holding the elements of the subarray that starts * at index index and contains up to count successive elements. */ public RJResultSetInterface getResultSet(long index, int count, Map map) throws RemoteException, SQLException { return new RJResultSetServer(jdbcArray_.getResultSet(index, count, map)); } /** * Returns a result set that contains the elements of the array designated * by this Array object and uses the given map to map the array elements. */ public RJResultSetInterface getResultSet(Map map) throws RemoteException, SQLException { return new RJResultSetServer(jdbcArray_.getResultSet(map)); } }; PK Oi+ooi i RJBlob.java /** * RmiJdbc client/server JDBC Driver * (C) ExperLog 1999-2000 * * @version 1.0 * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com) */ package RmiJdbc; import java.sql.*; import java.io.InputStream; import java.rmi.RemoteException; /** * The representation (mapping) in the JavaTM programming language of an * SQL BLOB. An SQL BLOB is * a built-in type that stores a Binary Large Object as a column value in * a row of a database table. The * driver implements Blob using an SQL locator(BLOB), which means that * a Blob object contains a logical pointer to the SQL BLOB data rather * than the data itself. A Blob object is valid for * the duration of the transaction in which is was created. * * Methods in the interfaces ResultSet, CallableStatement, and * PreparedStatement, such as getBlob and setBlob allow a programmer * to access the SQL BLOB. The Blob interface provides methods for getting * the length of an SQL BLOB (Binary Large Object) value, for * materializing a BLOB value on the client, and for determining the position * of a pattern of bytes within a BLOB value. */ public class RJBlob implements java.sql.Blob, java.io.Serializable { RJBlobInterface rmiBlob_; public RJBlob(RJBlobInterface b) { rmiBlob_ = b; } public long length() throws SQLException { try { return rmiBlob_.length(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public byte[] getBytes(long pos, int length) throws SQLException { try { return rmiBlob_.getBytes(pos, length); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } // TBD There's a hack there (InputStream not serializable) public InputStream getBinaryStream() throws SQLException { try { byte[] val = rmiBlob_.getBinaryStream(); return RJSerializer.toInputStream(val); } catch(Exception e) { throw new java.sql.SQLException(e.getMessage()); } } public long position(byte[] pattern, long start) throws SQLException { try { return rmiBlob_.position(pattern, start); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public long position(Blob pattern, long start) throws SQLException { try { // Serialize the blob by calling its getBytes() method, then call the // other position() method - the one that receives a byte array. return rmiBlob_.position(pattern.getBytes(0, (int)pattern.length()), start); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } }; PK Mi+eC@@RJBlobInterface.java /** * RmiJdbc client/server JDBC Driver * (C) ExperLog 1999-2000 * * @version 1.0 * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com) */ package RmiJdbc; import java.sql.*; import java.rmi.RemoteException; /** * The representation (mapping) in the JavaTM programming language of an * SQL BLOB. An SQL BLOB is * a built-in type that stores a Binary Large Object as a column value in * a row of a database table. The * driver implements Blob using an SQL locator(BLOB), which means that * a Blob object contains a logical pointer to the SQL BLOB data rather * than the data itself. A Blob object is valid for * the duration of the transaction in which is was created. * * Methods in the interfaces ResultSet, CallableStatement, and * PreparedStatement, such as getBlob and setBlob allow a programmer * to access the SQL BLOB. The Blob interface provides methods for getting * the length of an SQL BLOB (Binary Large Object) value, for * materializing a BLOB value on the client, and for determining the position * of a pattern of bytes within a BLOB value. */ public interface RJBlobInterface extends java.rmi.Remote { long length() throws RemoteException, SQLException; byte[] getBytes(long pos, int length) throws RemoteException, SQLException; // TBD There's a hack there (InputStream not serializable) byte[] getBinaryStream() throws RemoteException, SQLException; long position(byte[] pattern, long start) throws RemoteException, SQLException; long position(Blob pattern, long start) throws RemoteException, SQLException; }; PK Mi+FD RJBlobServer.java /** * RmiJdbc client/server JDBC Driver * (C) ExperLog 1999-2000 * * @version 1.0 * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com) * Additional SSL Support * Douglas Hammond(djhammond@sympatico.ca) */ package RmiJdbc; import java.sql.*; import java.io.IOException; import java.io.InputStream; import java.rmi.RemoteException; import java.rmi.server.UnicastRemoteObject; import java.rmi.server.Unreferenced; /** * The representation (mapping) in the JavaTM programming language of an * SQL BLOB. An SQL BLOB is * a built-in type that stores a Binary Large Object as a column value in * a row of a database table. The * driver implements Blob using an SQL locator(BLOB), which means that * a Blob object contains a logical pointer to the SQL BLOB data rather * than the data itself. A Blob object is valid for * the duration of the transaction in which is was created. * * Methods in the interfaces ResultSet, CallableStatement, and * PreparedStatement, such as getBlob and setBlob allow a programmer * to access the SQL BLOB. The Blob interface provides methods for getting * the length of an SQL BLOB (Binary Large Object) value, for * materializing a BLOB value on the client, and for determining the position * of a pattern of bytes within a BLOB value. */ public class RJBlobServer extends java.rmi.server.UnicastRemoteObject implements RJBlobInterface, Unreferenced { java.sql.Blob jdbcBlob_; public RJBlobServer(java.sql.Blob b) throws RemoteException { super(RJJdbcServer.rmiJdbcListenerPort, RJJdbcServer.rmiClientSocketFactory, RJJdbcServer.rmiServerSocketFactory); jdbcBlob_ = b; } public void unreferenced() { Runtime.getRuntime().gc(); } public long length() throws RemoteException, SQLException { return jdbcBlob_.length(); } public byte[] getBytes(long pos, int length) throws RemoteException, SQLException { return jdbcBlob_.getBytes(pos, length); } // TBD There's a hack there (InputStream not serializable) // public InputStream getBinaryStream() throws RemoteException, SQLException { public byte[] getBinaryStream() throws RemoteException, SQLException { try { InputStream s = jdbcBlob_.getBinaryStream(); return RJSerializer.toByteArray(s); } catch(IOException e) { throw new java.rmi.RemoteException( "RJBlobServer::getBinaryStream()", e); } } public long position(byte[] pattern, long start) throws RemoteException, SQLException { return jdbcBlob_.position(pattern, start); } public long position(Blob pattern, long start) throws RemoteException, SQLException { return jdbcBlob_.position(pattern, start); } }; PK Oi+s 88RJCallableStatement.java /** * RmiJdbc client/server JDBC Driver * (C) GIE Dyade (Groupe BULL / INRIA Research Center) 1997 * * @version 1.0 * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com) */ package RmiJdbc; import java.sql.*; import java.math.BigDecimal; import java.util.Calendar; import java.rmi.RemoteException; /** *

CallableStatement is used to execute SQL stored procedures. * *

JDBC provides a stored procedure SQL escape that allows stored * procedures to be called in a standard way for all RDBMS's. This * escape syntax has one form that includes a result parameter and one * that does not. If used, the result parameter must be registered as * an OUT parameter. The other parameters may be used for input, * output or both. Parameters are refered to sequentially, by * number. The first parameter is 1. * *

* {?= call [,, ...]}
* {call [,, ...]} *
* *

IN parameter values are set using the set methods inherited from * PreparedStatement. The type of all OUT parameters must be * registered prior to executing the stored procedure; their values * are retrieved after execution via the get methods provided here. * *

A Callable statement may return a ResultSet or multiple * ResultSets. Multiple ResultSets are handled using operations * inherited from Statement. * *

For maximum portability, a call's ResultSets and update counts * should be processed prior to getting the values of output * parameters. * * @see Connection#prepareCall * @see ResultSet */ public class RJCallableStatement extends RJPreparedStatement implements java.sql.CallableStatement, java.io.Serializable { RJCallableStatementInterface rmiCallableStmt_; public RJCallableStatement(RJCallableStatementInterface c) { super(c); rmiCallableStmt_ = c; } /** * Before executing a stored procedure call, you must explicitly * call registerOutParameter to register the java.sql.Type of each * out parameter. * *

Note: When reading the value of an out parameter, you * must use the getXXX method whose Java type XXX corresponds to the * parameter's registered SQL type. * * @param parameterIndex the first parameter is 1, the second is 2,... * @param sqlType SQL type code defined by java.sql.Types; * for parameters of type Numeric or Decimal use the version of * registerOutParameter that accepts a scale value * @see Type */ public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException { try { rmiCallableStmt_.registerOutParameter(parameterIndex, sqlType); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Use this version of registerOutParameter for registering * Numeric or Decimal out parameters. * *

Note: When reading the value of an out parameter, you * must use the getXXX method whose Java type XXX corresponds to the * parameter's registered SQL type. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param sqlType use either java.sql.Type.NUMERIC or java.sql.Type.DECIMAL * @param scale a value greater than or equal to zero representing the * desired number of digits to the right of the decimal point * @see Type */ public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException { try { rmiCallableStmt_.registerOutParameter(parameterIndex, sqlType, scale); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * An OUT parameter may have the value of SQL NULL; wasNull reports * whether the last value read has this special value. * *

Note: You must first call getXXX on a parameter to * read its value and then call wasNull() to see if the value was * SQL NULL. * * @return true if the last parameter read was SQL NULL */ public boolean wasNull() throws SQLException { try { return rmiCallableStmt_.wasNull(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a CHAR, VARCHAR, or LONGVARCHAR parameter as a Java String. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is null */ public String getString(int parameterIndex) throws SQLException { try { return rmiCallableStmt_.getString(parameterIndex); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a BIT parameter as a Java boolean. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is false */ public boolean getBoolean(int parameterIndex) throws SQLException { try { return rmiCallableStmt_.getBoolean(parameterIndex); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a TINYINT parameter as a Java byte. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is 0 */ public byte getByte(int parameterIndex) throws SQLException { try { return rmiCallableStmt_.getByte(parameterIndex); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a SMALLINT parameter as a Java short. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is 0 */ public short getShort(int parameterIndex) throws SQLException { try { return rmiCallableStmt_.getShort(parameterIndex); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of an INTEGER parameter as a Java int. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is 0 */ public int getInt(int parameterIndex) throws SQLException { try { return rmiCallableStmt_.getInt(parameterIndex); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a BIGINT parameter as a Java long. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is 0 */ public long getLong(int parameterIndex) throws SQLException { try { return rmiCallableStmt_.getLong(parameterIndex); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a FLOAT parameter as a Java float. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is 0 */ public float getFloat(int parameterIndex) throws SQLException { try { return rmiCallableStmt_.getFloat(parameterIndex); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a DOUBLE parameter as a Java double. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is 0 */ public double getDouble(int parameterIndex) throws SQLException { try { return rmiCallableStmt_.getDouble(parameterIndex); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a NUMERIC parameter as a java.math.BigDecimal object. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param scale a value greater than or equal to zero representing the * desired number of digits to the right of the decimal point * @return the parameter value; if the value is SQL NULL, the result is null */ public java.math.BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException { try { return rmiCallableStmt_.getBigDecimal(parameterIndex, scale); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a SQL BINARY or VARBINARY parameter as a Java byte[] * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is null */ public byte[] getBytes(int parameterIndex) throws SQLException { try { return rmiCallableStmt_.getBytes(parameterIndex); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a SQL DATE parameter as a java.sql.Date object * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is null */ public java.sql.Date getDate(int parameterIndex) throws SQLException { try { return rmiCallableStmt_.getDate(parameterIndex); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a SQL TIME parameter as a java.sql.Time object. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is null */ public java.sql.Time getTime(int parameterIndex) throws SQLException { try { return rmiCallableStmt_.getTime(parameterIndex); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a SQL TIMESTAMP parameter as a java.sql.Timestamp object. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is null */ public java.sql.Timestamp getTimestamp(int parameterIndex) throws SQLException { try { return rmiCallableStmt_.getTimestamp(parameterIndex); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } //---------------------------------------------------------------------- // Advanced features: /** * Get the value of a parameter as a Java object. * *

This method returns a Java object whose type coresponds to the SQL * type that was registered for this parameter using registerOutParameter. * *

Note that this method may be used to read * datatabase-specific, abstract data types. This is done by * specifying a targetSqlType of java.sql.types.OTHER, which * allows the driver to return a database-specific Java type. * * @param parameterIndex The first parameter is 1, the second is 2, ... * @return A java.lang.Object holding the OUT parameter value. * @see Types */ public Object getObject(int parameterIndex) throws SQLException { try { return rmiCallableStmt_.getObject(parameterIndex); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } // JDBC 2.0 methods // Added by Mike Jennings (mjenning@islandnet.com) // sometime in the summer of 1999 // Implementation added Aug 2000 by Peter Hearty (peter.hearty@lutris.com). public void registerOutParameter(int paramIndex, int sqlType, String typeName) throws SQLException { try { rmiCallableStmt_.registerOutParameter(paramIndex, sqlType, typeName); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public Timestamp getTimestamp(int parameterIndex, java.util.Calendar cal) throws SQLException { try { return rmiCallableStmt_.getTimestamp(parameterIndex,cal); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public Time getTime(int parameterIndex, java.util.Calendar cal) throws SQLException { try { return rmiCallableStmt_.getTime(parameterIndex,cal); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public Ref getRef(int i) throws SQLException { try { return new RJRef(rmiCallableStmt_.getRef(i)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public Object getObject(int i,java.util.Map map) throws SQLException { try { return rmiCallableStmt_.getObject(i,map); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public Date getDate(int parameterIndex,java.util.Calendar cal) throws SQLException { try { return rmiCallableStmt_.getDate(parameterIndex,cal) ; } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public Clob getClob(int i) throws SQLException { try { return new RJClob(rmiCallableStmt_.getClob(i)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public Blob getBlob(int i) throws SQLException { try { return new RJBlob(rmiCallableStmt_.getBlob(i)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public java.math.BigDecimal getBigDecimal(int parameterIndex) throws SQLException { try { return rmiCallableStmt_.getBigDecimal(parameterIndex); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public Array getArray(int i) throws SQLException { try { return new RJArray(rmiCallableStmt_.getArray(i)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } // end of java 1.2 stuff }; PK Mi+fŭBB!RJCallableStatementInterface.java /** * RmiJdbc client/server JDBC Driver * (C) GIE Dyade (Groupe BULL / INRIA Research Center) 1997 * * @version 1.0 * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com) */ package RmiJdbc; import java.sql.*; import java.math.BigDecimal; import java.util.Calendar; /** *

CallableStatement is used to execute SQL stored procedures. * *

JDBC provides a stored procedure SQL escape that allows stored * procedures to be called in a standard way for all RDBMS's. This * escape syntax has one form that includes a result parameter and one * that does not. If used, the result parameter must be registered as * an OUT parameter. The other parameters may be used for input, * output or both. Parameters are refered to sequentially, by * number. The first parameter is 1. * *

* {?= call [,, ...]}
* {call [,, ...]} *
* *

IN parameter values are set using the set methods inherited from * PreparedStatement. The type of all OUT parameters must be * registered prior to executing the stored procedure; their values * are retrieved after execution via the get methods provided here. * *

A Callable statement may return a ResultSet or multiple * ResultSets. Multiple ResultSets are handled using operations * inherited from Statement. * *

For maximum portability, a call's ResultSets and update counts * should be processed prior to getting the values of output * parameters. * * @see Connection#prepareCall * @see ResultSet */ public interface RJCallableStatementInterface extends RJPreparedStatementInterface { /** * Before executing a stored procedure call, you must explicitly * call registerOutParameter to register the java.sql.Type of each * out parameter. * *

Note: When reading the value of an out parameter, you * must use the getXXX method whose Java type XXX corresponds to the * parameter's registered SQL type. * * @param parameterIndex the first parameter is 1, the second is 2,... * @param sqlType SQL type code defined by java.sql.Types; * for parameters of type Numeric or Decimal use the version of * registerOutParameter that accepts a scale value * @see Type */ void registerOutParameter(int parameterIndex, int sqlType) throws java.rmi.RemoteException, SQLException; /** * Use this version of registerOutParameter for registering * Numeric or Decimal out parameters. * *

Note: When reading the value of an out parameter, you * must use the getXXX method whose Java type XXX corresponds to the * parameter's registered SQL type. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param sqlType use either java.sql.Type.NUMERIC or java.sql.Type.DECIMAL * @param scale a value greater than or equal to zero representing the * desired number of digits to the right of the decimal point * @see Type */ void registerOutParameter(int parameterIndex, int sqlType, int scale) throws java.rmi.RemoteException, SQLException; /** * An OUT parameter may have the value of SQL NULL; wasNull reports * whether the last value read has this special value. * *

Note: You must first call getXXX on a parameter to * read its value and then call wasNull() to see if the value was * SQL NULL. * * @return true if the last parameter read was SQL NULL */ boolean wasNull() throws java.rmi.RemoteException, SQLException; /** * Get the value of a CHAR, VARCHAR, or LONGVARCHAR parameter as a Java String. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is null */ String getString(int parameterIndex) throws java.rmi.RemoteException, SQLException; /** * Get the value of a BIT parameter as a Java boolean. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is false */ boolean getBoolean(int parameterIndex) throws java.rmi.RemoteException, SQLException; /** * Get the value of a TINYINT parameter as a Java byte. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is 0 */ byte getByte(int parameterIndex) throws java.rmi.RemoteException, SQLException; /** * Get the value of a SMALLINT parameter as a Java short. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is 0 */ short getShort(int parameterIndex) throws java.rmi.RemoteException, SQLException; /** * Get the value of an INTEGER parameter as a Java int. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is 0 */ int getInt(int parameterIndex) throws java.rmi.RemoteException, SQLException; /** * Get the value of a BIGINT parameter as a Java long. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is 0 */ long getLong(int parameterIndex) throws java.rmi.RemoteException, SQLException; /** * Get the value of a FLOAT parameter as a Java float. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is 0 */ float getFloat(int parameterIndex) throws java.rmi.RemoteException, SQLException; /** * Get the value of a DOUBLE parameter as a Java double. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is 0 */ double getDouble(int parameterIndex) throws java.rmi.RemoteException, SQLException; /** * Get the value of a NUMERIC parameter as a java.math.BigDecimal object. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param scale a value greater than or equal to zero representing the * desired number of digits to the right of the decimal point * @return the parameter value; if the value is SQL NULL, the result is null */ java.math.BigDecimal getBigDecimal(int parameterIndex, int scale) throws java.rmi.RemoteException, SQLException; /** * Get the value of a SQL BINARY or VARBINARY parameter as a Java byte[] * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is null */ byte[] getBytes(int parameterIndex) throws java.rmi.RemoteException, SQLException; /** * Get the value of a SQL DATE parameter as a java.sql.Date object * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is null */ java.sql.Date getDate(int parameterIndex) throws java.rmi.RemoteException, SQLException; /** * Get the value of a SQL TIME parameter as a java.sql.Time object. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is null */ java.sql.Time getTime(int parameterIndex) throws java.rmi.RemoteException, SQLException; /** * Get the value of a SQL TIMESTAMP parameter as a java.sql.Timestamp object. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is null */ java.sql.Timestamp getTimestamp(int parameterIndex) throws java.rmi.RemoteException, SQLException; //---------------------------------------------------------------------- // Advanced features: /** * Get the value of a parameter as a Java object. * *

This method returns a Java object whose type coresponds to the SQL * type that was registered for this parameter using registerOutParameter. * *

Note that this method may be used to read * datatabase-specific, abstract data types. This is done by * specifying a targetSqlType of java.sql.types.OTHER, which * allows the driver to return a database-specific Java type. * * @param parameterIndex The first parameter is 1, the second is 2, ... * @return A java.lang.Object holding the OUT parameter value. * @see Types */ Object getObject(int parameterIndex) throws java.rmi.RemoteException, SQLException; //--------------------------JDBC 2.0----------------------------- /** * JDBC 2.0 * * Gets the value of a JDBC NUMERIC parameter as a * java.math.BigDecimal object with as many digits to the * right of the decimal point as the value contains. * @param parameterIndex the first parameter is 1, the second is 2, * and so on * @return the parameter value in full precision. If the value is * SQL NULL, the result is null. * @exception SQLException if a database access error occurs */ BigDecimal getBigDecimal(int parameterIndex) throws java.rmi.RemoteException, SQLException; /** * JDBC 2.0 * * Returns an object representing the value of OUT parameter * i and uses map for the custom * mapping of the parameter value. *

* This method returns a Java object whose type corresponds to the * JDBC type that was registered for this parameter using the method * registerOutParameter. By registering the target * JDBC type as java.sql.Types.OTHER, this method can * be used to read database-specific abstract data types. * @param i the first parameter is 1, the second is 2, and so on * @param map the mapping from SQL type names to Java classes * @return a java.lang.Object holding the OUT parameter value. * @exception SQLException if a database access error occurs */ Object getObject (int i, java.util.Map map) throws java.rmi.RemoteException, SQLException; /** * JDBC 2.0 * * Gets the value of a JDBC REF(<structured-type>) * parameter as a {@link Ref} object in the Java programming language. * @param i the first parameter is 1, the second is 2, * and so on * @return the parameter value as a Ref object in the * Java programming language. If the value was SQL NULL, the value * null is returned. * @exception SQLException if a database access error occurs */ RJRefInterface getRef(int i) throws java.rmi.RemoteException, SQLException; /** * JDBC 2.0 * * Gets the value of a JDBC BLOB parameter as a * {@link Blob} object in the Java programming language. * @param i the first parameter is 1, the second is 2, and so on * @return the parameter value as a Blob object in the * Java programming language. If the value was SQL NULL, the value * null is returned. * @exception SQLException if a database access error occurs */ RJBlobInterface getBlob(int i) throws java.rmi.RemoteException, SQLException; /** * JDBC 2.0 * * Gets the value of a JDBC CLOB parameter as a * Clob object in the Java programming language. * @param i the first parameter is 1, the second is 2, and * so on * @return the parameter value as a Clob object in the * Java programming language. If the value was SQL NULL, the * value null is returned. * @exception SQLException if a database access error occurs */ RJClobInterface getClob (int i) throws java.rmi.RemoteException, SQLException; /** * JDBC 2.0 * * Gets the value of a JDBC ARRAY parameter as an * {@link Array} object in the Java programming language. * @param i the first parameter is 1, the second is 2, and * so on * @return the parameter value as an Array object in * the Java programming language. If the value was SQL NULL, the * value null is returned. * @exception SQLException if a database access error occurs */ RJArrayInterface getArray (int i) throws java.rmi.RemoteException, SQLException; /** * Gets the value of a JDBC DATE parameter as a * java.sql.Date object, using * the given Calendar object * to construct the date. * With a Calendar object, the driver * can calculate the date taking into account a custom timezone and locale. * If no Calendar object is specified, the driver uses the * default timezone and locale. * * @param parameterIndex the first parameter is 1, the second is 2, * and so on * @param cal the Calendar object the driver will use * to construct the date * @return the parameter value. If the value is SQL NULL, the result is * null. * @exception SQLException if a database access error occurs */ java.sql.Date getDate(int parameterIndex, Calendar cal) throws java.rmi.RemoteException, SQLException; /** * Gets the value of a JDBC TIME parameter as a * java.sql.Time object, using * the given Calendar object * to construct the time. * With a Calendar object, the driver * can calculate the time taking into account a custom timezone and locale. * If no Calendar object is specified, the driver uses the * default timezone and locale. * * @param parameterIndex the first parameter is 1, the second is 2, * and so on * @param cal the Calendar object the driver will use * to construct the time * @return the parameter value; if the value is SQL NULL, the result is * null. * @exception SQLException if a database access error occurs */ java.sql.Time getTime(int parameterIndex, Calendar cal) throws java.rmi.RemoteException, SQLException; /** * Gets the value of a JDBC TIMESTAMP parameter as a * java.sql.Timestamp object, using * the given Calendar object to construct * the Timestamp object. * With a Calendar object, the driver * can calculate the timestamp taking into account a custom timezone and locale. * If no Calendar object is specified, the driver uses the * default timezone and locale. * * * @param parameterIndex the first parameter is 1, the second is 2, * and so on * @param cal the Calendar object the driver will use * to construct the timestamp * @return the parameter value. If the value is SQL NULL, the result is * null. * @exception SQLException if a database access error occurs */ java.sql.Timestamp getTimestamp(int parameterIndex, Calendar cal) throws java.rmi.RemoteException, SQLException; /** * JDBC 2.0 * * Registers the designated output parameter. This version of * the method registerOutParameter * should be used for a user-named or REF output parameter. Examples * of user-named types include: STRUCT, DISTINCT, JAVA_OBJECT, and * named array types. * * Before executing a stored procedure call, you must explicitly * call registerOutParameter to register the type from * java.sql.Types for each * OUT parameter. For a user-named parameter the fully-qualified SQL * type name of the parameter should also be given, while a REF * parameter requires that the fully-qualified type name of the * referenced type be given. A JDBC driver that does not need the * type code and type name information may ignore it. To be portable, * however, applications should always provide these values for * user-named and REF parameters. * * Although it is intended for user-named and REF parameters, * this method may be used to register a parameter of any JDBC type. * If the parameter does not have a user-named or REF type, the * typeName parameter is ignored. * *

Note: When reading the value of an out parameter, you * must use the getXXX method whose Java type XXX corresponds to the * parameter's registered SQL type. * * @param parameterIndex the first parameter is 1, the second is 2,... * @param sqlType a value from {@link java.sql.Types} * @param typeName the fully-qualified name of an SQL structured type * @exception SQLException if a database-access error occurs * @see Types */ void registerOutParameter (int paramIndex, int sqlType, String typeName) throws java.rmi.RemoteException, SQLException; }; PK Mi+ӇH//RJCallableStatementServer.java /** * RmiJdbc client/server JDBC Driver * (C) GIE Dyade (Groupe BULL / INRIA Research Center) 1997 * * @version 1.0 * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com) */ package RmiJdbc; import java.sql.*; import java.rmi.*; import java.rmi.server.Unreferenced; /** *

CallableStatement is used to execute SQL stored procedures. * *

JDBC provides a stored procedure SQL escape that allows stored * procedures to be called in a standard way for all RDBMS's. This * escape syntax has one form that includes a result parameter and one * that does not. If used, the result parameter must be registered as * an OUT parameter. The other parameters may be used for input, * output or both. Parameters are refered to sequentially, by * number. The first parameter is 1. * *

* {?= call [,, ...]}
* {call [,, ...]} *
* *

IN parameter values are set using the set methods inherited from * PreparedStatement. The type of all OUT parameters must be * registered prior to executing the stored procedure; their values * are retrieved after execution via the get methods provided here. * *

A Callable statement may return a ResultSet or multiple * ResultSets. Multiple ResultSets are handled using operations * inherited from Statement. * *

For maximum portability, a call's ResultSets and update counts * should be processed prior to getting the values of output * parameters. * * @see Connection#prepareCall * @see ResultSet */ public class RJCallableStatementServer extends RJPreparedStatementServer implements RJCallableStatementInterface, Unreferenced { java.sql.CallableStatement jdbcCallableStmt_; public RJCallableStatementServer(java.sql.CallableStatement c) throws java.rmi.RemoteException { super(c); jdbcCallableStmt_ = c; } public void unreferenced() { Runtime.getRuntime().gc(); } /** * Before executing a stored procedure call, you must explicitly * call registerOutParameter to register the java.sql.Type of each * out parameter. * *

Note: When reading the value of an out parameter, you * must use the getXXX method whose Java type XXX corresponds to the * parameter's registered SQL type. * * @param parameterIndex the first parameter is 1, the second is 2,... * @param sqlType SQL type code defined by java.sql.Types; * for parameters of type Numeric or Decimal use the version of * registerOutParameter that accepts a scale value * @see Type */ public void registerOutParameter(int parameterIndex, int sqlType) throws RemoteException, SQLException { jdbcCallableStmt_.registerOutParameter(parameterIndex, sqlType); } /** * Use this version of registerOutParameter for registering * Numeric or Decimal out parameters. * *

Note: When reading the value of an out parameter, you * must use the getXXX method whose Java type XXX corresponds to the * parameter's registered SQL type. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param sqlType use either java.sql.Type.NUMERIC or java.sql.Type.DECIMAL * @param scale a value greater than or equal to zero representing the * desired number of digits to the right of the decimal point * @see Type */ public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws RemoteException, SQLException { jdbcCallableStmt_.registerOutParameter(parameterIndex, sqlType, scale); } /** * An OUT parameter may have the value of SQL NULL; wasNull reports * whether the last value read has this special value. * *

Note: You must first call getXXX on a parameter to * read its value and then call wasNull() to see if the value was * SQL NULL. * * @return true if the last parameter read was SQL NULL */ public boolean wasNull() throws RemoteException, SQLException { return jdbcCallableStmt_.wasNull(); } /** * Get the value of a CHAR, VARCHAR, or LONGVARCHAR parameter as a Java String. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is null */ public String getString(int parameterIndex) throws RemoteException, SQLException { return jdbcCallableStmt_.getString(parameterIndex); } /** * Get the value of a BIT parameter as a Java boolean. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is false */ public boolean getBoolean(int parameterIndex) throws RemoteException, SQLException { return jdbcCallableStmt_.getBoolean(parameterIndex); } /** * Get the value of a TINYINT parameter as a Java byte. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is 0 */ public byte getByte(int parameterIndex) throws RemoteException, SQLException { return jdbcCallableStmt_.getByte(parameterIndex); } /** * Get the value of a SMALLINT parameter as a Java short. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is 0 */ public short getShort(int parameterIndex) throws RemoteException, SQLException { return jdbcCallableStmt_.getShort(parameterIndex); } /** * Get the value of an INTEGER parameter as a Java int. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is 0 */ public int getInt(int parameterIndex) throws RemoteException, SQLException { return jdbcCallableStmt_.getInt(parameterIndex); } /** * Get the value of a BIGINT parameter as a Java long. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is 0 */ public long getLong(int parameterIndex) throws RemoteException, SQLException { return jdbcCallableStmt_.getLong(parameterIndex); } /** * Get the value of a FLOAT parameter as a Java float. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is 0 */ public float getFloat(int parameterIndex) throws RemoteException, SQLException { return jdbcCallableStmt_.getFloat(parameterIndex); } /** * Get the value of a DOUBLE parameter as a Java double. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is 0 */ public double getDouble(int parameterIndex) throws RemoteException, SQLException { return jdbcCallableStmt_.getDouble(parameterIndex); } /** * Get the value of a NUMERIC parameter as a java.math.BigDecimal object. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param scale a value greater than or equal to zero representing the * desired number of digits to the right of the decimal point * @return the parameter value; if the value is SQL NULL, the result is null */ public java.math.BigDecimal getBigDecimal(int parameterIndex, int scale) throws RemoteException, SQLException { return jdbcCallableStmt_.getBigDecimal(parameterIndex, scale); } /** * Get the value of a SQL BINARY or VARBINARY parameter as a Java byte[] * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is null */ public byte[] getBytes(int parameterIndex) throws RemoteException, SQLException { return jdbcCallableStmt_.getBytes(parameterIndex); } /** * Get the value of a SQL DATE parameter as a java.sql.Date object * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is null */ public java.sql.Date getDate(int parameterIndex) throws RemoteException, SQLException { return jdbcCallableStmt_.getDate(parameterIndex); } /** * Get the value of a SQL TIME parameter as a java.sql.Time object. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is null */ public java.sql.Time getTime(int parameterIndex) throws RemoteException, SQLException { return jdbcCallableStmt_.getTime(parameterIndex); } /** * Get the value of a SQL TIMESTAMP parameter as a java.sql.Timestamp object. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @return the parameter value; if the value is SQL NULL, the result is null */ public java.sql.Timestamp getTimestamp(int parameterIndex) throws RemoteException, SQLException { return jdbcCallableStmt_.getTimestamp(parameterIndex); } //---------------------------------------------------------------------- // Advanced features: /** * Get the value of a parameter as a Java object. * *

This method returns a Java object whose type coresponds to the SQL * type that was registered for this parameter using registerOutParameter. * *

Note that this method may be used to read * datatabase-specific, abstract data types. This is done by * specifying a targetSqlType of java.sql.types.OTHER, which * allows the driver to return a database-specific Java type. * * @param parameterIndex The first parameter is 1, the second is 2, ... * @return A java.lang.Object holding the OUT parameter value. * @see Types */ public Object getObject(int parameterIndex) throws RemoteException, SQLException { return jdbcCallableStmt_.getObject(parameterIndex); } //1.2 Added by Peter Hearty (peter.hearty@lutris.com) Aug 2000. public void registerOutParameter(int paramIndex, int sqlType, String typeName) throws RemoteException, SQLException { jdbcCallableStmt_.registerOutParameter(paramIndex, sqlType, typeName); } public Timestamp getTimestamp(int parameterIndex, java.util.Calendar cal) throws RemoteException, SQLException { return jdbcCallableStmt_.getTimestamp(parameterIndex,cal); } public Time getTime(int parameterIndex, java.util.Calendar cal) throws RemoteException, SQLException { return jdbcCallableStmt_.getTime(parameterIndex,cal); } public RJRefInterface getRef(int i) throws RemoteException, SQLException { return new RJRefServer(jdbcCallableStmt_.getRef(i)); } public Object getObject(int i,java.util.Map map) throws RemoteException, SQLException { return jdbcCallableStmt_.getObject(i,map); } public Date getDate(int parameterIndex,java.util.Calendar cal) throws RemoteException, SQLException { return jdbcCallableStmt_.getDate(parameterIndex,cal) ; } public RJClobInterface getClob(int i) throws RemoteException, SQLException { return new RJClobServer(jdbcCallableStmt_.getClob(i)); } public void setTimestamp(int parameterIndex, Timestamp x, java.util.Calendar cal) throws RemoteException, SQLException { jdbcCallableStmt_.setTimestamp(parameterIndex,x,cal); } public RJBlobInterface getBlob(int i) throws RemoteException, SQLException { return new RJBlobServer(jdbcCallableStmt_.getBlob(i)); } public java.math.BigDecimal getBigDecimal(int parameterIndex) throws RemoteException, SQLException { return jdbcCallableStmt_.getBigDecimal(parameterIndex); } public RJArrayInterface getArray(int i) throws RemoteException, SQLException { return new RJArrayServer(jdbcCallableStmt_.getArray(i)); } // end of java 1.2 stuff }; PK }sH+}ƲRJClientSocketFactory.java/* * RMISSLClientSocketFactory.java * * Created on October 7, 2001, 6:18 PM * @Author Douglas Hammond(djhammond@sympatico.ca) */ package RmiJdbc; import java.net.*; import java.io.*; import java.util.*; import javax.net.*; import java.rmi.server.*; /** * Default Socket Factory */ public class RJClientSocketFactory implements RMIClientSocketFactory, Serializable { public Socket createSocket(String host, int port) throws IOException { return new Socket(host, port); } }PK Oi+ࠀXX RJClob.java /** * RmiJdbc client/server JDBC Driver * (C) ExperLog 1999-2000 * * @version 1.0 * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com) */ package RmiJdbc; import java.sql.*; import java.io.InputStream; import java.io.Reader; import java.rmi.RemoteException; public class RJClob implements java.sql.Clob, java.io.Serializable { RJClobInterface rmiClob_; public RJClob(RJClobInterface b) { rmiClob_ = b; } // TBD There's a hack there (Reader not serializable) public Reader getCharacterStream() throws SQLException { try { char[] val = rmiClob_.getCharacterStream(); return RJSerializer.toReader(val); } catch(Exception e) { throw new java.sql.SQLException(e.getMessage()); } } public long length() throws SQLException { try { return rmiClob_.length(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public String getSubString(long pos, int length) throws SQLException { try { return rmiClob_.getSubString(pos, length); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } // TBD There's a hack there (InputStream not serializable) public InputStream getAsciiStream() throws SQLException { try { byte[] val = rmiClob_.getAsciiStream(); return RJSerializer.toInputStream(val); } catch(Exception e) { throw new java.sql.SQLException(e.getMessage()); } } public long position(String searchstr, long start) throws SQLException { try { return rmiClob_.position(searchstr, start); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public long position(Clob searchstr, long start) throws SQLException { try { // Serialize the blob by calling its getBytes() method, then call the // other position() method - the one that receives a byte array. return rmiClob_.position(searchstr.getSubString(0, (int)searchstr.length()), start); } catch(Exception e) { throw new java.sql.SQLException(e.getMessage()); } } }; PK Mi+,c\\RJClobInterface.java /** * RmiJdbc client/server JDBC Driver * (C) ExperLog 1999-2000 * * @version 1.0 * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com) */ package RmiJdbc; import java.sql.*; import java.rmi.RemoteException; public interface RJClobInterface extends java.rmi.Remote { // TBD There's a hack there (InputStream not serializable) byte[] getAsciiStream() throws RemoteException, SQLException; // TBD There's a hack there (Reader not serializable) char[] getCharacterStream() throws RemoteException, SQLException; long length() throws RemoteException, SQLException; String getSubString(long pos, int length) throws RemoteException, SQLException; long position(String searchstr, long start) throws RemoteException, SQLException; long position(Clob searchstr, long start) throws RemoteException, SQLException; }; PK Mi+QzP  RJClobServer.java /** * RmiJdbc client/server JDBC Driver * (C) ExperLog 1999-2000 * * @version 1.0 * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com) * Additional SSL Support * Douglas Hammond(djhammond@sympatico.ca) */ package RmiJdbc; import java.sql.*; import java.io.IOException; import java.io.InputStream; import java.io.Reader; import java.rmi.RemoteException; import java.rmi.server.UnicastRemoteObject; import java.rmi.server.Unreferenced; public class RJClobServer extends java.rmi.server.UnicastRemoteObject implements RJClobInterface, Unreferenced { java.sql.Clob jdbcClob_; public RJClobServer(java.sql.Clob b) throws RemoteException { super(RJJdbcServer.rmiJdbcListenerPort, RJJdbcServer.rmiClientSocketFactory, RJJdbcServer.rmiServerSocketFactory); jdbcClob_ = b; } public void unreferenced() { Runtime.getRuntime().gc(); } // TBD There's a hack there (InputStream not serializable) // public Reader getCharacterStream() throws RemoteException, SQLException { public char[] getCharacterStream() throws RemoteException, SQLException { try { Reader r = jdbcClob_.getCharacterStream(); return RJSerializer.toCharArray(r); } catch(IOException e) { throw new java.rmi.RemoteException( "RJClobServer::getCharacterStream()", e); } } public long length() throws RemoteException, SQLException { return jdbcClob_.length(); } public String getSubString(long pos, int length) throws RemoteException, SQLException { return jdbcClob_.getSubString(pos, length); } // TBD There's a hack there (InputStream not serializable) // public InputStream getAsciiStream() throws RemoteException, SQLException { public byte[] getAsciiStream() throws RemoteException, SQLException { try { InputStream s = jdbcClob_.getAsciiStream(); return RJSerializer.toByteArray(s); } catch(IOException e) { throw new java.rmi.RemoteException( "RJClobServer::getBinaryStream()", e); } } public long position(String searchstr, long start) throws RemoteException, SQLException { return jdbcClob_.position(searchstr, start); } public long position(Clob pattern, long start) throws RemoteException, SQLException { return jdbcClob_.position(pattern, start); } }; PK %Oi+YBBRJConnection.java /** * RmiJdbc client/server JDBC Driver * (C) GIE Dyade (Groupe BULL / INRIA Research Center) 1997 * (C) ExperLog 1999-2000 * * @version 1.0 * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com) */ package RmiJdbc; import java.sql.*; import java.rmi.registry.*; import java.rmi.RemoteException; import java.rmi.NotBoundException; import java.rmi.Naming; import java.util.StringTokenizer; import java.util.Properties; //import javax.transaction.xa.*; /** *

A Connection represents a session with a specific * database. Within the context of a Connection, SQL statements are * executed and results are returned. * *

A Connection's database is able to provide information * describing its tables, its supported SQL grammar, its stored * procedures, the capabilities of this connection, etc. This * information is obtained with the getMetaData method. * *

Note: By default the Connection automatically commits * changes after executing each statement. If auto commit has been * disabled, an explicit commit must be done or database changes will * not be saved. * * @see DriverManager#getConnection * @see Statement * @see ResultSet * @see DatabaseMetaData */ public class RJConnection implements java.sql.Connection, java.io.Serializable { RJConnectionInterface rmiConnection_; protected RJConnection(RJConnectionInterface rmiconn) { rmiConnection_ = rmiconn; } public RJConnection(String reg, String rmiAddr, String url, Properties info) throws Exception { // Reg is of the form: host[:port] StringTokenizer st = new StringTokenizer(reg, ":"); if(!st.hasMoreTokens()) { throw new SQLException("No RMI server host specified in JDBC URL"); } String host = st.nextToken(); int port = 1099; if(st.hasMoreTokens()) { try { port = Integer.parseInt(st.nextToken()); } catch(NumberFormatException e) { port = 1099; } } Registry registry = LocateRegistry.getRegistry(host, port); /** String lst[] = registry.list(); for(int i=0; iNote: This method is optimized for handling * parametric SQL statements that benefit from precompilation. If * the driver supports precompilation, prepareStatement will send * the statement to the database for precompilation. Some drivers * may not support precompilation. In this case, the statement may * not be sent to the database until the PreparedStatement is * executed. This has no direct affect on users; however, it does * affect which method throws certain SQLExceptions. * * @param sql a SQL statement that may contain one or more '?' IN * parameter placeholders * * @return a new PreparedStatement object containing the * pre-compiled statement */ public java.sql.PreparedStatement prepareStatement(String sql) throws SQLException { try { return new RJPreparedStatement(rmiConnection_.prepareStatement(sql)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * A SQL stored procedure call statement is handled by creating a * CallableStatement for it. The CallableStatement provides * methods for setting up its IN and OUT parameters, and * methods for executing it. * *

Note: This method is optimized for handling stored * procedure call statements. Some drivers may send the call * statement to the database when the prepareCall is done; others * may wait until the CallableStatement is executed. This has no * direct affect on users; however, it does affect which method * throws certain SQLExceptions. * * @param sql a SQL statement that may contain one or more '?' * parameter placeholders. Typically this statement is a JDBC * function call escape string. * * @return a new CallableStatement object containing the * pre-compiled SQL statement */ public java.sql.CallableStatement prepareCall(String sql) throws SQLException { try { return new RJCallableStatement(rmiConnection_.prepareCall(sql)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * A driver may convert the JDBC sql grammar into its system's * native SQL grammar prior to sending it; nativeSQL returns the * native form of the statement that the driver would have sent. * * @param sql a SQL statement that may contain one or more '?' * parameter placeholders * * @return the native form of this statement */ public String nativeSQL(String sql) throws SQLException { try { return rmiConnection_.nativeSQL(sql); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * If a connection is in auto-commit mode, then all its SQL * statements will be executed and committed as individual * transactions. Otherwise, its SQL statements are grouped into * transactions that are terminated by either commit() or * rollback(). By default, new connections are in auto-commit * mode. * * The commit occurs when the statement completes or the next * execute occurs, whichever comes first. In the case of * statements returning a ResultSet, the statement completes when * the last row of the ResultSet has been retrieved or the * ResultSet has been closed. In advanced cases, a single * statement may return multiple results as well as output * parameter values. Here the commit occurs when all results and * output param values have been retrieved. * * @param autoCommit true enables auto-commit; false disables * auto-commit. */ public void setAutoCommit(boolean autoCommit) throws SQLException { try { rmiConnection_.setAutoCommit(autoCommit); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the current auto-commit state. * @return Current state of auto-commit mode. * @see #setAutoCommit */ public boolean getAutoCommit() throws SQLException { try { return rmiConnection_.getAutoCommit(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Commit makes all changes made since the previous * commit/rollback permanent and releases any database locks * currently held by the Connection. This method should only be * used when auto commit has been disabled. * * @see #setAutoCommit */ public void commit() throws SQLException { try { rmiConnection_.commit(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Rollback drops all changes made since the previous * commit/rollback and releases any database locks currently held * by the Connection. This method should only be used when auto * commit has been disabled. * * @see #setAutoCommit */ public void rollback() throws SQLException { try { rmiConnection_.rollback(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * In some cases, it is desirable to immediately release a * Connection's database and JDBC resources instead of waiting for * them to be automatically released; the close method provides this * immediate release. * *

Note: A Connection is automatically closed when it is * garbage collected. Certain fatal errors also result in a closed * Connection. */ public void close() throws SQLException { try { rmiConnection_.close(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Tests to see if a Connection is closed. * * @return true if the connection is closed; false if it's still open */ public boolean isClosed() throws SQLException { try { return rmiConnection_.isClosed(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } //====================================================================== // Advanced features: /** * A Connection's database is able to provide information * describing its tables, its supported SQL grammar, its stored * procedures, the capabilities of this connection, etc. This * information is made available through a DatabaseMetaData * object. * * @return a DatabaseMetaData object for this Connection */ public java.sql.DatabaseMetaData getMetaData() throws SQLException { try { return new RJDatabaseMetaData(rmiConnection_.getMetaData()); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * You can put a connection in read-only mode as a hint to enable * database optimizations. * *

Note: setReadOnly cannot be called while in the * middle of a transaction. * * @param readOnly true enables read-only mode; false disables * read-only mode. */ public void setReadOnly(boolean readOnly) throws SQLException { try { rmiConnection_.setReadOnly(readOnly); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Tests to see if the connection is in read-only mode. * * @return true if connection is read-only */ public boolean isReadOnly() throws SQLException { try { return rmiConnection_.isReadOnly(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * A sub-space of this Connection's database may be selected by setting a * catalog name. If the driver does not support catalogs it will * silently ignore this request. */ public void setCatalog(String catalog) throws SQLException { try { rmiConnection_.setCatalog(catalog); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Return the Connection's current catalog name. * * @return the current catalog name or null */ public String getCatalog() throws SQLException { try { return rmiConnection_.getCatalog(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Transactions are not supported. */ int TRANSACTION_NONE = 0; /** * Dirty reads, non-repeatable reads and phantom reads can occur. */ int TRANSACTION_READ_UNCOMMITTED = 1; /** * Dirty reads are prevented; non-repeatable reads and phantom * reads can occur. */ int TRANSACTION_READ_COMMITTED = 2; /** * Dirty reads and non-repeatable reads are prevented; phantom * reads can occur. */ int TRANSACTION_REPEATABLE_READ = 4; /** * Dirty reads, non-repeatable reads and phantom reads are prevented. */ int TRANSACTION_SERIALIZABLE = 8; /** * You can call this method to try to change the transaction * isolation level using one of the TRANSACTION_* values. * *

Note: setTransactionIsolation cannot be called while * in the middle of a transaction. * * @param level one of the TRANSACTION_* isolation values with the * exception of TRANSACTION_NONE; some databases may not support * other values * * @see DatabaseMetaData#supportsTransactionIsolationLevel */ public void setTransactionIsolation(int level) throws SQLException { try { rmiConnection_.setTransactionIsolation(level); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get this Connection's current transaction isolation mode. * * @return the current TRANSACTION_* mode value */ public int getTransactionIsolation() throws SQLException { try { return rmiConnection_.getTransactionIsolation(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * The first warning reported by calls on this Connection is * returned. * *

Note: Subsequent warnings will be chained to this * SQLWarning. * * @return the first SQLWarning or null */ public SQLWarning getWarnings() throws SQLException { try { return rmiConnection_.getWarnings(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * After this call, getWarnings returns null until a new warning is * reported for this Connection. */ public void clearWarnings() throws SQLException { try { rmiConnection_.clearWarnings(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } // JDBC 2.0 methods // Added by Mike Jennings (mjenning@islandnet.com) // sometime in the summer of 1999 // Implementation added by Peter Hearty, Aug 2000, peter.hearty@lutris.com. public void setTypeMap(java.util.Map map) throws SQLException { try { rmiConnection_.setTypeMap(map); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { try { return new RJPreparedStatement( rmiConnection_.prepareStatement(sql, resultSetType, resultSetConcurrency)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { try { return new RJCallableStatement( rmiConnection_.prepareCall(sql,resultSetType,resultSetConcurrency)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public java.util.Map getTypeMap() throws SQLException { try { return rmiConnection_.getTypeMap(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { try { return new RJStatement( rmiConnection_.createStatement(resultSetType,resultSetConcurrency)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** TBD XA public void startGlobalTransaction (Xid xid) throws XAException { try { rmiConnection_.startGlobalTransaction (xid); } catch(RemoteException e) { throw new XAException(e.getMessage()); } } **/ }; PK Mi+=33RJConnectionInterface.java /** * RmiJdbc client/server JDBC Driver * (C) GIE Dyade (Groupe BULL / INRIA Research Center) 1997 * * @version 1.0 * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com) */ package RmiJdbc; import java.sql.*; import java.util.Properties; //import javax.transaction.xa.*; /** *

A Connection represents a session with a specific * database. Within the context of a Connection, SQL statements are * executed and results are returned. * *

A Connection's database is able to provide information * describing its tables, its supported SQL grammar, its stored * procedures, the capabilities of this connection, etc. This * information is obtained with the getMetaData method. * *

Note: By default the Connection automatically commits * changes after executing each statement. If auto commit has been * disabled, an explicit commit must be done or database changes will * not be saved. * * @see DriverManager#getConnection * @see Statement * @see ResultSet * @see DatabaseMetaData */ public interface RJConnectionInterface extends java.rmi.Remote { /** * SQL statements without parameters are normally * executed using Statement objects. If the same SQL statement * is executed many times, it is more efficient to use a * PreparedStatement * * @return a new Statement object */ RJStatementInterface createStatement() throws java.rmi.RemoteException, SQLException; /** * A SQL statement with or without IN parameters can be * pre-compiled and stored in a PreparedStatement object. This * object can then be used to efficiently execute this statement * multiple times. * *

Note: This method is optimized for handling * parametric SQL statements that benefit from precompilation. If * the driver supports precompilation, prepareStatement will send * the statement to the database for precompilation. Some drivers * may not support precompilation. In this case, the statement may * not be sent to the database until the PreparedStatement is * executed. This has no direct affect on users; however, it does * affect which method throws certain SQLExceptions. * * @param sql a SQL statement that may contain one or more '?' IN * parameter placeholders * * @return a new PreparedStatement object containing the * pre-compiled statement */ RJPreparedStatementInterface prepareStatement(String sql) throws java.rmi.RemoteException, SQLException; /** * A SQL stored procedure call statement is handled by creating a * CallableStatement for it. The CallableStatement provides * methods for setting up its IN and OUT parameters, and * methods for executing it. * *

Note: This method is optimized for handling stored * procedure call statements. Some drivers may send the call * statement to the database when the prepareCall is done; others * may wait until the CallableStatement is executed. This has no * direct affect on users; however, it does affect which method * throws certain java.rmi.RemoteExceptions. * * @param sql a SQL statement that may contain one or more '?' * parameter placeholders. Typically this statement is a JDBC * function call escape string. * * @return a new CallableStatement object containing the * pre-compiled SQL statement */ RJCallableStatementInterface prepareCall(String sql) throws java.rmi.RemoteException, SQLException; /** * A driver may convert the JDBC sql grammar into its system's * native SQL grammar prior to sending it; nativeSQL returns the * native form of the statement that the driver would have sent. * * @param sql a SQL statement that may contain one or more '?' * parameter placeholders * * @return the native form of this statement */ String nativeSQL(String sql) throws java.rmi.RemoteException, SQLException; /** * If a connection is in auto-commit mode, then all its SQL * statements will be executed and committed as individual * transactions. Otherwise, its SQL statements are grouped into * transactions that are terminated by either commit() or * rollback(). By default, new connections are in auto-commit * mode. * * The commit occurs when the statement completes or the next * execute occurs, whichever comes first. In the case of * statements returning a ResultSet, the statement completes when * the last row of the ResultSet has been retrieved or the * ResultSet has been closed. In advanced cases, a single * statement may return multiple results as well as output * parameter values. Here the commit occurs when all results and * output param values have been retrieved. * * @param autoCommit true enables auto-commit; false disables * auto-commit. */ void setAutoCommit(boolean autoCommit) throws java.rmi.RemoteException, SQLException; /** * Get the current auto-commit state. * @return Current state of auto-commit mode. * @see #setAutoCommit */ boolean getAutoCommit() throws java.rmi.RemoteException, SQLException; /** * Commit makes all changes made since the previous * commit/rollback permanent and releases any database locks * currently held by the Connection. This method should only be * used when auto commit has been disabled. * * @see #setAutoCommit */ void commit() throws java.rmi.RemoteException, SQLException; /** * Rollback drops all changes made since the previous * commit/rollback and releases any database locks currently held * by the Connection. This method should only be used when auto * commit has been disabled. * * @see #setAutoCommit */ void rollback() throws java.rmi.RemoteException, SQLException; /** * In some cases, it is desirable to immediately release a * Connection's database and JDBC resources instead of waiting for * them to be automatically released; the close method provides this * immediate release. * *

Note: A Connection is automatically closed when it is * garbage collected. Certain fatal errors also result in a closed * Connection. */ void close() throws java.rmi.RemoteException, SQLException; /** * Tests to see if a Connection is closed. * * @return true if the connection is closed; false if it's still open */ boolean isClosed() throws java.rmi.RemoteException, SQLException; //====================================================================== // Advanced features: /** * A Connection's database is able to provide information * describing its tables, its supported SQL grammar, its stored * procedures, the capabilities of this connection, etc. This * information is made available through a DatabaseMetaData * object. * * @return a DatabaseMetaData object for this Connection */ RJDatabaseMetaDataInterface getMetaData() throws java.rmi.RemoteException, SQLException; /** * You can put a connection in read-only mode as a hint to enable * database optimizations. * *

Note: setReadOnly cannot be called while in the * middle of a transaction. * * @param readOnly true enables read-only mode; false disables * read-only mode. */ void setReadOnly(boolean readOnly) throws java.rmi.RemoteException, SQLException; /** * Tests to see if the connection is in read-only mode. * * @return true if connection is read-only */ boolean isReadOnly() throws java.rmi.RemoteException, SQLException; /** * A sub-space of this Connection's database may be selected by setting a * catalog name. If the driver does not support catalogs it will * silently ignore this request. */ void setCatalog(String catalog) throws java.rmi.RemoteException, SQLException; /** * Return the Connection's current catalog name. * * @return the current catalog name or null */ String getCatalog() throws java.rmi.RemoteException, SQLException; /** * You can call this method to try to change the transaction * isolation level using one of the TRANSACTION_* values. * *

Note: setTransactionIsolation cannot be called while * in the middle of a transaction. * * @param level one of the TRANSACTION_* isolation values with the * exception of TRANSACTION_NONE; some databases may not support * other values * * @see DatabaseMetaData#supportsTransactionIsolationLevel */ void setTransactionIsolation(int level) throws java.rmi.RemoteException, SQLException; /** * Get this Connection's current transaction isolation mode. * * @return the current TRANSACTION_* mode value */ int getTransactionIsolation() throws java.rmi.RemoteException, SQLException; /** * The first warning reported by calls on this Connection is * returned. * *

Note: Subsequent warnings will be chained to this * SQLWarning. * * @return the first SQLWarning or null */ SQLWarning getWarnings() throws java.rmi.RemoteException, SQLException; /** * After this call, getWarnings returns null until a new warning is * reported for this Connection. */ void clearWarnings() throws java.rmi.RemoteException, SQLException; //--------------------------JDBC 2.0----------------------------- /** * JDBC 2.0 * * Creates a Statement object that will generate * ResultSet objects with the given type and concurrency. * This method is the same as the createStatement method * above, but it allows the default result set * type and result set concurrency type to be overridden. * * @param resultSetType a result set type; see ResultSet.TYPE_XXX * @param resultSetConcurrency a concurrency type; see ResultSet.CONCUR_XXX * @return a new Statement object * @exception SQLException if a database access error occurs */ RJStatementInterface createStatement(int resultSetType, int resultSetConcurrency) throws java.rmi.RemoteException, SQLException; /** * JDBC 2.0 * * Creates a PreparedStatement object that will generate * ResultSet objects with the given type and concurrency. * This method is the same as the prepareStatement method * above, but it allows the default result set * type and result set concurrency type to be overridden. * * @param resultSetType a result set type; see ResultSet.TYPE_XXX * @param resultSetConcurrency a concurrency type; see ResultSet.CONCUR_XXX * @return a new PreparedStatement object containing the * pre-compiled SQL statement * @exception SQLException if a database access error occurs */ RJPreparedStatementInterface prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws java.rmi.RemoteException, SQLException; /** * JDBC 2.0 * * Creates a CallableStatement object that will generate * ResultSet objects with the given type and concurrency. * This method is the same as the prepareCall method * above, but it allows the default result set * type and result set concurrency type to be overridden. * * @param resultSetType a result set type; see ResultSet.TYPE_XXX * @param resultSetConcurrency a concurrency type; see ResultSet.CONCUR_XXX * @return a new CallableStatement object containing the * pre-compiled SQL statement * @exception SQLException if a database access error occurs */ RJCallableStatementInterface prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws java.rmi.RemoteException, SQLException; /** * JDBC 2.0 * * Gets the type map object associated with this connection. * Unless the application has added an entry to the type map, * the map returned will be empty. * * @return the java.util.Map object associated * with this Connection object */ java.util.Map getTypeMap() throws java.rmi.RemoteException, SQLException; /** * JDBC 2.0 * * Installs the given type map as the type map for * this connection. The type map will be used for the * custom mapping of SQL structured types and distinct types. * * @param the java.util.Map object to install * as the replacement for this Connection * object's default type map */ void setTypeMap(java.util.Map map) throws java.rmi.RemoteException, SQLException; /** ** TBD XA * Informs a connection that it is now part of a Global * transaction. void startGlobalTransaction (Xid xid) throws java.rmi.RemoteException, XAException; */ } PK Mi+뚀55RJConnectionServer.java /** * RmiJdbc client/server JDBC Driver * (C) GIE Dyade (Groupe BULL / INRIA Research Center) 1997 * * @version 1.0 * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com) * Additional SSL Support * Douglas Hammond(djhammond@sympatico.ca) */ package RmiJdbc; import java.sql.*; import java.rmi.*; import java.rmi.server.UnicastRemoteObject; import java.rmi.server.Unreferenced; import java.util.Properties; /**InstantDB import javax.transaction.xa.*; import org.enhydra.instantdb.jdbc.ConnectionExtensions; InstantDB**/ /** *

A Connection represents a session with a specific * database. Within the context of a Connection, SQL statements are * executed and results are returned. * *

A Connection's database is able to provide information * describing its tables, its supported SQL grammar, its stored * procedures, the capabilities of this connection, etc. This * information is obtained with the getMetaData method. * *

Note: By default the Connection automatically commits * changes after executing each statement. If auto commit has been * disabled, an explicit commit must be done or database changes will * not be saved. * * @see DriverManager#getConnection * @see Statement * @see ResultSet * @see DatabaseMetaData */ public class RJConnectionServer extends java.rmi.server.UnicastRemoteObject implements RJConnectionInterface, Unreferenced { java.sql.Connection jdbcConnection_; public RJConnectionServer(java.sql.Connection c) throws RemoteException { super(RJJdbcServer.rmiJdbcListenerPort, RJJdbcServer.rmiClientSocketFactory, RJJdbcServer.rmiServerSocketFactory); jdbcConnection_ = c; } public void unreferenced() { try { if(jdbcConnection_ != null) { jdbcConnection_.close(); jdbcConnection_=null; } } catch(Exception e) { } //System.out.println("RJConnectionServer: unreferenced() -> doing garbage collection"); Runtime.getRuntime().gc(); } protected void finalize() throws Throwable { if (jdbcConnection_ != null) jdbcConnection_.close(); //System.out.println("RJConnectionServer: finalize() -> doing garbage collection"); Runtime.getRuntime().gc(); } /** * SQL statements without parameters are normally * executed using Statement objects. If the same SQL statement * is executed many times, it is more efficient to use a * PreparedStatement * * @return a new Statement object */ public RJStatementInterface createStatement() throws RemoteException, SQLException { return new RJStatementServer(jdbcConnection_.createStatement()); } /** * A SQL statement with or without IN parameters can be * pre-compiled and stored in a PreparedStatement object. This * object can then be used to efficiently execute this statement * multiple times. * *

Note: This method is optimized for handling * parametric SQL statements that benefit from precompilation. If * the driver supports precompilation, prepareStatement will send * the statement to the database for precompilation. Some drivers * may not support precompilation. In this case, the statement may * not be sent to the database until the PreparedStatement is * executed. This has no direct affect on users; however, it does * affect which method throws certain java.rmi.RemoteExceptions. * * @param sql a SQL statement that may contain one or more '?' IN * parameter placeholders * * @return a new PreparedStatement object containing the * pre-compiled statement */ public RJPreparedStatementInterface prepareStatement(String sql) throws RemoteException, SQLException { return new RJPreparedStatementServer(jdbcConnection_.prepareStatement(sql)); } /** * A SQL stored procedure call statement is handled by creating a * CallableStatement for it. The CallableStatement provides * methods for setting up its IN and OUT parameters, and * methods for executing it. * *

Note: This method is optimized for handling stored * procedure call statements. Some drivers may send the call * statement to the database when the prepareCall is done; others * may wait until the CallableStatement is executed. This has no * direct affect on users; however, it does affect which method * throws certain java.rmi.RemoteExceptions. * * @param sql a SQL statement that may contain one or more '?' * parameter placeholders. Typically this statement is a JDBC * function call escape string. * * @return a new CallableStatement object containing the * pre-compiled SQL statement */ public RJCallableStatementInterface prepareCall(String sql) throws RemoteException, SQLException { return new RJCallableStatementServer(jdbcConnection_.prepareCall(sql)); } /** * A driver may convert the JDBC sql grammar into its system's * native SQL grammar prior to sending it; nativeSQL returns the * native form of the statement that the driver would have sent. * * @param sql a SQL statement that may contain one or more '?' * parameter placeholders * * @return the native form of this statement */ public String nativeSQL(String sql) throws RemoteException, SQLException { return jdbcConnection_.nativeSQL(sql); } /** * If a connection is in auto-commit mode, then all its SQL * statements will be executed and committed as individual * transactions. Otherwise, its SQL statements are grouped into * transactions that are terminated by either commit() or * rollback(). By default, new connections are in auto-commit * mode. * * The commit occurs when the statement completes or the next * execute occurs, whichever comes first. In the case of * statements returning a ResultSet, the statement completes when * the last row of the ResultSet has been retrieved or the * ResultSet has been closed. In advanced cases, a single * statement may return multiple results as well as output * parameter values. Here the commit occurs when all results and * output param values have been retrieved. * * @param autoCommit true enables auto-commit; false disables * auto-commit. */ public void setAutoCommit(boolean autoCommit) throws RemoteException, SQLException { jdbcConnection_.setAutoCommit(autoCommit); } /** * Get the current auto-commit state. * @return Current state of auto-commit mode. * @see #setAutoCommit */ public boolean getAutoCommit() throws RemoteException, SQLException { return jdbcConnection_.getAutoCommit(); } /** * Commit makes all changes made since the previous * commit/rollback permanent and releases any database locks * currently held by the Connection. This method should only be * used when auto commit has been disabled. * * @see #setAutoCommit */ public void commit() throws RemoteException, SQLException { jdbcConnection_.commit(); } /** * Rollback drops all changes made since the previous * commit/rollback and releases any database locks currently held * by the Connection. This method should only be used when auto * commit has been disabled. * * @see #setAutoCommit */ public void rollback() throws RemoteException, SQLException { jdbcConnection_.rollback(); } /** * In some cases, it is desirable to immediately release a * Connection's database and JDBC resources instead of waiting for * them to be automatically released; the close method provides this * immediate release. * *

Note: A Connection is automatically closed when it is * garbage collected. Certain fatal errors also result in a closed * Connection. */ public void close() throws RemoteException, SQLException { if(jdbcConnection_ != null) jdbcConnection_.close(); Runtime.getRuntime().gc(); // Request for garbage collection } /** * Tests to see if a Connection is closed. * * @return true if the connection is closed; false if it's still open */ public boolean isClosed() throws RemoteException, SQLException { return jdbcConnection_.isClosed(); } //====================================================================== // Advanced features: /** A Connection's database is able to provide information * describing its tables, its supported SQL grammar, its stored * procedures, the capabilities of this connection, etc. This * information is made available through a DatabaseMetaData * object. * * @return a RJDatabaseMetaData object for this Connection */ public RJDatabaseMetaDataInterface getMetaData() throws RemoteException, SQLException { return new RJDatabaseMetaDataServer(jdbcConnection_.getMetaData()); } /** * You can put a connection in read-only mode as a hint to enable * database optimizations. * *

Note: setReadOnly cannot be called while in the * middle of a transaction. * * @param readOnly true enables read-only mode; false disables * read-only mode. */ public void setReadOnly(boolean readOnly) throws RemoteException, SQLException { jdbcConnection_.setReadOnly(readOnly); } /** * Tests to see if the connection is in read-only mode. * * @return true if connection is read-only */ public boolean isReadOnly() throws RemoteException, SQLException { return jdbcConnection_.isReadOnly(); } /** * A sub-space of this Connection's database may be selected by setting a * catalog name. If the driver does not support catalogs it will * silently ignore this request. */ public void setCatalog(String catalog) throws RemoteException, SQLException { jdbcConnection_.setCatalog(catalog); } /** * Return the Connection's current catalog name. * * @return the current catalog name or null */ public String getCatalog() throws RemoteException, SQLException { return jdbcConnection_.getCatalog(); } /** * You can call this method to try to change the transaction * isolation level using one of the TRANSACTION_* values. * *

Note: setTransactionIsolation cannot be called while * in the middle of a transaction. * * @param level one of the TRANSACTION_* isolation values with the * exception of TRANSACTION_NONE; some databases may not support * other values * * @see DatabaseMetaData#supportsTransactionIsolationLevel */ public void setTransactionIsolation(int level) throws RemoteException, SQLException { jdbcConnection_.setTransactionIsolation(level); } /** * Get this Connection's current transaction isolation mode. * * @return the current TRANSACTION_* mode value */ public int getTransactionIsolation() throws RemoteException, SQLException { return jdbcConnection_.getTransactionIsolation(); } /** * The first warning reported by calls on this Connection is * returned. * *

Note: Subsequent warnings will be chained to this * SQLWarning. * * @return the first SQLWarning or null */ public SQLWarning getWarnings() throws RemoteException, SQLException { return jdbcConnection_.getWarnings(); } /** * After this call, getWarnings returns null until a new warning is * reported for this Connection. */ public void clearWarnings() throws RemoteException, SQLException { jdbcConnection_.clearWarnings(); } // JDBC 2.0 methods // Added by Peter Hearty, Aug 2000, peter.hearty@lutris.com. public void setTypeMap(java.util.Map map) throws RemoteException, SQLException { jdbcConnection_.setTypeMap(map); } public RJPreparedStatementInterface prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws RemoteException, SQLException { return new RJPreparedStatementServer( jdbcConnection_.prepareStatement(sql, resultSetType, resultSetConcurrency)); } public RJCallableStatementInterface prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws RemoteException, SQLException { return new RJCallableStatementServer(jdbcConnection_.prepareCall(sql, resultSetType,resultSetConcurrency)); } public java.util.Map getTypeMap() throws RemoteException, SQLException { return jdbcConnection_.getTypeMap(); } public RJStatementInterface createStatement(int resultSetType, int resultSetConcurrency) throws RemoteException, SQLException { return new RJStatementServer(jdbcConnection_.createStatement(resultSetType, resultSetConcurrency)); } /**InstantDB // InstantDB specific extensions. public Properties getProperties () throws java.rmi.RemoteException, SQLException { return ((ConnectionExtensions)jdbcConnection_).getProperties (); } public Object getLastValueInserted ( String tableName, String columnName) throws java.rmi.RemoteException, SQLException { return ((ConnectionExtensions)jdbcConnection_).getLastValueInserted (tableName, columnName); } public void startGlobalTransaction (Xid xid) throws java.rmi.RemoteException, XAException { ((ConnectionExtensions)jdbcConnection_).startGlobalTransaction (xid); } public int prepare() throws java.rmi.RemoteException, XAException { return ((ConnectionExtensions)jdbcConnection_).prepare (); } public String getDatabaseId() throws java.rmi.RemoteException, SQLException { return ((ConnectionExtensions)jdbcConnection_).getDatabaseId(); } InstantDB**/ }; PK .Oi+`gQQRJDatabaseMetaData.java /** * RmiJdbc client/server JDBC Driver * (C) GIE Dyade (Groupe BULL / INRIA Research Center) 1997 * * @version 1.0 * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com) */ package RmiJdbc; import java.sql.*; import java.rmi.RemoteException; /** * This class provides information about the database as a whole. * *

Many of the methods here return lists of information in ResultSets. * You can use the normal ResultSet methods such as getString and getInt * to retrieve the data from these ResultSets. If a given form of * metadata is not available, these methods should throw a SQLException. * *

Some of these methods take arguments that are String patterns. These * arguments all have names such as fooPattern. Within a pattern String, "%" * means match any substring of 0 or more characters, and "_" means match * any one character. Only metadata entries matching the search pattern * are returned. If a search pattern argument is set to a null ref, it means * that argument's criteria should be dropped from the search. * *

A SQLException will be thrown if a driver does not support a meta * data method. In the case of methods that return a ResultSet, * either a ResultSet (which may be empty) is returned or a * SQLException is thrown. */ public class RJDatabaseMetaData implements java.sql.DatabaseMetaData, java.io.Serializable { RJDatabaseMetaDataInterface rmiMetadata_; public RJDatabaseMetaData(RJDatabaseMetaDataInterface d) { rmiMetadata_ = d; } //---------------------------------------------------------------------- // First, a variety of minor information about the target database. /** * Can all the procedures returned by getProcedures be called by the * current user? * * @return true if so */ public boolean allProceduresAreCallable() throws SQLException { try { return rmiMetadata_.allProceduresAreCallable(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Can all the tables returned by getTable be SELECTed by the * current user? * * @return true if so */ public boolean allTablesAreSelectable() throws SQLException { try { return rmiMetadata_.allTablesAreSelectable(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * What's the url for this database? * * @return the url or null if it can't be generated */ public String getURL() throws SQLException { try { return rmiMetadata_.getURL(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * What's our user name as known to the database? * * @return our database user name */ public String getUserName() throws SQLException { try { return rmiMetadata_.getUserName(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Is the database in read-only mode? * * @return true if so */ public boolean isReadOnly() throws SQLException { try { return rmiMetadata_.isReadOnly(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Are NULL values sorted high? * * @return true if so */ public boolean nullsAreSortedHigh() throws SQLException { try { return rmiMetadata_.nullsAreSortedHigh(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Are NULL values sorted low? * * @return true if so */ public boolean nullsAreSortedLow() throws SQLException { try { return rmiMetadata_.nullsAreSortedLow(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Are NULL values sorted at the start regardless of sort order? * * @return true if so */ public boolean nullsAreSortedAtStart() throws SQLException { try { return rmiMetadata_.nullsAreSortedAtStart(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Are NULL values sorted at the end regardless of sort order? * * @return true if so */ public boolean nullsAreSortedAtEnd() throws SQLException { try { return rmiMetadata_.nullsAreSortedAtEnd(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * What's the name of this database product? * * @return database product name */ public String getDatabaseProductName() throws SQLException { try { return rmiMetadata_.getDatabaseProductName(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * What's the version of this database product? * * @return database version */ public String getDatabaseProductVersion() throws SQLException { try { return rmiMetadata_.getDatabaseProductVersion(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * What's the name of this JDBC driver? * * @return JDBC driver name */ public String getDriverName() throws SQLException { try { return rmiMetadata_.getDriverName(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * What's the version of this JDBC driver? * * @return JDBC driver version */ public String getDriverVersion() throws SQLException { try { return rmiMetadata_.getDriverVersion(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * What's this JDBC driver's major version number? * * @return JDBC driver major version */ public int getDriverMajorVersion() { try { return rmiMetadata_.getDriverMajorVersion(); } catch(Exception e) { return 0; } } /** * What's this JDBC driver's minor version number? * * @return JDBC driver minor version number */ public int getDriverMinorVersion() { try { return rmiMetadata_.getDriverMinorVersion(); } catch(Exception e) { return 0; } } /** * Does the database store tables in a local file? * * @return true if so */ public boolean usesLocalFiles() throws SQLException { try { return rmiMetadata_.usesLocalFiles(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Does the database use a file for each table? * * @return true if the database uses a local file for each table */ public boolean usesLocalFilePerTable() throws SQLException { try { return rmiMetadata_.usesLocalFilePerTable(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Does the database treat mixed case unquoted SQL identifiers as * case sensitive and as a result store them in mixed case? * * A JDBC-Compliant driver will always return false. * * @return true if so */ public boolean supportsMixedCaseIdentifiers() throws SQLException { try { return rmiMetadata_.supportsMixedCaseIdentifiers(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Does the database treat mixed case unquoted SQL identifiers as * case insensitive and store them in upper case? * * @return true if so */ public boolean storesUpperCaseIdentifiers() throws SQLException { try { return rmiMetadata_.storesUpperCaseIdentifiers(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Does the database treat mixed case unquoted SQL identifiers as * case insensitive and store them in lower case? * * @return true if so */ public boolean storesLowerCaseIdentifiers() throws SQLException { try { return rmiMetadata_.storesLowerCaseIdentifiers(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Does the database treat mixed case unquoted SQL identifiers as * case insensitive and store them in mixed case? * * @return true if so */ public boolean storesMixedCaseIdentifiers() throws SQLException { try { return rmiMetadata_.storesMixedCaseIdentifiers(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Does the database treat mixed case quoted SQL identifiers as * case sensitive and as a result store them in mixed case? * * A JDBC-Compliant driver will always return false. * * @return true if so */ public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException { try { return rmiMetadata_.supportsMixedCaseQuotedIdentifiers(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Does the database treat mixed case quoted SQL identifiers as * case insensitive and store them in upper case? * * @return true if so */ public boolean storesUpperCaseQuotedIdentifiers() throws SQLException { try { return rmiMetadata_.storesUpperCaseQuotedIdentifiers(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Does the database treat mixed case quoted SQL identifiers as * case insensitive and store them in lower case? * * @return true if so */ public boolean storesLowerCaseQuotedIdentifiers() throws SQLException { try { return rmiMetadata_.storesLowerCaseQuotedIdentifiers(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Does the database treat mixed case quoted SQL identifiers as * case insensitive and store them in mixed case? * * @return true if so */ public boolean storesMixedCaseQuotedIdentifiers() throws SQLException { try { return rmiMetadata_.storesMixedCaseQuotedIdentifiers(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * What's the string used to quote SQL identifiers? * This returns a space " " if identifier quoting isn't supported. * * A JDBC-Compliant driver always uses a double quote character. * * @return the quoting string */ public String getIdentifierQuoteString() throws SQLException { try { return rmiMetadata_.getIdentifierQuoteString(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get a comma separated list of all a database's SQL keywords * that are NOT also SQL92 keywords. * * @return the list */ public String getSQLKeywords() throws SQLException { try { return rmiMetadata_.getSQLKeywords(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get a comma separated list of math functions. * * @return the list */ public String getNumericFunctions() throws SQLException { try { return rmiMetadata_.getNumericFunctions(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get a comma separated list of string functions. * * @return the list */ public String getStringFunctions() throws SQLException { try { return rmiMetadata_.getStringFunctions(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get a comma separated list of system functions. * * @return the list */ public String getSystemFunctions() throws SQLException { try { return rmiMetadata_.getSystemFunctions(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get a comma separated list of time and date functions. * * @return the list */ public String getTimeDateFunctions() throws SQLException { try { return rmiMetadata_.getTimeDateFunctions(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * This is the string that can be used to escape '_' or '%' in * the string pattern style catalog search parameters. * *

The '_' character represents any single character. *

The '%' character represents any sequence of zero or * more characters. * @return the string used to escape wildcard characters */ public String getSearchStringEscape() throws SQLException { try { return rmiMetadata_.getSearchStringEscape(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get all the "extra" characters that can be used in unquoted * identifier names (those beyond a-z, A-Z, 0-9 and _). * * @return the string containing the extra characters */ public String getExtraNameCharacters() throws SQLException { try { return rmiMetadata_.getExtraNameCharacters(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } //-------------------------------------------------------------------- // Functions describing which features are supported. /** * Is "ALTER TABLE" with add column supported? * * @return true if so */ public boolean supportsAlterTableWithAddColumn() throws SQLException { try { return rmiMetadata_.supportsAlterTableWithAddColumn(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Is "ALTER TABLE" with drop column supported? * * @return true if so */ public boolean supportsAlterTableWithDropColumn() throws SQLException { try { return rmiMetadata_.supportsAlterTableWithDropColumn(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Is column aliasing supported? * *

If so, the SQL AS clause can be used to provide names for * computed columns or to provide alias names for columns as * required. * * A JDBC-Compliant driver always returns true. * * @return true if so */ public boolean supportsColumnAliasing() throws SQLException { try { return rmiMetadata_.supportsColumnAliasing(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Are concatenations between NULL and non-NULL values NULL? * * A JDBC-Compliant driver always returns true. * * @return true if so */ public boolean nullPlusNonNullIsNull() throws SQLException { try { return rmiMetadata_.nullPlusNonNullIsNull(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Is the CONVERT function between SQL types supported? * * @return true if so */ public boolean supportsConvert() throws SQLException { try { return rmiMetadata_.supportsConvert(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Is CONVERT between the given SQL types supported? * * @param fromType the type to convert from * @param toType the type to convert to * @return true if so * @see Types */ public boolean supportsConvert(int fromType, int toType) throws SQLException { try { return rmiMetadata_.supportsConvert(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Are table correlation names supported? * * A JDBC-Compliant driver always returns true. * * @return true if so */ public boolean supportsTableCorrelationNames() throws SQLException { try { return rmiMetadata_.supportsTableCorrelationNames(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * If table correlation names are supported, are they restricted * to be different from the names of the tables? * * @return true if so */ public boolean supportsDifferentTableCorrelationNames() throws SQLException { try { return rmiMetadata_.supportsDifferentTableCorrelationNames(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Are expressions in "ORDER BY" lists supported? * * @return true if so */ public boolean supportsExpressionsInOrderBy() throws SQLException { try { return rmiMetadata_.supportsExpressionsInOrderBy(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Can an "ORDER BY" clause use columns not in the SELECT? * * @return true if so */ public boolean supportsOrderByUnrelated() throws SQLException { try { return rmiMetadata_.supportsOrderByUnrelated(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Is some form of "GROUP BY" clause supported? * * @return true if so */ public boolean supportsGroupBy() throws SQLException { try { return rmiMetadata_.supportsGroupBy(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Can a "GROUP BY" clause use columns not in the SELECT? * * @return true if so */ public boolean supportsGroupByUnrelated() throws SQLException { try { return rmiMetadata_.supportsGroupByUnrelated(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Can a "GROUP BY" clause add columns not in the SELECT * provided it specifies all the columns in the SELECT? * * @return true if so */ public boolean supportsGroupByBeyondSelect() throws SQLException { try { return rmiMetadata_.supportsGroupByBeyondSelect(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Is the escape character in "LIKE" clauses supported? * * A JDBC-Compliant driver always returns true. * * @return true if so */ public boolean supportsLikeEscapeClause() throws SQLException { try { return rmiMetadata_.supportsLikeEscapeClause(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Are multiple ResultSets from a single execute supported? * * @return true if so */ public boolean supportsMultipleResultSets() throws SQLException { try { return rmiMetadata_.supportsMultipleResultSets(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Can we have multiple transactions open at once (on different * connections)? * * @return true if so */ public boolean supportsMultipleTransactions() throws SQLException { try { return rmiMetadata_.supportsMultipleTransactions(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Can columns be defined as non-nullable? * * A JDBC-Compliant driver always returns true. * * @return true if so */ public boolean supportsNonNullableColumns() throws SQLException { try { return rmiMetadata_.supportsNonNullableColumns(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Is the ODBC Minimum SQL grammar supported? * * All JDBC-Compliant drivers must return true. * * @return true if so */ public boolean supportsMinimumSQLGrammar() throws SQLException { try { return rmiMetadata_.supportsMinimumSQLGrammar(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Is the ODBC Core SQL grammar supported? * * @return true if so */ public boolean supportsCoreSQLGrammar() throws SQLException { try { return rmiMetadata_.supportsCoreSQLGrammar(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Is the ODBC Extended SQL grammar supported? * * @return true if so */ public boolean supportsExtendedSQLGrammar() throws SQLException { try { return rmiMetadata_.supportsExtendedSQLGrammar(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Is the ANSI92 entry level SQL grammar supported? * * All JDBC-Compliant drivers must return true. * * @return true if so */ public boolean supportsANSI92EntryLevelSQL() throws SQLException { try { return rmiMetadata_.supportsANSI92EntryLevelSQL(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Is the ANSI92 intermediate SQL grammar supported? * * @return true if so */ public boolean supportsANSI92IntermediateSQL() throws SQLException { try { return rmiMetadata_.supportsANSI92IntermediateSQL(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Is the ANSI92 full SQL grammar supported? * * @return true if so */ public boolean supportsANSI92FullSQL() throws SQLException { try { return rmiMetadata_.supportsANSI92FullSQL(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Is the SQL Integrity Enhancement Facility supported? * * @return true if so */ public boolean supportsIntegrityEnhancementFacility() throws SQLException { try { return rmiMetadata_.supportsIntegrityEnhancementFacility(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Is some form of outer join supported? * * @return true if so */ public boolean supportsOuterJoins() throws SQLException { try { return rmiMetadata_.supportsOuterJoins(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Are full nested outer joins supported? * * @return true if so */ public boolean supportsFullOuterJoins() throws SQLException { try { return rmiMetadata_.supportsFullOuterJoins(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Is there limited support for outer joins? (This will be true * if supportFullOuterJoins is true.) * * @return true if so */ public boolean supportsLimitedOuterJoins() throws SQLException { try { return rmiMetadata_.supportsLimitedOuterJoins(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * What's the database vendor's preferred term for "schema"? * * @return the vendor term */ public String getSchemaTerm() throws SQLException { try { return rmiMetadata_.getSchemaTerm(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * What's the database vendor's preferred term for "procedure"? * * @return the vendor term */ public String getProcedureTerm() throws SQLException { try { return rmiMetadata_.getProcedureTerm(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * What's the database vendor's preferred term for "catalog"? * * @return the vendor term */ public String getCatalogTerm() throws SQLException { try { return rmiMetadata_.getCatalogTerm(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Does a catalog appear at the start of a qualified table name? * (Otherwise it appears at the end) * * @return true if it appears at the start */ public boolean isCatalogAtStart() throws SQLException { try { return rmiMetadata_.isCatalogAtStart(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * What's the separator between catalog and table name? * * @return the separator string */ public String getCatalogSeparator() throws SQLException { try { return rmiMetadata_.getCatalogSeparator(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Can a schema name be used in a data manipulation statement? * * @return true if so */ public boolean supportsSchemasInDataManipulation() throws SQLException { try { return rmiMetadata_.supportsSchemasInDataManipulation(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Can a schema name be used in a procedure call statement? * * @return true if so */ public boolean supportsSchemasInProcedureCalls() throws SQLException { try { return rmiMetadata_.supportsSchemasInProcedureCalls(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Can a schema name be used in a table definition statement? * * @return true if so */ public boolean supportsSchemasInTableDefinitions() throws SQLException { try { return rmiMetadata_.supportsSchemasInTableDefinitions(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Can a schema name be used in an index definition statement? * * @return true if so */ public boolean supportsSchemasInIndexDefinitions() throws SQLException { try { return rmiMetadata_.supportsSchemasInIndexDefinitions(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Can a schema name be used in a privilege definition statement? * * @return true if so */ public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException { try { return rmiMetadata_.supportsSchemasInPrivilegeDefinitions(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Can a catalog name be used in a data manipulation statement? * * @return true if so */ public boolean supportsCatalogsInDataManipulation() throws SQLException { try { return rmiMetadata_.supportsCatalogsInDataManipulation(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Can a catalog name be used in a procedure call statement? * * @return true if so */ public boolean supportsCatalogsInProcedureCalls() throws SQLException { try { return rmiMetadata_.supportsCatalogsInProcedureCalls(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Can a catalog name be used in a table definition statement? * * @return true if so */ public boolean supportsCatalogsInTableDefinitions() throws SQLException { try { return rmiMetadata_.supportsCatalogsInTableDefinitions(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Can a catalog name be used in an index definition statement? * * @return true if so */ public boolean supportsCatalogsInIndexDefinitions() throws SQLException { try { return rmiMetadata_.supportsCatalogsInIndexDefinitions(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Can a catalog name be used in a privilege definition statement? * * @return true if so */ public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException { try { return rmiMetadata_.supportsCatalogsInPrivilegeDefinitions(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Is positioned DELETE supported? * * @return true if so */ public boolean supportsPositionedDelete() throws SQLException { try { return rmiMetadata_.supportsPositionedDelete(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Is positioned UPDATE supported? * * @return true if so */ public boolean supportsPositionedUpdate() throws SQLException { try { return rmiMetadata_.supportsPositionedUpdate(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Is SELECT for UPDATE supported? * * @return true if so */ public boolean supportsSelectForUpdate() throws SQLException { try { return rmiMetadata_.supportsSelectForUpdate(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Are stored procedure calls using the stored procedure escape * syntax supported? * * @return true if so */ public boolean supportsStoredProcedures() throws SQLException { try { return rmiMetadata_.supportsStoredProcedures(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Are subqueries in comparison expressions supported? * * A JDBC-Compliant driver always returns true. * * @return true if so */ public boolean supportsSubqueriesInComparisons() throws SQLException { try { return rmiMetadata_.supportsSubqueriesInComparisons(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Are subqueries in 'exists' expressions supported? * * A JDBC-Compliant driver always returns true. * * @return true if so */ public boolean supportsSubqueriesInExists() throws SQLException { try { return rmiMetadata_.supportsSubqueriesInExists(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Are subqueries in 'in' statements supported? * * A JDBC-Compliant driver always returns true. * * @return true if so */ public boolean supportsSubqueriesInIns() throws SQLException { try { return rmiMetadata_.supportsSubqueriesInIns(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Are subqueries in quantified expressions supported? * * A JDBC-Compliant driver always returns true. * * @return true if so */ public boolean supportsSubqueriesInQuantifieds() throws SQLException { try { return rmiMetadata_.supportsSubqueriesInQuantifieds(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Are correlated subqueries supported? * * A JDBC-Compliant driver always returns true. * * @return true if so */ public boolean supportsCorrelatedSubqueries() throws SQLException { try { return rmiMetadata_.supportsCorrelatedSubqueries(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Is SQL UNION supported? * * @return true if so */ public boolean supportsUnion() throws SQLException { try { return rmiMetadata_.supportsUnion(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Is SQL UNION ALL supported? * * @return true if so */ public boolean supportsUnionAll() throws SQLException { try { return rmiMetadata_.supportsUnionAll(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Can cursors remain open across commits? * * @return true if cursors always remain open; * false if they might not remain open */ public boolean supportsOpenCursorsAcrossCommit() throws SQLException { try { return rmiMetadata_.supportsOpenCursorsAcrossCommit(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Can cursors remain open across rollbacks? * * @return true if cursors always remain open; * false if they might not remain open */ public boolean supportsOpenCursorsAcrossRollback() throws SQLException { try { return rmiMetadata_.supportsOpenCursorsAcrossRollback(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Can statements remain open across commits? * * @return true if statements always remain open; * false if they might not remain open */ public boolean supportsOpenStatementsAcrossCommit() throws SQLException { try { return rmiMetadata_.supportsOpenStatementsAcrossCommit(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Can statements remain open across rollbacks? * * @return true if statements always remain open; * false if they might not remain open */ public boolean supportsOpenStatementsAcrossRollback() throws SQLException { try { return rmiMetadata_.supportsOpenStatementsAcrossRollback(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } //---------------------------------------------------------------------- // The following group of methods exposes various limitations // based on the target database with the current driver. // Unless otherwise specified, a result of zero means there is no // limit, or the limit is not known. /** * How many hex characters can you have in an inline binary literal? * * @return max literal length */ public int getMaxBinaryLiteralLength() throws SQLException { try { return rmiMetadata_.getMaxBinaryLiteralLength(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * What's the max length for a character literal? * * @return max literal length */ public int getMaxCharLiteralLength() throws SQLException { try { return rmiMetadata_.getMaxCharLiteralLength(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * What's the limit on column name length? * * @return max literal length */ public int getMaxColumnNameLength() throws SQLException { try { return rmiMetadata_.getMaxColumnNameLength(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * What's the maximum number of columns in a "GROUP BY" clause? * * @return max number of columns */ public int getMaxColumnsInGroupBy() throws SQLException { try { return rmiMetadata_.getMaxColumnsInGroupBy(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * What's the maximum number of columns allowed in an index? * * @return max columns */ public int getMaxColumnsInIndex() throws SQLException { try { return rmiMetadata_.getMaxColumnsInIndex(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * What's the maximum number of columns in an "ORDER BY" clause? * * @return max columns */ public int getMaxColumnsInOrderBy() throws SQLException { try { return rmiMetadata_.getMaxColumnsInOrderBy(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * What's the maximum number of columns in a "SELECT" list? * * @return max columns */ public int getMaxColumnsInSelect() throws SQLException { try { return rmiMetadata_.getMaxColumnsInSelect(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * What's the maximum number of columns in a table? * * @return max columns */ public int getMaxColumnsInTable() throws SQLException { try { return rmiMetadata_.getMaxColumnsInTable(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * How many active connections can we have at a time to this database? * * @return max connections */ public int getMaxConnections() throws SQLException { try { return rmiMetadata_.getMaxConnections(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * What's the maximum cursor name length? * * @return max cursor name length in bytes */ public int getMaxCursorNameLength() throws SQLException { try { return rmiMetadata_.getMaxCursorNameLength(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * What's the maximum length of an index (in bytes)? * * @return max index length in bytes */ public int getMaxIndexLength() throws SQLException { try { return rmiMetadata_.getMaxIndexLength(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * What's the maximum length allowed for a schema name? * * @return max name length in bytes */ public int getMaxSchemaNameLength() throws SQLException { try { return rmiMetadata_.getMaxSchemaNameLength(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * What's the maximum length of a procedure name? * * @return max name length in bytes */ public int getMaxProcedureNameLength() throws SQLException { try { return rmiMetadata_.getMaxProcedureNameLength(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * What's the maximum length of a catalog name? * * @return max name length in bytes */ public int getMaxCatalogNameLength() throws SQLException { try { return rmiMetadata_.getMaxCatalogNameLength(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * What's the maximum length of a single row? * * @return max row size in bytes */ public int getMaxRowSize() throws SQLException { try { return rmiMetadata_.getMaxRowSize(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Did getMaxRowSize() include LONGVARCHAR and LONGVARBINARY * blobs? * * @return true if so */ public boolean doesMaxRowSizeIncludeBlobs() throws SQLException { try { return rmiMetadata_.doesMaxRowSizeIncludeBlobs(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * What's the maximum length of a SQL statement? * * @return max length in bytes */ public int getMaxStatementLength() throws SQLException { try { return rmiMetadata_.getMaxStatementLength(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * How many active statements can we have open at one time to this * database? * * @return the maximum */ public int getMaxStatements() throws SQLException { try { return rmiMetadata_.getMaxStatements(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * What's the maximum length of a table name? * * @return max name length in bytes */ public int getMaxTableNameLength() throws SQLException { try { return rmiMetadata_.getMaxTableNameLength(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * What's the maximum number of tables in a SELECT? * * @return the maximum */ public int getMaxTablesInSelect() throws SQLException { try { return rmiMetadata_.getMaxTablesInSelect(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * What's the maximum length of a user name? * * @return max name length in bytes */ public int getMaxUserNameLength() throws SQLException { try { return rmiMetadata_.getMaxUserNameLength(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } //---------------------------------------------------------------------- /** * What's the database's default transaction isolation level? The * values are defined in java.sql.Connection. * * @return the default isolation level * @see Connection */ public int getDefaultTransactionIsolation() throws SQLException { try { return rmiMetadata_.getDefaultTransactionIsolation(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Are transactions supported? If not, commit is a noop and the * isolation level is TRANSACTION_NONE. * * @return true if transactions are supported */ public boolean supportsTransactions() throws SQLException { try { return rmiMetadata_.supportsTransactions(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Does the database support the given transaction isolation level? * * @param level the values are defined in java.sql.Connection * @return true if so * @see Connection */ public boolean supportsTransactionIsolationLevel(int level) throws SQLException { try { return rmiMetadata_.supportsTransactionIsolationLevel(level); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Are both data definition and data manipulation statements * within a transaction supported? * * @return true if so */ public boolean supportsDataDefinitionAndDataManipulationTransactions() throws SQLException { try { return rmiMetadata_.supportsDataDefinitionAndDataManipulationTransactions(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Are only data manipulation statements within a transaction * supported? * * @return true if so */ public boolean supportsDataManipulationTransactionsOnly() throws SQLException { try { return rmiMetadata_.supportsDataManipulationTransactionsOnly(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Does a data definition statement within a transaction force the * transaction to commit? * * @return true if so */ public boolean dataDefinitionCausesTransactionCommit() throws SQLException { try { return rmiMetadata_.dataDefinitionCausesTransactionCommit(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Is a data definition statement within a transaction ignored? * * @return true if so */ public boolean dataDefinitionIgnoredInTransactions() throws SQLException { try { return rmiMetadata_.dataDefinitionIgnoredInTransactions(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get a description of stored procedures available in a * catalog. * *

Only procedure descriptions matching the schema and * procedure name criteria are returned. They are ordered by * PROCEDURE_SCHEM, and PROCEDURE_NAME. * *

Each procedure description has the the following columns: *

    *
  1. PROCEDURE_CAT String => procedure catalog (may be null) *
  2. PROCEDURE_SCHEM String => procedure schema (may be null) *
  3. PROCEDURE_NAME String => procedure name *
  4. reserved for future use *
  5. reserved for future use *
  6. reserved for future use *
  7. REMARKS String => explanatory comment on the procedure *
  8. PROCEDURE_TYPE short => kind of procedure: *
      *
    • procedureResultUnknown - May return a result *
    • procedureNoResult - Does not return a result *
    • procedureReturnsResult - Returns a result *
    *
* * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schemaPattern a schema name pattern; "" retrieves those * without a schema * @param procedureNamePattern a procedure name pattern * @return ResultSet - each row is a procedure description * @see #getSearchStringEscape */ public java.sql.ResultSet getProcedures(String catalog, String schemaPattern, String procedureNamePattern) throws SQLException { try { return new RJResultSet(rmiMetadata_.getProcedures(catalog, schemaPattern, procedureNamePattern)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get a description of a catalog's stored procedure parameters * and result columns. * *

Only descriptions matching the schema, procedure and * parameter name criteria are returned. They are ordered by * PROCEDURE_SCHEM and PROCEDURE_NAME. Within this, the return value, * if any, is first. Next are the parameter descriptions in call * order. The column descriptions follow in column number order. * *

Each row in the ResultSet is a parameter description or * column description with the following fields: *

    *
  1. PROCEDURE_CAT String => procedure catalog (may be null) *
  2. PROCEDURE_SCHEM String => procedure schema (may be null) *
  3. PROCEDURE_NAME String => procedure name *
  4. COLUMN_NAME String => column/parameter name *
  5. COLUMN_TYPE Short => kind of column/parameter: *
      *
    • procedureColumnUnknown - nobody knows *
    • procedureColumnIn - IN parameter *
    • procedureColumnInOut - INOUT parameter *
    • procedureColumnOut - OUT parameter *
    • procedureColumnReturn - procedure return value *
    • procedureColumnResult - result column in ResultSet *
    *
  6. DATA_TYPE short => SQL type from java.sql.Types *
  7. TYPE_NAME String => SQL type name *
  8. PRECISION int => precision *
  9. LENGTH int => length in bytes of data *
  10. SCALE short => scale *
  11. RADIX short => radix *
  12. NULLABLE short => can it contain NULL? *
      *
    • procedureNoNulls - does not allow NULL values *
    • procedureNullable - allows NULL values *
    • procedureNullableUnknown - nullability unknown *
    *
  13. REMARKS String => comment describing parameter/column *
* *

Note: Some databases may not return the column * descriptions for a procedure. Additional columns beyond * REMARKS can be defined by the database. * * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schemaPattern a schema name pattern; "" retrieves those * without a schema * @param procedureNamePattern a procedure name pattern * @param columnNamePattern a column name pattern * @return ResultSet - each row is a stored procedure parameter or * column description * @see #getSearchStringEscape */ public java.sql.ResultSet getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern) throws SQLException { try { return new RJResultSet(rmiMetadata_.getProcedureColumns(catalog, schemaPattern, procedureNamePattern, columnNamePattern)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get a description of tables available in a catalog. * *

Only table descriptions matching the catalog, schema, table * name and type criteria are returned. They are ordered by * TABLE_TYPE, TABLE_SCHEM and TABLE_NAME. * *

Each table description has the following columns: *

    *
  1. TABLE_CAT String => table catalog (may be null) *
  2. TABLE_SCHEM String => table schema (may be null) *
  3. TABLE_NAME String => table name *
  4. TABLE_TYPE String => table type. Typical types are "TABLE", * "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", * "LOCAL TEMPORARY", "ALIAS", "SYNONYM". *
  5. REMARKS String => explanatory comment on the table *
* *

Note: Some databases may not return information for * all tables. * * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schemaPattern a schema name pattern; "" retrieves those * without a schema * @param tableNamePattern a table name pattern * @param types a list of table types to include; null returns all types * @return ResultSet - each row is a table description * @see #getSearchStringEscape */ public java.sql.ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String types[]) throws SQLException { try { return new RJResultSet(rmiMetadata_.getTables(catalog, schemaPattern, tableNamePattern, types)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the schema names available in this database. The results * are ordered by schema name. * *

The schema column is: *

    *
  1. TABLE_SCHEM String => schema name *
* * @return ResultSet - each row has a single String column that is a * schema name */ public java.sql.ResultSet getSchemas() throws SQLException { try { return new RJResultSet(rmiMetadata_.getSchemas()); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the catalog names available in this database. The results * are ordered by catalog name. * *

The catalog column is: *

    *
  1. TABLE_CAT String => catalog name *
* * @return ResultSet - each row has a single String column that is a * catalog name */ public java.sql.ResultSet getCatalogs() throws SQLException { try { return new RJResultSet(rmiMetadata_.getCatalogs()); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the table types available in this database. The results * are ordered by table type. * *

The table type is: *

    *
  1. TABLE_TYPE String => table type. Typical types are "TABLE", * "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", * "LOCAL TEMPORARY", "ALIAS", "SYNONYM". *
* * @return ResultSet - each row has a single String column that is a * table type */ public java.sql.ResultSet getTableTypes() throws SQLException { try { return new RJResultSet(rmiMetadata_.getTableTypes()); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get a description of table columns available in a catalog. * *

Only column descriptions matching the catalog, schema, table * and column name criteria are returned. They are ordered by * TABLE_SCHEM, TABLE_NAME and ORDINAL_POSITION. * *

Each column description has the following columns: *

    *
  1. TABLE_CAT String => table catalog (may be null) *
  2. TABLE_SCHEM String => table schema (may be null) *
  3. TABLE_NAME String => table name *
  4. COLUMN_NAME String => column name *
  5. DATA_TYPE short => SQL type from java.sql.Types *
  6. TYPE_NAME String => Data source dependent type name *
  7. COLUMN_SIZE int => column size. For char or date * types this is the maximum number of characters, for numeric or * decimal types this is precision. *
  8. BUFFER_LENGTH is not used. *
  9. DECIMAL_DIGITS int => the number of fractional digits *
  10. NUM_PREC_RADIX int => Radix (typically either 10 or 2) *
  11. NULLABLE int => is NULL allowed? *
      *
    • columnNoNulls - might not allow NULL values *
    • columnNullable - definitely allows NULL values *
    • columnNullableUnknown - nullability unknown *
    *
  12. REMARKS String => comment describing column (may be null) *
  13. COLUMN_DEF String => default value (may be null) *
  14. SQL_DATA_TYPE int => unused *
  15. SQL_DATETIME_SUB int => unused *
  16. CHAR_OCTET_LENGTH int => for char types the * maximum number of bytes in the column *
  17. ORDINAL_POSITION int => index of column in table * (starting at 1) *
  18. IS_NULLABLE String => "NO" means column definitely * does not allow NULL values; "YES" means the column might * allow NULL values. An empty string means nobody knows. *
* * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schemaPattern a schema name pattern; "" retrieves those * without a schema * @param tableNamePattern a table name pattern * @param columnNamePattern a column name pattern * @return ResultSet - each row is a column description * @see #getSearchStringEscape */ public java.sql.ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) throws SQLException { try { return new RJResultSet(rmiMetadata_.getColumns(catalog, schemaPattern, tableNamePattern, columnNamePattern)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get a description of the access rights for a table's columns. * *

Only privileges matching the column name criteria are * returned. They are ordered by COLUMN_NAME and PRIVILEGE. * *

Each privilige description has the following columns: *

    *
  1. TABLE_CAT String => table catalog (may be null) *
  2. TABLE_SCHEM String => table schema (may be null) *
  3. TABLE_NAME String => table name *
  4. COLUMN_NAME String => column name *
  5. GRANTOR => grantor of access (may be null) *
  6. GRANTEE String => grantee of access *
  7. PRIVILEGE String => name of access (SELECT, * INSERT, UPDATE, REFRENCES, ...) *
  8. IS_GRANTABLE String => "YES" if grantee is permitted * to grant to others; "NO" if not; null if unknown *
* * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schema a schema name; "" retrieves those without a schema * @param table a table name * @param columnNamePattern a column name pattern * @return ResultSet - each row is a column privilege description * @see #getSearchStringEscape */ public java.sql.ResultSet getColumnPrivileges(String catalog, String schema, String table, String columnNamePattern) throws SQLException { try { return new RJResultSet(rmiMetadata_.getColumnPrivileges(catalog, schema, table, columnNamePattern)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get a description of the access rights for each table available * in a catalog. Note that a table privilege applies to one or * more columns in the table. It would be wrong to assume that * this priviledge applies to all columns (this may be true for * some systems but is not true for all.) * *

Only privileges matching the schema and table name * criteria are returned. They are ordered by TABLE_SCHEM, * TABLE_NAME, and PRIVILEGE. * *

Each privilige description has the following columns: *

    *
  1. TABLE_CAT String => table catalog (may be null) *
  2. TABLE_SCHEM String => table schema (may be null) *
  3. TABLE_NAME String => table name *
  4. GRANTOR => grantor of access (may be null) *
  5. GRANTEE String => grantee of access *
  6. PRIVILEGE String => name of access (SELECT, * INSERT, UPDATE, REFRENCES, ...) *
  7. IS_GRANTABLE String => "YES" if grantee is permitted * to grant to others; "NO" if not; null if unknown *
* * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schemaPattern a schema name pattern; "" retrieves those * without a schema * @param tableNamePattern a table name pattern * @return ResultSet - each row is a table privilege description * @see #getSearchStringEscape */ public java.sql.ResultSet getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern) throws SQLException { try { return new RJResultSet(rmiMetadata_.getTablePrivileges(catalog, schemaPattern, tableNamePattern)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get a description of a table's optimal set of columns that * uniquely identifies a row. They are ordered by SCOPE. * *

Each column description has the following columns: *

    *
  1. SCOPE short => actual scope of result *
      *
    • bestRowTemporary - very temporary, while using row *
    • bestRowTransaction - valid for remainder of current transaction *
    • bestRowSession - valid for remainder of current session *
    *
  2. COLUMN_NAME String => column name *
  3. DATA_TYPE short => SQL data type from java.sql.Types *
  4. TYPE_NAME String => Data source dependent type name *
  5. COLUMN_SIZE int => precision *
  6. BUFFER_LENGTH int => not used *
  7. DECIMAL_DIGITS short => scale *
  8. PSEUDO_COLUMN short => is this a pseudo column * like an Oracle ROWID *
      *
    • bestRowUnknown - may or may not be pseudo column *
    • bestRowNotPseudo - is NOT a pseudo column *
    • bestRowPseudo - is a pseudo column *
    *
* * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schema a schema name; "" retrieves those without a schema * @param table a table name * @param scope the scope of interest; use same values as SCOPE * @param nullable include columns that are nullable? * @return ResultSet - each row is a column description */ public java.sql.ResultSet getBestRowIdentifier(String catalog, String schema, String table, int scope, boolean nullable) throws SQLException { try { return new RJResultSet(rmiMetadata_.getBestRowIdentifier(catalog, schema, table, scope, nullable)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get a description of a table's columns that are automatically * updated when any value in a row is updated. They are * unordered. * *

Each column description has the following columns: *

    *
  1. SCOPE short => is not used *
  2. COLUMN_NAME String => column name *
  3. DATA_TYPE short => SQL data type from java.sql.Types *
  4. TYPE_NAME String => Data source dependent type name *
  5. COLUMN_SIZE int => precision *
  6. BUFFER_LENGTH int => length of column value in bytes *
  7. DECIMAL_DIGITS short => scale *
  8. PSEUDO_COLUMN short => is this a pseudo column * like an Oracle ROWID *
      *
    • versionColumnUnknown - may or may not be pseudo column *
    • versionColumnNotPseudo - is NOT a pseudo column *
    • versionColumnPseudo - is a pseudo column *
    *
* * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schema a schema name; "" retrieves those without a schema * @param table a table name * @return ResultSet - each row is a column description */ public java.sql.ResultSet getVersionColumns(String catalog, String schema, String table) throws SQLException { try { return new RJResultSet(rmiMetadata_.getVersionColumns(catalog, schema, table)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get a description of a table's primary key columns. They * are ordered by COLUMN_NAME. * *

Each primary key column description has the following columns: *

    *
  1. TABLE_CAT String => table catalog (may be null) *
  2. TABLE_SCHEM String => table schema (may be null) *
  3. TABLE_NAME String => table name *
  4. COLUMN_NAME String => column name *
  5. KEY_SEQ short => sequence number within primary key *
  6. PK_NAME String => primary key name (may be null) *
* * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schema a schema name pattern; "" retrieves those * without a schema * @param table a table name * @return ResultSet - each row is a primary key column description */ public java.sql.ResultSet getPrimaryKeys(String catalog, String schema, String table) throws SQLException { try { return new RJResultSet(rmiMetadata_.getPrimaryKeys(catalog, schema, table)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get a description of the primary key columns that are * referenced by a table's foreign key columns (the primary keys * imported by a table). They are ordered by PKTABLE_CAT, * PKTABLE_SCHEM, PKTABLE_NAME, and KEY_SEQ. * *

Each primary key column description has the following columns: *

    *
  1. PKTABLE_CAT String => primary key table catalog * being imported (may be null) *
  2. PKTABLE_SCHEM String => primary key table schema * being imported (may be null) *
  3. PKTABLE_NAME String => primary key table name * being imported *
  4. PKCOLUMN_NAME String => primary key column name * being imported *
  5. FKTABLE_CAT String => foreign key table catalog (may be null) *
  6. FKTABLE_SCHEM String => foreign key table schema (may be null) *
  7. FKTABLE_NAME String => foreign key table name *
  8. FKCOLUMN_NAME String => foreign key column name *
  9. KEY_SEQ short => sequence number within foreign key *
  10. UPDATE_RULE short => What happens to * foreign key when primary is updated: *
      *
    • importedNoAction - do not allow update of primary * key if it has been imported *
    • importedKeyCascade - change imported key to agree * with primary key update *
    • importedKeySetNull - change imported key to NULL if * its primary key has been updated *
    • importedKeySetDefault - change imported key to default values * if its primary key has been updated *
    • importedKeyRestrict - same as importedKeyNoAction * (for ODBC 2.x compatibility) *
    *
  11. DELETE_RULE short => What happens to * the foreign key when primary is deleted. *
      *
    • importedKeyNoAction - do not allow delete of primary * key if it has been imported *
    • importedKeyCascade - delete rows that import a deleted key *
    • importedKeySetNull - change imported key to NULL if * its primary key has been deleted *
    • importedKeyRestrict - same as importedKeyNoAction * (for ODBC 2.x compatibility) *
    • importedKeySetDefault - change imported key to default if * its primary key has been deleted *
    *
  12. FK_NAME String => foreign key name (may be null) *
  13. PK_NAME String => primary key name (may be null) *
  14. DEFERRABILITY short => can the evaluation of foreign key * constraints be deferred until commit *
      *
    • importedKeyInitiallyDeferred - see SQL92 for definition *
    • importedKeyInitiallyImmediate - see SQL92 for definition *
    • importedKeyNotDeferrable - see SQL92 for definition *
    *
* * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schema a schema name pattern; "" retrieves those * without a schema * @param table a table name * @return ResultSet - each row is a primary key column description * @see #getExportedKeys */ public java.sql.ResultSet getImportedKeys(String catalog, String schema, String table) throws SQLException { try { return new RJResultSet(rmiMetadata_.getImportedKeys(catalog, schema, table)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get a description of the foreign key columns that reference a * table's primary key columns (the foreign keys exported by a * table). They are ordered by FKTABLE_CAT, FKTABLE_SCHEM, * FKTABLE_NAME, and KEY_SEQ. * *

Each foreign key column description has the following columns: *

    *
  1. PKTABLE_CAT String => primary key table catalog (may be null) *
  2. PKTABLE_SCHEM String => primary key table schema (may be null) *
  3. PKTABLE_NAME String => primary key table name *
  4. PKCOLUMN_NAME String => primary key column name *
  5. FKTABLE_CAT String => foreign key table catalog (may be null) * being exported (may be null) *
  6. FKTABLE_SCHEM String => foreign key table schema (may be null) * being exported (may be null) *
  7. FKTABLE_NAME String => foreign key table name * being exported *
  8. FKCOLUMN_NAME String => foreign key column name * being exported *
  9. KEY_SEQ short => sequence number within foreign key *
  10. UPDATE_RULE short => What happens to * foreign key when primary is updated: *
      *
    • importedNoAction - do not allow update of primary * key if it has been imported *
    • importedKeyCascade - change imported key to agree * with primary key update *
    • importedKeySetNull - change imported key to NULL if * its primary key has been updated *
    • importedKeySetDefault - change imported key to default values * if its primary key has been updated *
    • importedKeyRestrict - same as importedKeyNoAction * (for ODBC 2.x compatibility) *
    *
  11. DELETE_RULE short => What happens to * the foreign key when primary is deleted. *
      *
    • importedKeyNoAction - do not allow delete of primary * key if it has been imported *
    • importedKeyCascade - delete rows that import a deleted key *
    • importedKeySetNull - change imported key to NULL if * its primary key has been deleted *
    • importedKeyRestrict - same as importedKeyNoAction * (for ODBC 2.x compatibility) *
    • importedKeySetDefault - change imported key to default if * its primary key has been deleted *
    *
  12. FK_NAME String => foreign key name (may be null) *
  13. PK_NAME String => primary key name (may be null) *
  14. DEFERRABILITY short => can the evaluation of foreign key * constraints be deferred until commit *
      *
    • importedKeyInitiallyDeferred - see SQL92 for definition *
    • importedKeyInitiallyImmediate - see SQL92 for definition *
    • importedKeyNotDeferrable - see SQL92 for definition *
    *
* * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schema a schema name pattern; "" retrieves those * without a schema * @param table a table name * @return ResultSet - each row is a foreign key column description * @see #getImportedKeys */ public java.sql.ResultSet getExportedKeys(String catalog, String schema, String table) throws SQLException { try { return new RJResultSet(rmiMetadata_.getExportedKeys(catalog, schema, table)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get a description of the foreign key columns in the foreign key * table that reference the primary key columns of the primary key * table (describe how one table imports another's key.) This * should normally return a single foreign key/primary key pair * (most tables only import a foreign key from a table once.) They * are ordered by FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, and * KEY_SEQ. * *

Each foreign key column description has the following columns: *

    *
  1. PKTABLE_CAT String => primary key table catalog (may be null) *
  2. PKTABLE_SCHEM String => primary key table schema (may be null) *
  3. PKTABLE_NAME String => primary key table name *
  4. PKCOLUMN_NAME String => primary key column name *
  5. FKTABLE_CAT String => foreign key table catalog (may be null) * being exported (may be null) *
  6. FKTABLE_SCHEM String => foreign key table schema (may be null) * being exported (may be null) *
  7. FKTABLE_NAME String => foreign key table name * being exported *
  8. FKCOLUMN_NAME String => foreign key column name * being exported *
  9. KEY_SEQ short => sequence number within foreign key *
  10. UPDATE_RULE short => What happens to * foreign key when primary is updated: *
      *
    • importedNoAction - do not allow update of primary * key if it has been imported *
    • importedKeyCascade - change imported key to agree * with primary key update *
    • importedKeySetNull - change imported key to NULL if * its primary key has been updated *
    • importedKeySetDefault - change imported key to default values * if its primary key has been updated *
    • importedKeyRestrict - same as importedKeyNoAction * (for ODBC 2.x compatibility) *
    *
  11. DELETE_RULE short => What happens to * the foreign key when primary is deleted. *
      *
    • importedKeyNoAction - do not allow delete of primary * key if it has been imported *
    • importedKeyCascade - delete rows that import a deleted key *
    • importedKeySetNull - change imported key to NULL if * its primary key has been deleted *
    • importedKeyRestrict - same as importedKeyNoAction * (for ODBC 2.x compatibility) *
    • importedKeySetDefault - change imported key to default if * its primary key has been deleted *
    *
  12. FK_NAME String => foreign key name (may be null) *
  13. PK_NAME String => primary key name (may be null) *
  14. DEFERRABILITY short => can the evaluation of foreign key * constraints be deferred until commit *
      *
    • importedKeyInitiallyDeferred - see SQL92 for definition *
    • importedKeyInitiallyImmediate - see SQL92 for definition *
    • importedKeyNotDeferrable - see SQL92 for definition *
    *
* * @param primaryCatalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param primarySchema a schema name pattern; "" retrieves those * without a schema * @param primaryTable the table name that exports the key * @param foreignCatalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param foreignSchema a schema name pattern; "" retrieves those * without a schema * @param foreignTable the table name that imports the key * @return ResultSet - each row is a foreign key column description * @see #getImportedKeys */ public java.sql.ResultSet getCrossReference( String primaryCatalog, String primarySchema, String primaryTable, String foreignCatalog, String foreignSchema, String foreignTable) throws SQLException { try { return new RJResultSet(rmiMetadata_.getCrossReference( primaryCatalog, primarySchema, primaryTable, foreignCatalog, foreignSchema, foreignTable)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get a description of all the standard SQL types supported by * this database. They are ordered by DATA_TYPE and then by how * closely the data type maps to the corresponding JDBC SQL type. * *

Each type description has the following columns: *

    *
  1. TYPE_NAME String => Type name *
  2. DATA_TYPE short => SQL data type from java.sql.Types *
  3. PRECISION int => maximum precision *
  4. LITERAL_PREFIX String => prefix used to quote a literal * (may be null) *
  5. LITERAL_SUFFIX String => suffix used to quote a literal (may be null) *
  6. CREATE_PARAMS String => parameters used in creating * the type (may be null) *
  7. NULLABLE short => can you use NULL for this type? *
      *
    • typeNoNulls - does not allow NULL values *
    • typeNullable - allows NULL values *
    • typeNullableUnknown - nullability unknown *
    *
  8. CASE_SENSITIVE boolean=> is it case sensitive? *
  9. SEARCHABLE short => can you use "WHERE" based on this type: *
      *
    • typePredNone - No support *
    • typePredChar - Only supported with WHERE .. LIKE *
    • typePredBasic - Supported except for WHERE .. LIKE *
    • typeSearchable - Supported for all WHERE .. *
    *
  10. UNSIGNED_ATTRIBUTE boolean => is it unsigned? *
  11. FIXED_PREC_SCALE boolean => can it be a money value? *
  12. AUTO_INCREMENT boolean => can it be used for an * auto-increment value? *
  13. LOCAL_TYPE_NAME String => localized version of type name * (may be null) *
  14. MINIMUM_SCALE short => minimum scale supported *
  15. MAXIMUM_SCALE short => maximum scale supported *
  16. SQL_DATA_TYPE int => unused *
  17. SQL_DATETIME_SUB int => unused *
  18. NUM_PREC_RADIX int => usually 2 or 10 *
* * @return ResultSet - each row is a SQL type description */ public java.sql.ResultSet getTypeInfo() throws SQLException { try { return new RJResultSet(rmiMetadata_.getTypeInfo()); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get a description of a table's indices and statistics. They are * ordered by NON_UNIQUE, TYPE, INDEX_NAME, and ORDINAL_POSITION. * *

Each index column description has the following columns: *

    *
  1. TABLE_CAT String => table catalog (may be null) *
  2. TABLE_SCHEM String => table schema (may be null) *
  3. TABLE_NAME String => table name *
  4. NON_UNIQUE boolean => Can index values be non-unique? * false when TYPE is tableIndexStatistic *
  5. INDEX_QUALIFIER String => index catalog (may be null); * null when TYPE is tableIndexStatistic *
  6. INDEX_NAME String => index name; null when TYPE is * tableIndexStatistic *
  7. TYPE short => index type: *
      *
    • tableIndexStatistic - this identifies table statistics that are * returned in conjuction with a table's index descriptions *
    • tableIndexClustered - this is a clustered index *
    • tableIndexHashed - this is a hashed index *
    • tableIndexOther - this is some other style of index *
    *
  8. ORDINAL_POSITION short => column sequence number * within index; zero when TYPE is tableIndexStatistic *
  9. COLUMN_NAME String => column name; null when TYPE is * tableIndexStatistic *
  10. ASC_OR_DESC String => column sort sequence, "A" => ascending, * "D" => descending, may be null if sort sequence is not supported; * null when TYPE is tableIndexStatistic *
  11. CARDINALITY int => When TYPE is tableIndexStatistic, then * this is the number of rows in the table; otherwise, it is the * number of unique values in the index. *
  12. PAGES int => When TYPE is tableIndexStatisic then * this is the number of pages used for the table, otherwise it * is the number of pages used for the current index. *
  13. FILTER_CONDITION String => Filter condition, if any. * (may be null) *
* * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schema a schema name pattern; "" retrieves those without a schema * @param table a table name * @param unique when true, return only indices for unique values; * when false, return indices regardless of whether unique or not * @param approximate when true, result is allowed to reflect approximate * or out of data values; when false, results are requested to be * accurate * @return ResultSet - each row is an index column description */ public java.sql.ResultSet getIndexInfo(String catalog, String schema, String table, boolean unique, boolean approximate) throws SQLException { try { return new RJResultSet(rmiMetadata_.getIndexInfo(catalog, schema, table, unique, approximate)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } // JDBC 2.0 methods public boolean updatesAreDetected(int type) throws SQLException { try { return rmiMetadata_.updatesAreDetected(type); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public boolean supportsResultSetType(int type) throws SQLException { try { return rmiMetadata_.supportsResultSetType(type); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public boolean supportsResultSetConcurrency(int type, int concurrency) throws SQLException { try { return rmiMetadata_.supportsResultSetConcurrency(type,concurrency); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public boolean ownUpdatesAreVisible(int type) throws SQLException { try { return rmiMetadata_.ownUpdatesAreVisible(type); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public boolean ownInsertsAreVisible(int type) throws SQLException { try { return rmiMetadata_.ownInsertsAreVisible(type); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public boolean ownDeletesAreVisible(int type) throws SQLException { try { return rmiMetadata_.ownDeletesAreVisible(type); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public boolean othersUpdatesAreVisible(int type) throws SQLException { try { return rmiMetadata_.othersUpdatesAreVisible(type); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public boolean othersInsertsAreVisible(int type) throws SQLException { try { return rmiMetadata_.othersInsertsAreVisible(type); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public boolean othersDeletesAreVisible(int type) throws SQLException { try { return rmiMetadata_.othersDeletesAreVisible(type); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public boolean insertsAreDetected(int type) throws SQLException { try { return rmiMetadata_.insertsAreDetected(type); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public ResultSet getUDTs(String catalog, String schemaPattern, String typeNamePattern, int[] types) throws SQLException { try { return rmiMetadata_.getUDTs(catalog,schemaPattern,typeNamePattern,types); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public boolean supportsBatchUpdates() throws SQLException { try { return rmiMetadata_.supportsBatchUpdates(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public Connection getConnection() throws SQLException { try { return rmiMetadata_.getConnection(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public boolean deletesAreDetected(int type) throws SQLException { try { return rmiMetadata_.deletesAreDetected(type); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } }; PK Mi+) dd RJDatabaseMetaDataInterface.java /** * RmiJdbc client/server JDBC Driver * (C) GIE Dyade (Groupe BULL / INRIA Research Center) 1997 * * @version 1.0 * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com) */ package RmiJdbc; import java.sql.*; import java.rmi.RemoteException; /** * This class provides information about the database as a whole. * *

Many of the methods here return lists of information in ResultSets. * You can use the normal ResultSet methods such as getString and getInt * to retrieve the data from these ResultSets. If a given form of * metadata is not available, these methods should throw a SQLException. * *

Some of these methods take arguments that are String patterns. These * arguments all have names such as fooPattern. Within a pattern String, "%" * means match any substring of 0 or more characters, and "_" means match * any one character. Only metadata entries matching the search pattern * are returned. If a search pattern argument is set to a null ref, it means * that argument's criteria should be dropped from the search. * *

A SQLException will be thrown if a driver does not support a meta * data method. In the case of methods that return a ResultSet, * either a ResultSet (which may be empty) is returned or a * SQLException is thrown. */ interface RJDatabaseMetaDataInterface extends java.rmi.Remote { //---------------------------------------------------------------------- // First, a variety of minor information about the target database. /** * Can all the procedures returned by getProcedures be called by the * current user? * * @return true if so */ boolean allProceduresAreCallable() throws RemoteException, SQLException; /** * Can all the tables returned by getTable be SELECTed by the * current user? * * @return true if so */ boolean allTablesAreSelectable() throws RemoteException, SQLException; /** * What's the url for this database? * * @return the url or null if it can't be generated */ String getURL() throws RemoteException, SQLException; /** * What's our user name as known to the database? * * @return our database user name */ String getUserName() throws RemoteException, SQLException; /** * Is the database in read-only mode? * * @return true if so */ boolean isReadOnly() throws RemoteException, SQLException; /** * Are NULL values sorted high? * * @return true if so */ boolean nullsAreSortedHigh() throws RemoteException, SQLException; /** * Are NULL values sorted low? * * @return true if so */ boolean nullsAreSortedLow() throws RemoteException, SQLException; /** * Are NULL values sorted at the start regardless of sort order? * * @return true if so */ boolean nullsAreSortedAtStart() throws RemoteException, SQLException; /** * Are NULL values sorted at the end regardless of sort order? * * @return true if so */ boolean nullsAreSortedAtEnd() throws RemoteException, SQLException; /** * What's the name of this database product? * * @return database product name */ String getDatabaseProductName() throws RemoteException, SQLException; /** * What's the version of this database product? * * @return database version */ String getDatabaseProductVersion() throws RemoteException, SQLException; /** * What's the name of this JDBC driver? * * @return JDBC driver name */ String getDriverName() throws RemoteException, SQLException; /** * What's the version of this JDBC driver? * * @return JDBC driver version */ String getDriverVersion() throws RemoteException, SQLException; /** * What's this JDBC driver's major version number? * * @return JDBC driver major version */ int getDriverMajorVersion() throws RemoteException, SQLException; /** * What's this JDBC driver's minor version number? * * @return JDBC driver minor version number */ int getDriverMinorVersion() throws RemoteException, SQLException; /** * Does the database store tables in a local file? * * @return true if so */ boolean usesLocalFiles() throws RemoteException, SQLException; /** * Does the database use a file for each table? * * @return true if the database uses a local file for each table */ boolean usesLocalFilePerTable() throws RemoteException, SQLException; /** * Does the database treat mixed case unquoted SQL identifiers as * case sensitive and as a result store them in mixed case? * * A JDBC-Compliant driver will always return false. * * @return true if so */ boolean supportsMixedCaseIdentifiers() throws RemoteException, SQLException; /** * Does the database treat mixed case unquoted SQL identifiers as * case insensitive and store them in upper case? * * @return true if so */ boolean storesUpperCaseIdentifiers() throws RemoteException, SQLException; /** * Does the database treat mixed case unquoted SQL identifiers as * case insensitive and store them in lower case? * * @return true if so */ boolean storesLowerCaseIdentifiers() throws RemoteException, SQLException; /** * Does the database treat mixed case unquoted SQL identifiers as * case insensitive and store them in mixed case? * * @return true if so */ boolean storesMixedCaseIdentifiers() throws RemoteException, SQLException; /** * Does the database treat mixed case quoted SQL identifiers as * case sensitive and as a result store them in mixed case? * * A JDBC-Compliant driver will always return false. * * @return true if so */ boolean supportsMixedCaseQuotedIdentifiers() throws RemoteException, SQLException; /** * Does the database treat mixed case quoted SQL identifiers as * case insensitive and store them in upper case? * * @return true if so */ boolean storesUpperCaseQuotedIdentifiers() throws RemoteException, SQLException; /** * Does the database treat mixed case quoted SQL identifiers as * case insensitive and store them in lower case? * * @return true if so */ boolean storesLowerCaseQuotedIdentifiers() throws RemoteException, SQLException; /** * Does the database treat mixed case quoted SQL identifiers as * case insensitive and store them in mixed case? * * @return true if so */ boolean storesMixedCaseQuotedIdentifiers() throws RemoteException, SQLException; /** * What's the string used to quote SQL identifiers? * This returns a space " " if identifier quoting isn't supported. * * A JDBC-Compliant driver always uses a double quote character. * * @return the quoting string */ String getIdentifierQuoteString() throws RemoteException, SQLException; /** * Get a comma separated list of all a database's SQL keywords * that are NOT also SQL92 keywords. * * @return the list */ String getSQLKeywords() throws RemoteException, SQLException; /** * Get a comma separated list of math functions. * * @return the list */ String getNumericFunctions() throws RemoteException, SQLException; /** * Get a comma separated list of string functions. * * @return the list */ String getStringFunctions() throws RemoteException, SQLException; /** * Get a comma separated list of system functions. * * @return the list */ String getSystemFunctions() throws RemoteException, SQLException; /** * Get a comma separated list of time and date functions. * * @return the list */ String getTimeDateFunctions() throws RemoteException, SQLException; /** * This is the string that can be used to escape '_' or '%' in * the string pattern style catalog search parameters. * *

The '_' character represents any single character. *

The '%' character represents any sequence of zero or * more characters. * @return the string used to escape wildcard characters */ String getSearchStringEscape() throws RemoteException, SQLException; /** * Get all the "extra" characters that can be used in unquoted * identifier names (those beyond a-z, A-Z, 0-9 and _). * * @return the string containing the extra characters */ String getExtraNameCharacters() throws RemoteException, SQLException; //-------------------------------------------------------------------- // Functions describing which features are supported. /** * Is "ALTER TABLE" with add column supported? * * @return true if so */ boolean supportsAlterTableWithAddColumn() throws RemoteException, SQLException; /** * Is "ALTER TABLE" with drop column supported? * * @return true if so */ boolean supportsAlterTableWithDropColumn() throws RemoteException, SQLException; /** * Is column aliasing supported? * *

If so, the SQL AS clause can be used to provide names for * computed columns or to provide alias names for columns as * required. * * A JDBC-Compliant driver always returns true. * * @return true if so */ boolean supportsColumnAliasing() throws RemoteException, SQLException; /** * Are concatenations between NULL and non-NULL values NULL? * * A JDBC-Compliant driver always returns true. * * @return true if so */ boolean nullPlusNonNullIsNull() throws RemoteException, SQLException; /** * Is the CONVERT function between SQL types supported? * * @return true if so */ boolean supportsConvert() throws RemoteException, SQLException; /** * Is CONVERT between the given SQL types supported? * * @param fromType the type to convert from * @param toType the type to convert to * @return true if so * @see Types */ boolean supportsConvert(int fromType, int toType) throws RemoteException, SQLException; /** * Are table correlation names supported? * * A JDBC-Compliant driver always returns true. * * @return true if so */ boolean supportsTableCorrelationNames() throws RemoteException, SQLException; /** * If table correlation names are supported, are they restricted * to be different from the names of the tables? * * @return true if so */ boolean supportsDifferentTableCorrelationNames() throws RemoteException, SQLException; /** * Are expressions in "ORDER BY" lists supported? * * @return true if so */ boolean supportsExpressionsInOrderBy() throws RemoteException, SQLException; /** * Can an "ORDER BY" clause use columns not in the SELECT? * * @return true if so */ boolean supportsOrderByUnrelated() throws RemoteException, SQLException; /** * Is some form of "GROUP BY" clause supported? * * @return true if so */ boolean supportsGroupBy() throws RemoteException, SQLException; /** * Can a "GROUP BY" clause use columns not in the SELECT? * * @return true if so */ boolean supportsGroupByUnrelated() throws RemoteException, SQLException; /** * Can a "GROUP BY" clause add columns not in the SELECT * provided it specifies all the columns in the SELECT? * * @return true if so */ boolean supportsGroupByBeyondSelect() throws RemoteException, SQLException; /** * Is the escape character in "LIKE" clauses supported? * * A JDBC-Compliant driver always returns true. * * @return true if so */ boolean supportsLikeEscapeClause() throws RemoteException, SQLException; /** * Are multiple ResultSets from a single execute supported? * * @return true if so */ boolean supportsMultipleResultSets() throws RemoteException, SQLException; /** * Can we have multiple transactions open at once (on different * connections)? * * @return true if so */ boolean supportsMultipleTransactions() throws RemoteException, SQLException; /** * Can columns be defined as non-nullable? * * A JDBC-Compliant driver always returns true. * * @return true if so */ boolean supportsNonNullableColumns() throws RemoteException, SQLException; /** * Is the ODBC Minimum SQL grammar supported? * * All JDBC-Compliant drivers must return true. * * @return true if so */ boolean supportsMinimumSQLGrammar() throws RemoteException, SQLException; /** * Is the ODBC Core SQL grammar supported? * * @return true if so */ boolean supportsCoreSQLGrammar() throws RemoteException, SQLException; /** * Is the ODBC Extended SQL grammar supported? * * @return true if so */ boolean supportsExtendedSQLGrammar() throws RemoteException, SQLException; /** * Is the ANSI92 entry level SQL grammar supported? * * All JDBC-Compliant drivers must return true. * * @return true if so */ boolean supportsANSI92EntryLevelSQL() throws RemoteException, SQLException; /** * Is the ANSI92 intermediate SQL grammar supported? * * @return true if so */ boolean supportsANSI92IntermediateSQL() throws RemoteException, SQLException; /** * Is the ANSI92 full SQL grammar supported? * * @return true if so */ boolean supportsANSI92FullSQL() throws RemoteException, SQLException; /** * Is the SQL Integrity Enhancement Facility supported? * * @return true if so */ boolean supportsIntegrityEnhancementFacility() throws RemoteException, SQLException; /** * Is some form of outer join supported? * * @return true if so */ boolean supportsOuterJoins() throws RemoteException, SQLException; /** * Are full nested outer joins supported? * * @return true if so */ boolean supportsFullOuterJoins() throws RemoteException, SQLException; /** * Is there limited support for outer joins? (This will be true * if supportFullOuterJoins is true.) * * @return true if so */ boolean supportsLimitedOuterJoins() throws RemoteException, SQLException; /** * What's the database vendor's preferred term for "schema"? * * @return the vendor term */ String getSchemaTerm() throws RemoteException, SQLException; /** * What's the database vendor's preferred term for "procedure"? * * @return the vendor term */ String getProcedureTerm() throws RemoteException, SQLException; /** * What's the database vendor's preferred term for "catalog"? * * @return the vendor term */ String getCatalogTerm() throws RemoteException, SQLException; /** * Does a catalog appear at the start of a qualified table name? * (Otherwise it appears at the end) * * @return true if it appears at the start */ boolean isCatalogAtStart() throws RemoteException, SQLException; /** * What's the separator between catalog and table name? * * @return the separator string */ String getCatalogSeparator() throws RemoteException, SQLException; /** * Can a schema name be used in a data manipulation statement? * * @return true if so */ boolean supportsSchemasInDataManipulation() throws RemoteException, SQLException; /** * Can a schema name be used in a procedure call statement? * * @return true if so */ boolean supportsSchemasInProcedureCalls() throws RemoteException, SQLException; /** * Can a schema name be used in a table definition statement? * * @return true if so */ boolean supportsSchemasInTableDefinitions() throws RemoteException, SQLException; /** * Can a schema name be used in an index definition statement? * * @return true if so */ boolean supportsSchemasInIndexDefinitions() throws RemoteException, SQLException; /** * Can a schema name be used in a privilege definition statement? * * @return true if so */ boolean supportsSchemasInPrivilegeDefinitions() throws RemoteException, SQLException; /** * Can a catalog name be used in a data manipulation statement? * * @return true if so */ boolean supportsCatalogsInDataManipulation() throws RemoteException, SQLException; /** * Can a catalog name be used in a procedure call statement? * * @return true if so */ boolean supportsCatalogsInProcedureCalls() throws RemoteException, SQLException; /** * Can a catalog name be used in a table definition statement? * * @return true if so */ boolean supportsCatalogsInTableDefinitions() throws RemoteException, SQLException; /** * Can a catalog name be used in an index definition statement? * * @return true if so */ boolean supportsCatalogsInIndexDefinitions() throws RemoteException, SQLException; /** * Can a catalog name be used in a privilege definition statement? * * @return true if so */ boolean supportsCatalogsInPrivilegeDefinitions() throws RemoteException, SQLException; /** * Is positioned DELETE supported? * * @return true if so */ boolean supportsPositionedDelete() throws RemoteException, SQLException; /** * Is positioned UPDATE supported? * * @return true if so */ boolean supportsPositionedUpdate() throws RemoteException, SQLException; /** * Is SELECT for UPDATE supported? * * @return true if so */ boolean supportsSelectForUpdate() throws RemoteException, SQLException; /** * Are stored procedure calls using the stored procedure escape * syntax supported? * * @return true if so */ boolean supportsStoredProcedures() throws RemoteException, SQLException; /** * Are subqueries in comparison expressions supported? * * A JDBC-Compliant driver always returns true. * * @return true if so */ boolean supportsSubqueriesInComparisons() throws RemoteException, SQLException; /** * Are subqueries in 'exists' expressions supported? * * A JDBC-Compliant driver always returns true. * * @return true if so */ boolean supportsSubqueriesInExists() throws RemoteException, SQLException; /** * Are subqueries in 'in' statements supported? * * A JDBC-Compliant driver always returns true. * * @return true if so */ boolean supportsSubqueriesInIns() throws RemoteException, SQLException; /** * Are subqueries in quantified expressions supported? * * A JDBC-Compliant driver always returns true. * * @return true if so */ boolean supportsSubqueriesInQuantifieds() throws RemoteException, SQLException; /** * Are correlated subqueries supported? * * A JDBC-Compliant driver always returns true. * * @return true if so */ boolean supportsCorrelatedSubqueries() throws RemoteException, SQLException; /** * Is SQL UNION supported? * * @return true if so */ boolean supportsUnion() throws RemoteException, SQLException; /** * Is SQL UNION ALL supported? * * @return true if so */ boolean supportsUnionAll() throws RemoteException, SQLException; /** * Can cursors remain open across commits? * * @return true if cursors always remain open; false if they might not remain open */ boolean supportsOpenCursorsAcrossCommit() throws RemoteException, SQLException; /** * Can cursors remain open across rollbacks? * * @return true if cursors always remain open; false if they might not remain open */ boolean supportsOpenCursorsAcrossRollback() throws RemoteException, SQLException; /** * Can statements remain open across commits? * * @return true if statements always remain open; false if they might not remain open */ boolean supportsOpenStatementsAcrossCommit() throws RemoteException, SQLException; /** * Can statements remain open across rollbacks? * * @return true if statements always remain open; false if they might not remain open */ boolean supportsOpenStatementsAcrossRollback() throws RemoteException, SQLException; //---------------------------------------------------------------------- // The following group of methods exposes various limitations // based on the target database with the current driver. // Unless otherwise specified, a result of zero means there is no // limit, or the limit is not known. /** * How many hex characters can you have in an inline binary literal? * * @return max literal length */ int getMaxBinaryLiteralLength() throws RemoteException, SQLException; /** * What's the max length for a character literal? * * @return max literal length */ int getMaxCharLiteralLength() throws RemoteException, SQLException; /** * What's the limit on column name length? * * @return max literal length */ int getMaxColumnNameLength() throws RemoteException, SQLException; /** * What's the maximum number of columns in a "GROUP BY" clause? * * @return max number of columns */ int getMaxColumnsInGroupBy() throws RemoteException, SQLException; /** * What's the maximum number of columns allowed in an index? * * @return max columns */ int getMaxColumnsInIndex() throws RemoteException, SQLException; /** * What's the maximum number of columns in an "ORDER BY" clause? * * @return max columns */ int getMaxColumnsInOrderBy() throws RemoteException, SQLException; /** * What's the maximum number of columns in a "SELECT" list? * * @return max columns */ int getMaxColumnsInSelect() throws RemoteException, SQLException; /** * What's the maximum number of columns in a table? * * @return max columns */ int getMaxColumnsInTable() throws RemoteException, SQLException; /** * How many active connections can we have at a time to this database? * * @return max connections */ int getMaxConnections() throws RemoteException, SQLException; /** * What's the maximum cursor name length? * * @return max cursor name length in bytes */ int getMaxCursorNameLength() throws RemoteException, SQLException; /** * What's the maximum length of an index (in bytes)? * * @return max index length in bytes */ int getMaxIndexLength() throws RemoteException, SQLException; /** * What's the maximum length allowed for a schema name? * * @return max name length in bytes */ int getMaxSchemaNameLength() throws RemoteException, SQLException; /** * What's the maximum length of a procedure name? * * @return max name length in bytes */ int getMaxProcedureNameLength() throws RemoteException, SQLException; /** * What's the maximum length of a catalog name? * * @return max name length in bytes */ int getMaxCatalogNameLength() throws RemoteException, SQLException; /** * What's the maximum length of a single row? * * @return max row size in bytes */ int getMaxRowSize() throws RemoteException, SQLException; /** * Did getMaxRowSize() include LONGVARCHAR and LONGVARBINARY * blobs? * * @return true if so */ boolean doesMaxRowSizeIncludeBlobs() throws RemoteException, SQLException; /** * What's the maximum length of a SQL statement? * * @return max length in bytes */ int getMaxStatementLength() throws RemoteException, SQLException; /** * How many active statements can we have open at one time to this * database? * * @return the maximum */ int getMaxStatements() throws RemoteException, SQLException; /** * What's the maximum length of a table name? * * @return max name length in bytes */ int getMaxTableNameLength() throws RemoteException, SQLException; /** * What's the maximum number of tables in a SELECT? * * @return the maximum */ int getMaxTablesInSelect() throws RemoteException, SQLException; /** * What's the maximum length of a user name? * * @return max name length in bytes */ int getMaxUserNameLength() throws RemoteException, SQLException; //---------------------------------------------------------------------- /** * What's the database's default transaction isolation level? The * values are defined in java.sql.Connection. * * @return the default isolation level * @see Connection */ int getDefaultTransactionIsolation() throws RemoteException, SQLException; /** * Are transactions supported? If not, commit is a noop and the * isolation level is TRANSACTION_NONE. * * @return true if transactions are supported */ boolean supportsTransactions() throws RemoteException, SQLException; /** * Does the database support the given transaction isolation level? * * @param level the values are defined in java.sql.Connection * @return true if so * @see Connection */ boolean supportsTransactionIsolationLevel(int level) throws RemoteException, SQLException; /** * Are both data definition and data manipulation statements * within a transaction supported? * * @return true if so */ boolean supportsDataDefinitionAndDataManipulationTransactions() throws RemoteException, SQLException; /** * Are only data manipulation statements within a transaction * supported? * * @return true if so */ boolean supportsDataManipulationTransactionsOnly() throws RemoteException, SQLException; /** * Does a data definition statement within a transaction force the * transaction to commit? * * @return true if so */ boolean dataDefinitionCausesTransactionCommit() throws RemoteException, SQLException; /** * Is a data definition statement within a transaction ignored? * * @return true if so */ boolean dataDefinitionIgnoredInTransactions() throws RemoteException, SQLException; /** * Get a description of stored procedures available in a * catalog. * *

Only procedure descriptions matching the schema and * procedure name criteria are returned. They are ordered by * PROCEDURE_SCHEM, and PROCEDURE_NAME. * *

Each procedure description has the the following columns: *

    *
  1. PROCEDURE_CAT String => procedure catalog (may be null) *
  2. PROCEDURE_SCHEM String => procedure schema (may be null) *
  3. PROCEDURE_NAME String => procedure name *
  4. reserved for future use *
  5. reserved for future use *
  6. reserved for future use *
  7. REMARKS String => explanatory comment on the procedure *
  8. PROCEDURE_TYPE short => kind of procedure: *
      *
    • procedureResultUnknown - May return a result *
    • procedureNoResult - Does not return a result *
    • procedureReturnsResult - Returns a result *
    *
* * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schemaPattern a schema name pattern; "" retrieves those * without a schema * @param procedureNamePattern a procedure name pattern * @return RJResultSetInterface - each row is a procedure description * @see #getSearchStringEscape */ RJResultSetInterface getProcedures(String catalog, String schemaPattern, String procedureNamePattern) throws RemoteException, SQLException; /** * Get a description of a catalog's stored procedure parameters * and result columns. * *

Only descriptions matching the schema, procedure and * parameter name criteria are returned. They are ordered by * PROCEDURE_SCHEM and PROCEDURE_NAME. Within this, the return value, * if any, is first. Next are the parameter descriptions in call * order. The column descriptions follow in column number order. * *

Each row in the RJResultSetInterface is a parameter description or * column description with the following fields: *

    *
  1. PROCEDURE_CAT String => procedure catalog (may be null) *
  2. PROCEDURE_SCHEM String => procedure schema (may be null) *
  3. PROCEDURE_NAME String => procedure name *
  4. COLUMN_NAME String => column/parameter name *
  5. COLUMN_TYPE Short => kind of column/parameter: *
      *
    • procedureColumnUnknown - nobody knows *
    • procedureColumnIn - IN parameter *
    • procedureColumnInOut - INOUT parameter *
    • procedureColumnOut - OUT parameter *
    • procedureColumnReturn - procedure return value *
    • procedureColumnResult - result column in RJResultSetInterface *
    *
  6. DATA_TYPE short => SQL type from java.sql.Types *
  7. TYPE_NAME String => SQL type name *
  8. PRECISION int => precision *
  9. LENGTH int => length in bytes of data *
  10. SCALE short => scale *
  11. RADIX short => radix *
  12. NULLABLE short => can it contain NULL? *
      *
    • procedureNoNulls - does not allow NULL values *
    • procedureNullable - allows NULL values *
    • procedureNullableUnknown - nullability unknown *
    *
  13. REMARKS String => comment describing parameter/column *
* *

Note: Some databases may not return the column * descriptions for a procedure. Additional columns beyond * REMARKS can be defined by the database. * * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schemaPattern a schema name pattern; "" retrieves those * without a schema * @param procedureNamePattern a procedure name pattern * @param columnNamePattern a column name pattern * @return RJResultSetInterface - each row is a stored procedure parameter or * column description * @see #getSearchStringEscape */ RJResultSetInterface getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern) throws RemoteException, SQLException; /** * Get a description of tables available in a catalog. * *

Only table descriptions matching the catalog, schema, table * name and type criteria are returned. They are ordered by * TABLE_TYPE, TABLE_SCHEM and TABLE_NAME. * *

Each table description has the following columns: *

    *
  1. TABLE_CAT String => table catalog (may be null) *
  2. TABLE_SCHEM String => table schema (may be null) *
  3. TABLE_NAME String => table name *
  4. TABLE_TYPE String => table type. Typical types are "TABLE", * "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", * "LOCAL TEMPORARY", "ALIAS", "SYNONYM". *
  5. REMARKS String => explanatory comment on the table *
* *

Note: Some databases may not return information for * all tables. * * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schemaPattern a schema name pattern; "" retrieves those * without a schema * @param tableNamePattern a table name pattern * @param types a list of table types to include; null returns all types * @return RJResultSetInterface - each row is a table description * @see #getSearchStringEscape */ RJResultSetInterface getTables(String catalog, String schemaPattern, String tableNamePattern, String types[]) throws RemoteException, SQLException; /** * Get the schema names available in this database. The results * are ordered by schema name. * *

The schema column is: *

    *
  1. TABLE_SCHEM String => schema name *
* * @return RJResultSetInterface - each row has a single String column that is a * schema name */ RJResultSetInterface getSchemas() throws RemoteException, SQLException; /** * Get the catalog names available in this database. The results * are ordered by catalog name. * *

The catalog column is: *

    *
  1. TABLE_CAT String => catalog name *
* * @return RJResultSetInterface - each row has a single String column that is a * catalog name */ RJResultSetInterface getCatalogs() throws RemoteException, SQLException; /** * Get the table types available in this database. The results * are ordered by table type. * *

The table type is: *

    *
  1. TABLE_TYPE String => table type. Typical types are "TABLE", * "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", * "LOCAL TEMPORARY", "ALIAS", "SYNONYM". *
* * @return RJResultSetInterface - each row has a single String column that is a * table type */ RJResultSetInterface getTableTypes() throws RemoteException, SQLException; /** * Get a description of table columns available in a catalog. * *

Only column descriptions matching the catalog, schema, table * and column name criteria are returned. They are ordered by * TABLE_SCHEM, TABLE_NAME and ORDINAL_POSITION. * *

Each column description has the following columns: *

    *
  1. TABLE_CAT String => table catalog (may be null) *
  2. TABLE_SCHEM String => table schema (may be null) *
  3. TABLE_NAME String => table name *
  4. COLUMN_NAME String => column name *
  5. DATA_TYPE short => SQL type from java.sql.Types *
  6. TYPE_NAME String => Data source dependent type name *
  7. COLUMN_SIZE int => column size. For char or date * types this is the maximum number of characters, for numeric or * decimal types this is precision. *
  8. BUFFER_LENGTH is not used. *
  9. DECIMAL_DIGITS int => the number of fractional digits *
  10. NUM_PREC_RADIX int => Radix (typically either 10 or 2) *
  11. NULLABLE int => is NULL allowed? *
      *
    • columnNoNulls - might not allow NULL values *
    • columnNullable - definitely allows NULL values *
    • columnNullableUnknown - nullability unknown *
    *
  12. REMARKS String => comment describing column (may be null) *
  13. COLUMN_DEF String => default value (may be null) *
  14. SQL_DATA_TYPE int => unused *
  15. SQL_DATETIME_SUB int => unused *
  16. CHAR_OCTET_LENGTH int => for char types the * maximum number of bytes in the column *
  17. ORDINAL_POSITION int => index of column in table * (starting at 1) *
  18. IS_NULLABLE String => "NO" means column definitely * does not allow NULL values; "YES" means the column might * allow NULL values. An empty string means nobody knows. *
* * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schemaPattern a schema name pattern; "" retrieves those * without a schema * @param tableNamePattern a table name pattern * @param columnNamePattern a column name pattern * @return RJResultSetInterface - each row is a column description * @see #getSearchStringEscape */ RJResultSetInterface getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) throws RemoteException, SQLException; /** * Get a description of the access rights for a table's columns. * *

Only privileges matching the column name criteria are * returned. They are ordered by COLUMN_NAME and PRIVILEGE. * *

Each privilige description has the following columns: *

    *
  1. TABLE_CAT String => table catalog (may be null) *
  2. TABLE_SCHEM String => table schema (may be null) *
  3. TABLE_NAME String => table name *
  4. COLUMN_NAME String => column name *
  5. GRANTOR => grantor of access (may be null) *
  6. GRANTEE String => grantee of access *
  7. PRIVILEGE String => name of access (SELECT, * INSERT, UPDATE, REFRENCES, ...) *
  8. IS_GRANTABLE String => "YES" if grantee is permitted * to grant to others; "NO" if not; null if unknown *
* * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schema a schema name; "" retrieves those without a schema * @param table a table name * @param columnNamePattern a column name pattern * @return RJResultSetInterface - each row is a column privilege description * @see #getSearchStringEscape */ RJResultSetInterface getColumnPrivileges(String catalog, String schema, String table, String columnNamePattern) throws RemoteException, SQLException; /** * Get a description of the access rights for each table available * in a catalog. Note that a table privilege applies to one or * more columns in the table. It would be wrong to assume that * this priviledge applies to all columns (this may be true for * some systems but is not true for all.) * *

Only privileges matching the schema and table name * criteria are returned. They are ordered by TABLE_SCHEM, * TABLE_NAME, and PRIVILEGE. * *

Each privilige description has the following columns: *

    *
  1. TABLE_CAT String => table catalog (may be null) *
  2. TABLE_SCHEM String => table schema (may be null) *
  3. TABLE_NAME String => table name *
  4. GRANTOR => grantor of access (may be null) *
  5. GRANTEE String => grantee of access *
  6. PRIVILEGE String => name of access (SELECT, * INSERT, UPDATE, REFRENCES, ...) *
  7. IS_GRANTABLE String => "YES" if grantee is permitted * to grant to others; "NO" if not; null if unknown *
* * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schemaPattern a schema name pattern; "" retrieves those * without a schema * @param tableNamePattern a table name pattern * @return RJResultSetInterface - each row is a table privilege description * @see #getSearchStringEscape */ RJResultSetInterface getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern) throws RemoteException, SQLException; /** * Get a description of a table's optimal set of columns that * uniquely identifies a row. They are ordered by SCOPE. * *

Each column description has the following columns: *

    *
  1. SCOPE short => actual scope of result *
      *
    • bestRowTemporary - very temporary, while using row *
    • bestRowTransaction - valid for remainder of current transaction *
    • bestRowSession - valid for remainder of current session *
    *
  2. COLUMN_NAME String => column name *
  3. DATA_TYPE short => SQL data type from java.sql.Types *
  4. TYPE_NAME String => Data source dependent type name *
  5. COLUMN_SIZE int => precision *
  6. BUFFER_LENGTH int => not used *
  7. DECIMAL_DIGITS short => scale *
  8. PSEUDO_COLUMN short => is this a pseudo column * like an Oracle ROWID *
      *
    • bestRowUnknown - may or may not be pseudo column *
    • bestRowNotPseudo - is NOT a pseudo column *
    • bestRowPseudo - is a pseudo column *
    *
* * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schema a schema name; "" retrieves those without a schema * @param table a table name * @param scope the scope of interest; use same values as SCOPE * @param nullable include columns that are nullable? * @return RJResultSetInterface - each row is a column description */ RJResultSetInterface getBestRowIdentifier(String catalog, String schema, String table, int scope, boolean nullable) throws RemoteException, SQLException; /** * Get a description of a table's columns that are automatically * updated when any value in a row is updated. They are * unordered. * *

Each column description has the following columns: *

    *
  1. SCOPE short => is not used *
  2. COLUMN_NAME String => column name *
  3. DATA_TYPE short => SQL data type from java.sql.Types *
  4. TYPE_NAME String => Data source dependent type name *
  5. COLUMN_SIZE int => precision *
  6. BUFFER_LENGTH int => length of column value in bytes *
  7. DECIMAL_DIGITS short => scale *
  8. PSEUDO_COLUMN short => is this a pseudo column * like an Oracle ROWID *
      *
    • versionColumnUnknown - may or may not be pseudo column *
    • versionColumnNotPseudo - is NOT a pseudo column *
    • versionColumnPseudo - is a pseudo column *
    *
* * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schema a schema name; "" retrieves those without a schema * @param table a table name * @return RJResultSetInterface - each row is a column description */ RJResultSetInterface getVersionColumns(String catalog, String schema, String table) throws RemoteException, SQLException; /** * Get a description of a table's primary key columns. They * are ordered by COLUMN_NAME. * *

Each primary key column description has the following columns: *

    *
  1. TABLE_CAT String => table catalog (may be null) *
  2. TABLE_SCHEM String => table schema (may be null) *
  3. TABLE_NAME String => table name *
  4. COLUMN_NAME String => column name *
  5. KEY_SEQ short => sequence number within primary key *
  6. PK_NAME String => primary key name (may be null) *
* * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schema a schema name pattern; "" retrieves those * without a schema * @param table a table name * @return RJResultSetInterface - each row is a primary key column description */ RJResultSetInterface getPrimaryKeys(String catalog, String schema, String table) throws RemoteException, SQLException; /** * Get a description of the primary key columns that are * referenced by a table's foreign key columns (the primary keys * imported by a table). They are ordered by PKTABLE_CAT, * PKTABLE_SCHEM, PKTABLE_NAME, and KEY_SEQ. * *

Each primary key column description has the following columns: *

    *
  1. PKTABLE_CAT String => primary key table catalog * being imported (may be null) *
  2. PKTABLE_SCHEM String => primary key table schema * being imported (may be null) *
  3. PKTABLE_NAME String => primary key table name * being imported *
  4. PKCOLUMN_NAME String => primary key column name * being imported *
  5. FKTABLE_CAT String => foreign key table catalog (may be null) *
  6. FKTABLE_SCHEM String => foreign key table schema (may be null) *
  7. FKTABLE_NAME String => foreign key table name *
  8. FKCOLUMN_NAME String => foreign key column name *
  9. KEY_SEQ short => sequence number within foreign key *
  10. UPDATE_RULE short => What happens to * foreign key when primary is updated: *
      *
    • importedNoAction - do not allow update of primary * key if it has been imported *
    • importedKeyCascade - change imported key to agree * with primary key update *
    • importedKeySetNull - change imported key to NULL if * its primary key has been updated *
    • importedKeySetDefault - change imported key to default values * if its primary key has been updated *
    • importedKeyRestrict - same as importedKeyNoAction * (for ODBC 2.x compatibility) *
    *
  11. DELETE_RULE short => What happens to * the foreign key when primary is deleted. *
      *
    • importedKeyNoAction - do not allow delete of primary * key if it has been imported *
    • importedKeyCascade - delete rows that import a deleted key *
    • importedKeySetNull - change imported key to NULL if * its primary key has been deleted *
    • importedKeyRestrict - same as importedKeyNoAction * (for ODBC 2.x compatibility) *
    • importedKeySetDefault - change imported key to default if * its primary key has been deleted *
    *
  12. FK_NAME String => foreign key name (may be null) *
  13. PK_NAME String => primary key name (may be null) *
  14. DEFERRABILITY short => can the evaluation of foreign key * constraints be deferred until commit *
      *
    • importedKeyInitiallyDeferred - see SQL92 for definition *
    • importedKeyInitiallyImmediate - see SQL92 for definition *
    • importedKeyNotDeferrable - see SQL92 for definition *
    *
* * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schema a schema name pattern; "" retrieves those * without a schema * @param table a table name * @return RJResultSetInterface - each row is a primary key column description * @see #getExportedKeys */ RJResultSetInterface getImportedKeys(String catalog, String schema, String table) throws RemoteException, SQLException; /** * Get a description of the foreign key columns that reference a * table's primary key columns (the foreign keys exported by a * table). They are ordered by FKTABLE_CAT, FKTABLE_SCHEM, * FKTABLE_NAME, and KEY_SEQ. * *

Each foreign key column description has the following columns: *

    *
  1. PKTABLE_CAT String => primary key table catalog (may be null) *
  2. PKTABLE_SCHEM String => primary key table schema (may be null) *
  3. PKTABLE_NAME String => primary key table name *
  4. PKCOLUMN_NAME String => primary key column name *
  5. FKTABLE_CAT String => foreign key table catalog (may be null) * being exported (may be null) *
  6. FKTABLE_SCHEM String => foreign key table schema (may be null) * being exported (may be null) *
  7. FKTABLE_NAME String => foreign key table name * being exported *
  8. FKCOLUMN_NAME String => foreign key column name * being exported *
  9. KEY_SEQ short => sequence number within foreign key *
  10. UPDATE_RULE short => What happens to * foreign key when primary is updated: *
      *
    • importedNoAction - do not allow update of primary * key if it has been imported *
    • importedKeyCascade - change imported key to agree * with primary key update *
    • importedKeySetNull - change imported key to NULL if * its primary key has been updated *
    • importedKeySetDefault - change imported key to default values * if its primary key has been updated *
    • importedKeyRestrict - same as importedKeyNoAction * (for ODBC 2.x compatibility) *
    *
  11. DELETE_RULE short => What happens to * the foreign key when primary is deleted. *
      *
    • importedKeyNoAction - do not allow delete of primary * key if it has been imported *
    • importedKeyCascade - delete rows that import a deleted key *
    • importedKeySetNull - change imported key to NULL if * its primary key has been deleted *
    • importedKeyRestrict - same as importedKeyNoAction * (for ODBC 2.x compatibility) *
    • importedKeySetDefault - change imported key to default if * its primary key has been deleted *
    *
  12. FK_NAME String => foreign key name (may be null) *
  13. PK_NAME String => primary key name (may be null) *
  14. DEFERRABILITY short => can the evaluation of foreign key * constraints be deferred until commit *
      *
    • importedKeyInitiallyDeferred - see SQL92 for definition *
    • importedKeyInitiallyImmediate - see SQL92 for definition *
    • importedKeyNotDeferrable - see SQL92 for definition *
    *
* * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schema a schema name pattern; "" retrieves those * without a schema * @param table a table name * @return RJResultSetInterface - each row is a foreign key column description * @see #getImportedKeys */ RJResultSetInterface getExportedKeys(String catalog, String schema, String table) throws RemoteException, SQLException; /** * Get a description of the foreign key columns in the foreign key * table that reference the primary key columns of the primary key * table (describe how one table imports another's key.) This * should normally return a single foreign key/primary key pair * (most tables only import a foreign key from a table once.) They * are ordered by FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, and * KEY_SEQ. * *

Each foreign key column description has the following columns: *

    *
  1. PKTABLE_CAT String => primary key table catalog (may be null) *
  2. PKTABLE_SCHEM String => primary key table schema (may be null) *
  3. PKTABLE_NAME String => primary key table name *
  4. PKCOLUMN_NAME String => primary key column name *
  5. FKTABLE_CAT String => foreign key table catalog (may be null) * being exported (may be null) *
  6. FKTABLE_SCHEM String => foreign key table schema (may be null) * being exported (may be null) *
  7. FKTABLE_NAME String => foreign key table name * being exported *
  8. FKCOLUMN_NAME String => foreign key column name * being exported *
  9. KEY_SEQ short => sequence number within foreign key *
  10. UPDATE_RULE short => What happens to * foreign key when primary is updated: *
      *
    • importedNoAction - do not allow update of primary * key if it has been imported *
    • importedKeyCascade - change imported key to agree * with primary key update *
    • importedKeySetNull - change imported key to NULL if * its primary key has been updated *
    • importedKeySetDefault - change imported key to default values * if its primary key has been updated *
    • importedKeyRestrict - same as importedKeyNoAction * (for ODBC 2.x compatibility) *
    *
  11. DELETE_RULE short => What happens to * the foreign key when primary is deleted. *
      *
    • importedKeyNoAction - do not allow delete of primary * key if it has been imported *
    • importedKeyCascade - delete rows that import a deleted key *
    • importedKeySetNull - change imported key to NULL if * its primary key has been deleted *
    • importedKeyRestrict - same as importedKeyNoAction * (for ODBC 2.x compatibility) *
    • importedKeySetDefault - change imported key to default if * its primary key has been deleted *
    *
  12. FK_NAME String => foreign key name (may be null) *
  13. PK_NAME String => primary key name (may be null) *
  14. DEFERRABILITY short => can the evaluation of foreign key * constraints be deferred until commit *
      *
    • importedKeyInitiallyDeferred - see SQL92 for definition *
    • importedKeyInitiallyImmediate - see SQL92 for definition *
    • importedKeyNotDeferrable - see SQL92 for definition *
    *
* * @param primaryCatalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param primarySchema a schema name pattern; "" retrieves those * without a schema * @param primaryTable the table name that exports the key * @param foreignCatalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param foreignSchema a schema name pattern; "" retrieves those * without a schema * @param foreignTable the table name that imports the key * @return RJResultSetInterface - each row is a foreign key column description * @see #getImportedKeys */ RJResultSetInterface getCrossReference( String primaryCatalog, String primarySchema, String primaryTable, String foreignCatalog, String foreignSchema, String foreignTable) throws RemoteException, SQLException; /** * Get a description of all the standard SQL types supported by * this database. They are ordered by DATA_TYPE and then by how * closely the data type maps to the corresponding JDBC SQL type. * *

Each type description has the following columns: *

    *
  1. TYPE_NAME String => Type name *
  2. DATA_TYPE short => SQL data type from java.sql.Types *
  3. PRECISION int => maximum precision *
  4. LITERAL_PREFIX String => prefix used to quote a literal * (may be null) *
  5. LITERAL_SUFFIX String => suffix used to quote a literal (may be null) *
  6. CREATE_PARAMS String => parameters used in creating * the type (may be null) *
  7. NULLABLE short => can you use NULL for this type? *
      *
    • typeNoNulls - does not allow NULL values *
    • typeNullable - allows NULL values *
    • typeNullableUnknown - nullability unknown *
    *
  8. CASE_SENSITIVE boolean=> is it case sensitive? *
  9. SEARCHABLE short => can you use "WHERE" based on this type: *
      *
    • typePredNone - No support *
    • typePredChar - Only supported with WHERE .. LIKE *
    • typePredBasic - Supported except for WHERE .. LIKE *
    • typeSearchable - Supported for all WHERE .. *
    *
  10. UNSIGNED_ATTRIBUTE boolean => is it unsigned? *
  11. FIXED_PREC_SCALE boolean => can it be a money value? *
  12. AUTO_INCREMENT boolean => can it be used for an * auto-increment value? *
  13. LOCAL_TYPE_NAME String => localized version of type name * (may be null) *
  14. MINIMUM_SCALE short => minimum scale supported *
  15. MAXIMUM_SCALE short => maximum scale supported *
  16. SQL_DATA_TYPE int => unused *
  17. SQL_DATETIME_SUB int => unused *
  18. NUM_PREC_RADIX int => usually 2 or 10 *
* * @return RJResultSetInterface - each row is a SQL type description */ RJResultSetInterface getTypeInfo() throws RemoteException, SQLException; /** * Get a description of a table's indices and statistics. They are * ordered by NON_UNIQUE, TYPE, INDEX_NAME, and ORDINAL_POSITION. * *

Each index column description has the following columns: *

    *
  1. TABLE_CAT String => table catalog (may be null) *
  2. TABLE_SCHEM String => table schema (may be null) *
  3. TABLE_NAME String => table name *
  4. NON_UNIQUE boolean => Can index values be non-unique? * false when TYPE is tableIndexStatistic *
  5. INDEX_QUALIFIER String => index catalog (may be null); * null when TYPE is tableIndexStatistic *
  6. INDEX_NAME String => index name; null when TYPE is * tableIndexStatistic *
  7. TYPE short => index type: *
      *
    • tableIndexStatistic - this identifies table statistics that are * returned in conjuction with a table's index descriptions *
    • tableIndexClustered - this is a clustered index *
    • tableIndexHashed - this is a hashed index *
    • tableIndexOther - this is some other style of index *
    *
  8. ORDINAL_POSITION short => column sequence number * within index; zero when TYPE is tableIndexStatistic *
  9. COLUMN_NAME String => column name; null when TYPE is * tableIndexStatistic *
  10. ASC_OR_DESC String => column sort sequence, "A" => ascending, * "D" => descending, may be null if sort sequence is not supported; * null when TYPE is tableIndexStatistic *
  11. CARDINALITY int => When TYPE is tableIndexStatistic, then * this is the number of rows in the table; otherwise, it is the * number of unique values in the index. *
  12. PAGES int => When TYPE is tableIndexStatisic then * this is the number of pages used for the table, otherwise it * is the number of pages used for the current index. *
  13. FILTER_CONDITION String => Filter condition, if any. * (may be null) *
* * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schema a schema name pattern; "" retrieves those without a schema * @param table a table name * @param unique when true, return only indices for unique values; * when false, return indices regardless of whether unique or not * @param approximate when true, result is allowed to reflect approximate * or out of data values; when false, results are requested to be * accurate * @return RJResultSetInterface - each row is an index column description */ RJResultSetInterface getIndexInfo(String catalog, String schema, String table, boolean unique, boolean approximate) throws RemoteException, SQLException; //--------------------------JDBC 2.0----------------------------- /** * JDBC 2.0 * * Does the database support the given result set type? * * @param type defined in java.sql.ResultSet * @return true if so; false otherwise * @exception SQLException if a database access error occurs * @see Connection */ boolean supportsResultSetType(int type) throws RemoteException, SQLException; /** * JDBC 2.0 * * Does the database support the concurrency type in combination * with the given result set type? * * @param type defined in java.sql.ResultSet * @param concurrency type defined in java.sql.ResultSet * @return true if so; false otherwise * @exception SQLException if a database access error occurs * @see Connection */ boolean supportsResultSetConcurrency(int type, int concurrency) throws RemoteException, SQLException; /** * JDBC 2.0 * * Indicates whether a result set's own updates are visible. * * @param result set type, i.e. ResultSet.TYPE_XXX * @return true if updates are visible for the result set type; * false otherwise * @exception SQLException if a database access error occurs */ boolean ownUpdatesAreVisible(int type) throws RemoteException, SQLException; /** * JDBC 2.0 * * Indicates whether a result set's own deletes are visible. * * @param result set type, i.e. ResultSet.TYPE_XXX * @return true if deletes are visible for the result set type; * false otherwise * @exception SQLException if a database access error occurs */ boolean ownDeletesAreVisible(int type) throws RemoteException, SQLException; /** * JDBC 2.0 * * Indicates whether a result set's own inserts are visible. * * @param result set type, i.e. ResultSet.TYPE_XXX * @return true if inserts are visible for the result set type; * false otherwise * @exception SQLException if a database access error occurs */ boolean ownInsertsAreVisible(int type) throws RemoteException, SQLException; /** * JDBC 2.0 * * Indicates whether updates made by others are visible. * * @param result set type, i.e. ResultSet.TYPE_XXX * @return true if updates made by others * are visible for the result set type; * false otherwise * @exception SQLException if a database access error occurs */ boolean othersUpdatesAreVisible(int type) throws RemoteException, SQLException; /** * JDBC 2.0 * * Indicates whether deletes made by others are visible. * * @param result set type, i.e. ResultSet.TYPE_XXX * @return true if deletes made by others * are visible for the result set type; * false otherwise * @exception SQLException if a database access error occurs */ boolean othersDeletesAreVisible(int type) throws RemoteException, SQLException; /** * JDBC 2.0 * * Indicates whether inserts made by others are visible. * * @param result set type, i.e. ResultSet.TYPE_XXX * @return true if updates are visible for the result set type * @return true if inserts made by others * are visible for the result set type; * false otherwise * @exception SQLException if a database access error occurs */ boolean othersInsertsAreVisible(int type) throws RemoteException, SQLException; /** * JDBC 2.0 * * Indicates whether or not a visible row update can be detected by * calling the method ResultSet.rowUpdated. * * @param result set type, i.e. ResultSet.TYPE_XXX * @return true if changes are detected by the result set type; * false otherwise * @exception SQLException if a database access error occurs */ boolean updatesAreDetected(int type) throws RemoteException, SQLException; /** * JDBC 2.0 * * Indicates whether or not a visible row delete can be detected by * calling ResultSet.rowDeleted(). If deletesAreDetected() * returns false, then deleted rows are removed from the result set. * * @param result set type, i.e. ResultSet.TYPE_XXX * @return true if changes are detected by the resultset type * @exception SQLException if a database access error occurs */ boolean deletesAreDetected(int type) throws RemoteException, SQLException; /** * JDBC 2.0 * * Indicates whether or not a visible row insert can be detected * by calling ResultSet.rowInserted(). * * @param result set type, i.e. ResultSet.TYPE_XXX * @return true if changes are detected by the resultset type * @exception SQLException if a database access error occurs */ boolean insertsAreDetected(int type) throws RemoteException, SQLException; /** * JDBC 2.0 * * Indicates whether the driver supports batch updates. * @return true if the driver supports batch updates; false otherwise */ boolean supportsBatchUpdates() throws RemoteException, SQLException; /** * JDBC 2.0 * * Gets a description of the user-defined types defined in a particular * schema. Schema-specific UDTs may have type JAVA_OBJECT, STRUCT, * or DISTINCT. * *

Only types matching the catalog, schema, type name and type * criteria are returned. They are ordered by DATA_TYPE, TYPE_SCHEM * and TYPE_NAME. The type name parameter may be a fully-qualified * name. In this case, the catalog and schemaPattern parameters are * ignored. * *

Each type description has the following columns: *

    *
  1. TYPE_CAT String => the type's catalog (may be null) *
  2. TYPE_SCHEM String => type's schema (may be null) *
  3. TYPE_NAME String => type name *
  4. CLASS_NAME String => Java class name *
  5. DATA_TYPE String => type value defined in java.sql.Types. * One of JAVA_OBJECT, STRUCT, or DISTINCT *
  6. REMARKS String => explanatory comment on the type *
* *

Note: If the driver does not support UDTs, an empty * result set is returned. * * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schemaPattern a schema name pattern; "" retrieves those * without a schema * @param typeNamePattern a type name pattern; may be a fully-qualified * name * @param types a list of user-named types to include (JAVA_OBJECT, * STRUCT, or DISTINCT); null returns all types * @return ResultSet - each row is a type description * @exception SQLException if a database access error occurs */ ResultSet getUDTs(String catalog, String schemaPattern, String typeNamePattern, int[] types) throws RemoteException, SQLException; /** * JDBC 2.0 * Retrieves the connection that produced this metadata object. * * @return the connection that produced this metadata object */ Connection getConnection() throws RemoteException, SQLException; }; PK Mi+i!!RJDatabaseMetaDataServer.java /** * RmiJdbc client/server JDBC Driver * (C) GIE Dyade (Groupe BULL / INRIA Research Center) 1997 * * @version 1.0 * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com) * Additional SSL Support * Douglas Hammond(djhammond@sympatico.ca) */ package RmiJdbc; import java.sql.*; import java.rmi.*; import java.rmi.server.UnicastRemoteObject; import java.rmi.server.Unreferenced; /** * This class provides information about the database as a whole. * *

Many of the methods here return lists of information in ResultSets. * You can use the normal ResultSet methods such as getString and getInt * to retrieve the data from these ResultSets. If a given form of * metadata is not available, these methods should throw a java.rmi.RemoteException. * *

Some of these methods take arguments that are String patterns. These * arguments all have names such as fooPattern. Within a pattern String, "%" * means match any substring of 0 or more characters, and "_" means match * any one character. Only metadata entries matching the search pattern * are returned. If a search pattern argument is set to a null ref, it means * that argument's criteria should be dropped from the search. * *

A java.rmi.RemoteException will be thrown if a driver does not support a meta * data method. In the case of methods that return a ResultSet, * either a ResultSet (which may be empty) is returned or a * java.rmi.RemoteException is thrown. */ public class RJDatabaseMetaDataServer extends java.rmi.server.UnicastRemoteObject implements RJDatabaseMetaDataInterface, Unreferenced { java.sql.DatabaseMetaData jdbcMetadata_; public RJDatabaseMetaDataServer(java.sql.DatabaseMetaData d) throws RemoteException, SQLException { super(RJJdbcServer.rmiJdbcListenerPort, RJJdbcServer.rmiClientSocketFactory, RJJdbcServer.rmiServerSocketFactory); jdbcMetadata_ = d; } public void unreferenced() { Runtime.getRuntime().gc(); } //---------------------------------------------------------------------- // First, a variety of minor information about the target database. /** * Can all the procedures returned by getProcedures be called by the * current user? * * @return true if so */ public boolean allProceduresAreCallable() throws RemoteException, SQLException { return jdbcMetadata_.allProceduresAreCallable(); } /** * Can all the tables returned by getTable be SELECTed by the * current user? * * @return true if so */ public boolean allTablesAreSelectable() throws RemoteException, SQLException { return jdbcMetadata_.allTablesAreSelectable(); } /** * What's the url for this database? * * @return the url or null if it can't be generated */ public String getURL() throws RemoteException, SQLException { return jdbcMetadata_.getURL(); } /** * What's our user name as known to the database? * * @return our database user name */ public String getUserName() throws RemoteException, SQLException { return jdbcMetadata_.getUserName(); } /** * Is the database in read-only mode? * * @return true if so */ public boolean isReadOnly() throws RemoteException, SQLException { return jdbcMetadata_.isReadOnly(); } /** * Are NULL values sorted high? * * @return true if so */ public boolean nullsAreSortedHigh() throws RemoteException, SQLException { return jdbcMetadata_.nullsAreSortedHigh(); } /** * Are NULL values sorted low? * * @return true if so */ public boolean nullsAreSortedLow() throws RemoteException, SQLException { return jdbcMetadata_.nullsAreSortedLow(); } /** * Are NULL values sorted at the start regardless of sort order? * * @return true if so */ public boolean nullsAreSortedAtStart() throws RemoteException, SQLException { return jdbcMetadata_.nullsAreSortedAtStart(); } /** * Are NULL values sorted at the end regardless of sort order? * * @return true if so */ public boolean nullsAreSortedAtEnd() throws RemoteException, SQLException { return jdbcMetadata_.nullsAreSortedAtEnd(); } /** * What's the name of this database product? * * @return database product name */ public String getDatabaseProductName() throws RemoteException, SQLException { return jdbcMetadata_.getDatabaseProductName(); } /** * What's the version of this database product? * * @return database version */ public String getDatabaseProductVersion() throws RemoteException, SQLException { return jdbcMetadata_.getDatabaseProductVersion(); } /** * What's the name of this JDBC driver? * * @return JDBC driver name */ public String getDriverName() throws RemoteException, SQLException { return "RmiJdbc!" + jdbcMetadata_.getDriverName(); } /** * What's the version of this JDBC driver? * * @return JDBC driver version */ public String getDriverVersion() throws RemoteException, SQLException { return jdbcMetadata_.getDriverVersion(); } /** * What's this JDBC driver's major version number? * * @return JDBC driver major version */ public int getDriverMajorVersion() { return jdbcMetadata_.getDriverMajorVersion(); } /** * What's this JDBC driver's minor version number? * * @return JDBC driver minor version number */ public int getDriverMinorVersion() { return jdbcMetadata_.getDriverMinorVersion(); } /** * Does the database store tables in a local file? * * @return true if so */ public boolean usesLocalFiles() throws RemoteException, SQLException { return jdbcMetadata_.usesLocalFiles(); } /** * Does the database use a file for each table? * * @return true if the database uses a local file for each table */ public boolean usesLocalFilePerTable() throws RemoteException, SQLException { return jdbcMetadata_.usesLocalFilePerTable(); } /** * Does the database treat mixed case unquoted SQL identifiers as * case sensitive and as a result store them in mixed case? * * A JDBC-Compliant driver will always return false. * * @return true if so */ public boolean supportsMixedCaseIdentifiers() throws RemoteException, SQLException { return jdbcMetadata_.supportsMixedCaseIdentifiers(); } /** * Does the database treat mixed case unquoted SQL identifiers as * case insensitive and store them in upper case? * * @return true if so */ public boolean storesUpperCaseIdentifiers() throws RemoteException, SQLException { return jdbcMetadata_.storesUpperCaseIdentifiers(); } /** * Does the database treat mixed case unquoted SQL identifiers as * case insensitive and store them in lower case? * * @return true if so */ public boolean storesLowerCaseIdentifiers() throws RemoteException, SQLException { return jdbcMetadata_.storesLowerCaseIdentifiers(); } /** * Does the database treat mixed case unquoted SQL identifiers as * case insensitive and store them in mixed case? * * @return true if so */ public boolean storesMixedCaseIdentifiers() throws RemoteException, SQLException { return jdbcMetadata_.storesMixedCaseIdentifiers(); } /** * Does the database treat mixed case quoted SQL identifiers as * case sensitive and as a result store them in mixed case? * * A JDBC-Compliant driver will always return false. * * @return true if so */ public boolean supportsMixedCaseQuotedIdentifiers() throws RemoteException, SQLException { return jdbcMetadata_.supportsMixedCaseQuotedIdentifiers(); } /** * Does the database treat mixed case quoted SQL identifiers as * case insensitive and store them in upper case? * * @return true if so */ public boolean storesUpperCaseQuotedIdentifiers() throws RemoteException, SQLException { return jdbcMetadata_.storesUpperCaseQuotedIdentifiers(); } /** * Does the database treat mixed case quoted SQL identifiers as * case insensitive and store them in lower case? * * @return true if so */ public boolean storesLowerCaseQuotedIdentifiers() throws RemoteException, SQLException { return jdbcMetadata_.storesLowerCaseQuotedIdentifiers(); } /** * Does the database treat mixed case quoted SQL identifiers as * case insensitive and store them in mixed case? * * @return true if so */ public boolean storesMixedCaseQuotedIdentifiers() throws RemoteException, SQLException { return jdbcMetadata_.storesMixedCaseQuotedIdentifiers(); } /** * What's the string used to quote SQL identifiers? * This returns a space " " if identifier quoting isn't supported. * * A JDBC-Compliant driver always uses a double quote character. * * @return the quoting string */ public String getIdentifierQuoteString() throws RemoteException, SQLException { return jdbcMetadata_.getIdentifierQuoteString(); } /** * Get a comma separated list of all a database's SQL keywords * that are NOT also SQL92 keywords. * * @return the list */ public String getSQLKeywords() throws RemoteException, SQLException { return jdbcMetadata_.getSQLKeywords(); } /** * Get a comma separated list of math functions. * * @return the list */ public String getNumericFunctions() throws RemoteException, SQLException { return jdbcMetadata_.getNumericFunctions(); } /** * Get a comma separated list of string functions. * * @return the list */ public String getStringFunctions() throws RemoteException, SQLException { return jdbcMetadata_.getStringFunctions(); } /** * Get a comma separated list of system functions. * * @return the list */ public String getSystemFunctions() throws RemoteException, SQLException { return jdbcMetadata_.getSystemFunctions(); } /** * Get a comma separated list of time and date functions. * * @return the list */ public String getTimeDateFunctions() throws RemoteException, SQLException { return jdbcMetadata_.getTimeDateFunctions(); } /** * This is the string that can be used to escape '_' or '%' in * the string pattern style catalog search parameters. * *

The '_' character represents any single character. *

The '%' character represents any sequence of zero or * more characters. * @return the string used to escape wildcard characters */ public String getSearchStringEscape() throws RemoteException, SQLException { return jdbcMetadata_.getSearchStringEscape(); } /** * Get all the "extra" characters that can be used in unquoted * identifier names (those beyond a-z, A-Z, 0-9 and _). * * @return the string containing the extra characters */ public String getExtraNameCharacters() throws RemoteException, SQLException { return jdbcMetadata_.getExtraNameCharacters(); } //-------------------------------------------------------------------- // Functions describing which features are supported. /** * Is "ALTER TABLE" with add column supported? * * @return true if so */ public boolean supportsAlterTableWithAddColumn() throws RemoteException, SQLException { return jdbcMetadata_.supportsAlterTableWithAddColumn(); } /** * Is "ALTER TABLE" with drop column supported? * * @return true if so */ public boolean supportsAlterTableWithDropColumn() throws RemoteException, SQLException { return jdbcMetadata_.supportsAlterTableWithDropColumn(); } /** * Is column aliasing supported? * *

If so, the SQL AS clause can be used to provide names for * computed columns or to provide alias names for columns as * required. * * A JDBC-Compliant driver always returns true. * * @return true if so */ public boolean supportsColumnAliasing() throws RemoteException, SQLException { return jdbcMetadata_.supportsColumnAliasing(); } /** * Are concatenations between NULL and non-NULL values NULL? * * A JDBC-Compliant driver always returns true. * * @return true if so */ public boolean nullPlusNonNullIsNull() throws RemoteException, SQLException { return jdbcMetadata_.nullPlusNonNullIsNull(); } /** * Is the CONVERT function between SQL types supported? * * @return true if so */ public boolean supportsConvert() throws RemoteException, SQLException { return jdbcMetadata_.supportsConvert(); } /** * Is CONVERT between the given SQL types supported? * * @param fromType the type to convert from * @param toType the type to convert to * @return true if so * @see Types */ public boolean supportsConvert(int fromType, int toType) throws RemoteException, SQLException { return jdbcMetadata_.supportsConvert(); } /** * Are table correlation names supported? * * A JDBC-Compliant driver always returns true. * * @return true if so */ public boolean supportsTableCorrelationNames() throws RemoteException, SQLException { return jdbcMetadata_.supportsTableCorrelationNames(); } /** * If table correlation names are supported, are they restricted * to be different from the names of the tables? * * @return true if so */ public boolean supportsDifferentTableCorrelationNames() throws RemoteException, SQLException { return jdbcMetadata_.supportsDifferentTableCorrelationNames(); } /** * Are expressions in "ORDER BY" lists supported? * * @return true if so */ public boolean supportsExpressionsInOrderBy() throws RemoteException, SQLException { return jdbcMetadata_.supportsExpressionsInOrderBy(); } /** * Can an "ORDER BY" clause use columns not in the SELECT? * * @return true if so */ public boolean supportsOrderByUnrelated() throws RemoteException, SQLException { return jdbcMetadata_.supportsOrderByUnrelated(); } /** * Is some form of "GROUP BY" clause supported? * * @return true if so */ public boolean supportsGroupBy() throws RemoteException, SQLException { return jdbcMetadata_.supportsGroupBy(); } /** * Can a "GROUP BY" clause use columns not in the SELECT? * * @return true if so */ public boolean supportsGroupByUnrelated() throws RemoteException, SQLException { return jdbcMetadata_.supportsGroupByUnrelated(); } /** * Can a "GROUP BY" clause add columns not in the SELECT * provided it specifies all the columns in the SELECT? * * @return true if so */ public boolean supportsGroupByBeyondSelect() throws RemoteException, SQLException { return jdbcMetadata_.supportsGroupByBeyondSelect(); } /** * Is the escape character in "LIKE" clauses supported? * * A JDBC-Compliant driver always returns true. * * @return true if so */ public boolean supportsLikeEscapeClause() throws RemoteException, SQLException { return jdbcMetadata_.supportsLikeEscapeClause(); } /** * Are multiple ResultSets from a single execute supported? * * @return true if so */ public boolean supportsMultipleResultSets() throws RemoteException, SQLException { return jdbcMetadata_.supportsMultipleResultSets(); } /** * Can we have multiple transactions open at once (on different * connections)? * * @return true if so */ public boolean supportsMultipleTransactions() throws RemoteException, SQLException { return jdbcMetadata_.supportsMultipleTransactions(); } /** * Can columns be defined as non-nullable? * * A JDBC-Compliant driver always returns true. * * @return true if so */ public boolean supportsNonNullableColumns() throws RemoteException, SQLException { return jdbcMetadata_.supportsNonNullableColumns(); } /** * Is the ODBC Minimum SQL grammar supported? * * All JDBC-Compliant drivers must return true. * * @return true if so */ public boolean supportsMinimumSQLGrammar() throws RemoteException, SQLException { return jdbcMetadata_.supportsMinimumSQLGrammar(); } /** * Is the ODBC Core SQL grammar supported? * * @return true if so */ public boolean supportsCoreSQLGrammar() throws RemoteException, SQLException { return jdbcMetadata_.supportsCoreSQLGrammar(); } /** * Is the ODBC Extended SQL grammar supported? * * @return true if so */ public boolean supportsExtendedSQLGrammar() throws RemoteException, SQLException { return jdbcMetadata_.supportsExtendedSQLGrammar(); } /** * Is the ANSI92 entry level SQL grammar supported? * * All JDBC-Compliant drivers must return true. * * @return true if so */ public boolean supportsANSI92EntryLevelSQL() throws RemoteException, SQLException { return jdbcMetadata_.supportsANSI92EntryLevelSQL(); } /** * Is the ANSI92 intermediate SQL grammar supported? * * @return true if so */ public boolean supportsANSI92IntermediateSQL() throws RemoteException, SQLException { return jdbcMetadata_.supportsANSI92IntermediateSQL(); } /** * Is the ANSI92 full SQL grammar supported? * * @return true if so */ public boolean supportsANSI92FullSQL() throws RemoteException, SQLException { return jdbcMetadata_.supportsANSI92FullSQL(); } /** * Is the SQL Integrity Enhancement Facility supported? * * @return true if so */ public boolean supportsIntegrityEnhancementFacility() throws RemoteException, SQLException { return jdbcMetadata_.supportsIntegrityEnhancementFacility(); } /** * Is some form of outer join supported? * * @return true if so */ public boolean supportsOuterJoins() throws RemoteException, SQLException { return jdbcMetadata_.supportsOuterJoins(); } /** * Are full nested outer joins supported? * * @return true if so */ public boolean supportsFullOuterJoins() throws RemoteException, SQLException { return jdbcMetadata_.supportsFullOuterJoins(); } /** * Is there limited support for outer joins? (This will be true * if supportFullOuterJoins is true.) * * @return true if so */ public boolean supportsLimitedOuterJoins() throws RemoteException, SQLException { return jdbcMetadata_.supportsLimitedOuterJoins(); } /** * What's the database vendor's preferred term for "schema"? * * @return the vendor term */ public String getSchemaTerm() throws RemoteException, SQLException { return jdbcMetadata_.getSchemaTerm(); } /** * What's the database vendor's preferred term for "procedure"? * * @return the vendor term */ public String getProcedureTerm() throws RemoteException, SQLException { return jdbcMetadata_.getProcedureTerm(); } /** * What's the database vendor's preferred term for "catalog"? * * @return the vendor term */ public String getCatalogTerm() throws RemoteException, SQLException { return jdbcMetadata_.getCatalogTerm(); } /** * Does a catalog appear at the start of a qualified table name? * (Otherwise it appears at the end) * * @return true if it appears at the start */ public boolean isCatalogAtStart() throws RemoteException, SQLException { return jdbcMetadata_.isCatalogAtStart(); } /** * What's the separator between catalog and table name? * * @return the separator string */ public String getCatalogSeparator() throws RemoteException, SQLException { return jdbcMetadata_.getCatalogSeparator(); } /** * Can a schema name be used in a data manipulation statement? * * @return true if so */ public boolean supportsSchemasInDataManipulation() throws RemoteException, SQLException { return jdbcMetadata_.supportsSchemasInDataManipulation(); } /** * Can a schema name be used in a procedure call statement? * * @return true if so */ public boolean supportsSchemasInProcedureCalls() throws RemoteException, SQLException { return jdbcMetadata_.supportsSchemasInProcedureCalls(); } /** * Can a schema name be used in a table definition statement? * * @return true if so */ public boolean supportsSchemasInTableDefinitions() throws RemoteException, SQLException { return jdbcMetadata_.supportsSchemasInTableDefinitions(); } /** * Can a schema name be used in an index definition statement? * * @return true if so */ public boolean supportsSchemasInIndexDefinitions() throws RemoteException, SQLException { return jdbcMetadata_.supportsSchemasInIndexDefinitions(); } /** * Can a schema name be used in a privilege definition statement? * * @return true if so */ public boolean supportsSchemasInPrivilegeDefinitions() throws RemoteException, SQLException { return jdbcMetadata_.supportsSchemasInPrivilegeDefinitions(); } /** * Can a catalog name be used in a data manipulation statement? * * @return true if so */ public boolean supportsCatalogsInDataManipulation() throws RemoteException, SQLException { return jdbcMetadata_.supportsCatalogsInDataManipulation(); } /** * Can a catalog name be used in a procedure call statement? * * @return true if so */ public boolean supportsCatalogsInProcedureCalls() throws RemoteException, SQLException { return jdbcMetadata_.supportsCatalogsInProcedureCalls(); } /** * Can a catalog name be used in a table definition statement? * * @return true if so */ public boolean supportsCatalogsInTableDefinitions() throws RemoteException, SQLException { return jdbcMetadata_.supportsCatalogsInTableDefinitions(); } /** * Can a catalog name be used in an index definition statement? * * @return true if so */ public boolean supportsCatalogsInIndexDefinitions() throws RemoteException, SQLException { return jdbcMetadata_.supportsCatalogsInIndexDefinitions(); } /** * Can a catalog name be used in a privilege definition statement? * * @return true if so */ public boolean supportsCatalogsInPrivilegeDefinitions() throws RemoteException, SQLException { return jdbcMetadata_.supportsCatalogsInPrivilegeDefinitions(); } /** * Is positioned DELETE supported? * * @return true if so */ public boolean supportsPositionedDelete() throws RemoteException, SQLException { return jdbcMetadata_.supportsPositionedDelete(); } /** * Is positioned UPDATE supported? * * @return true if so */ public boolean supportsPositionedUpdate() throws RemoteException, SQLException { return jdbcMetadata_.supportsPositionedUpdate(); } /** * Is SELECT for UPDATE supported? * * @return true if so */ public boolean supportsSelectForUpdate() throws RemoteException, SQLException { return jdbcMetadata_.supportsSelectForUpdate(); } /** * Are stored procedure calls using the stored procedure escape * syntax supported? * * @return true if so */ public boolean supportsStoredProcedures() throws RemoteException, SQLException { return jdbcMetadata_.supportsStoredProcedures(); } /** * Are subqueries in comparison expressions supported? * * A JDBC-Compliant driver always returns true. * * @return true if so */ public boolean supportsSubqueriesInComparisons() throws RemoteException, SQLException { return jdbcMetadata_.supportsSubqueriesInComparisons(); } /** * Are subqueries in 'exists' expressions supported? * * A JDBC-Compliant driver always returns true. * * @return true if so */ public boolean supportsSubqueriesInExists() throws RemoteException, SQLException { return jdbcMetadata_.supportsSubqueriesInExists(); } /** * Are subqueries in 'in' statements supported? * * A JDBC-Compliant driver always returns true. * * @return true if so */ public boolean supportsSubqueriesInIns() throws RemoteException, SQLException { return jdbcMetadata_.supportsSubqueriesInIns(); } /** * Are subqueries in quantified expressions supported? * * A JDBC-Compliant driver always returns true. * * @return true if so */ public boolean supportsSubqueriesInQuantifieds() throws RemoteException, SQLException { return jdbcMetadata_.supportsSubqueriesInQuantifieds(); } /** * Are correlated subqueries supported? * * A JDBC-Compliant driver always returns true. * * @return true if so */ public boolean supportsCorrelatedSubqueries() throws RemoteException, SQLException { return jdbcMetadata_.supportsCorrelatedSubqueries(); } /** * Is SQL UNION supported? * * @return true if so */ public boolean supportsUnion() throws RemoteException, SQLException { return jdbcMetadata_.supportsUnion(); } /** * Is SQL UNION ALL supported? * * @return true if so */ public boolean supportsUnionAll() throws RemoteException, SQLException { return jdbcMetadata_.supportsUnionAll(); } /** * Can cursors remain open across commits? * * @return true if cursors always remain open; * false if they might not remain open */ public boolean supportsOpenCursorsAcrossCommit() throws RemoteException, SQLException { return jdbcMetadata_.supportsOpenCursorsAcrossCommit(); } /** * Can cursors remain open across rollbacks? * * @return true if cursors always remain open; * false if they might not remain open */ public boolean supportsOpenCursorsAcrossRollback() throws RemoteException, SQLException { return jdbcMetadata_.supportsOpenCursorsAcrossRollback(); } /** * Can statements remain open across commits? * * @return true if statements always remain open; * false if they might not remain open */ public boolean supportsOpenStatementsAcrossCommit() throws RemoteException, SQLException { return jdbcMetadata_.supportsOpenStatementsAcrossCommit(); } /** * Can statements remain open across rollbacks? * * @return true if statements always remain open; * false if they might not remain open */ public boolean supportsOpenStatementsAcrossRollback() throws RemoteException, SQLException { return jdbcMetadata_.supportsOpenStatementsAcrossRollback(); } //---------------------------------------------------------------------- // The following group of methods exposes various limitations // based on the target database with the current driver. // Unless otherwise specified, a result of zero means there is no // limit, or the limit is not known. /** * How many hex characters can you have in an inline binary literal? * * @return max literal length */ public int getMaxBinaryLiteralLength() throws RemoteException, SQLException { return jdbcMetadata_.getMaxBinaryLiteralLength(); } /** * What's the max length for a character literal? * * @return max literal length */ public int getMaxCharLiteralLength() throws RemoteException, SQLException { return jdbcMetadata_.getMaxCharLiteralLength(); } /** * What's the limit on column name length? * * @return max literal length */ public int getMaxColumnNameLength() throws RemoteException, SQLException { return jdbcMetadata_.getMaxColumnNameLength(); } /** * What's the maximum number of columns in a "GROUP BY" clause? * * @return max number of columns */ public int getMaxColumnsInGroupBy() throws RemoteException, SQLException { return jdbcMetadata_.getMaxColumnsInGroupBy(); } /** * What's the maximum number of columns allowed in an index? * * @return max columns */ public int getMaxColumnsInIndex() throws RemoteException, SQLException { return jdbcMetadata_.getMaxColumnsInIndex(); } /** * What's the maximum number of columns in an "ORDER BY" clause? * * @return max columns */ public int getMaxColumnsInOrderBy() throws RemoteException, SQLException { return jdbcMetadata_.getMaxColumnsInOrderBy(); } /** * What's the maximum number of columns in a "SELECT" list? * * @return max columns */ public int getMaxColumnsInSelect() throws RemoteException, SQLException { return jdbcMetadata_.getMaxColumnsInSelect(); } /** * What's the maximum number of columns in a table? * * @return max columns */ public int getMaxColumnsInTable() throws RemoteException, SQLException { return jdbcMetadata_.getMaxColumnsInTable(); } /** * How many active connections can we have at a time to this database? * * @return max connections */ public int getMaxConnections() throws RemoteException, SQLException { return jdbcMetadata_.getMaxConnections(); } /** * What's the maximum cursor name length? * * @return max cursor name length in bytes */ public int getMaxCursorNameLength() throws RemoteException, SQLException { return jdbcMetadata_.getMaxCursorNameLength(); } /** * What's the maximum length of an index (in bytes)? * * @return max index length in bytes */ public int getMaxIndexLength() throws RemoteException, SQLException { return jdbcMetadata_.getMaxIndexLength(); } /** * What's the maximum length allowed for a schema name? * * @return max name length in bytes */ public int getMaxSchemaNameLength() throws RemoteException, SQLException { return jdbcMetadata_.getMaxSchemaNameLength(); } /** * What's the maximum length of a procedure name? * * @return max name length in bytes */ public int getMaxProcedureNameLength() throws RemoteException, SQLException { return jdbcMetadata_.getMaxProcedureNameLength(); } /** * What's the maximum length of a catalog name? * * @return max name length in bytes */ public int getMaxCatalogNameLength() throws RemoteException, SQLException { return jdbcMetadata_.getMaxCatalogNameLength(); } /** * What's the maximum length of a single row? * * @return max row size in bytes */ public int getMaxRowSize() throws RemoteException, SQLException { return jdbcMetadata_.getMaxRowSize(); } /** * Did getMaxRowSize() include LONGVARCHAR and LONGVARBINARY * blobs? * * @return true if so */ public boolean doesMaxRowSizeIncludeBlobs() throws RemoteException, SQLException { return jdbcMetadata_.doesMaxRowSizeIncludeBlobs(); } /** * What's the maximum length of a SQL statement? * * @return max length in bytes */ public int getMaxStatementLength() throws RemoteException, SQLException { return jdbcMetadata_.getMaxStatementLength(); } /** * How many active statements can we have open at one time to this * database? * * @return the maximum */ public int getMaxStatements() throws RemoteException, SQLException { return jdbcMetadata_.getMaxStatements(); } /** * What's the maximum length of a table name? * * @return max name length in bytes */ public int getMaxTableNameLength() throws RemoteException, SQLException { return jdbcMetadata_.getMaxTableNameLength(); } /** * What's the maximum number of tables in a SELECT? * * @return the maximum */ public int getMaxTablesInSelect() throws RemoteException, SQLException { return jdbcMetadata_.getMaxTablesInSelect(); } /** * What's the maximum length of a user name? * * @return max name length in bytes */ public int getMaxUserNameLength() throws RemoteException, SQLException { return jdbcMetadata_.getMaxUserNameLength(); } //---------------------------------------------------------------------- /** * What's the database's default transaction isolation level? The * values are defined in java.sql.Connection. * * @return the default isolation level * @see Connection */ public int getDefaultTransactionIsolation() throws RemoteException, SQLException { return jdbcMetadata_.getDefaultTransactionIsolation(); } /** * Are transactions supported? If not, commit is a noop and the * isolation level is TRANSACTION_NONE. * * @return true if transactions are supported */ public boolean supportsTransactions() throws RemoteException, SQLException { return jdbcMetadata_.supportsTransactions(); } /** * Does the database support the given transaction isolation level? * * @param level the values are defined in java.sql.Connection * @return true if so * @see Connection */ public boolean supportsTransactionIsolationLevel(int level) throws RemoteException, SQLException { return jdbcMetadata_.supportsTransactionIsolationLevel(level); } /** * Are both data definition and data manipulation statements * within a transaction supported? * * @return true if so */ public boolean supportsDataDefinitionAndDataManipulationTransactions() throws RemoteException, SQLException { return jdbcMetadata_.supportsDataDefinitionAndDataManipulationTransactions(); } /** * Are only data manipulation statements within a transaction * supported? * * @return true if so */ public boolean supportsDataManipulationTransactionsOnly() throws RemoteException, SQLException { return jdbcMetadata_.supportsDataManipulationTransactionsOnly(); } /** * Does a data definition statement within a transaction force the * transaction to commit? * * @return true if so */ public boolean dataDefinitionCausesTransactionCommit() throws RemoteException, SQLException { return jdbcMetadata_.dataDefinitionCausesTransactionCommit(); } /** * Is a data definition statement within a transaction ignored? * * @return true if so */ public boolean dataDefinitionIgnoredInTransactions() throws RemoteException, SQLException { return jdbcMetadata_.dataDefinitionIgnoredInTransactions(); } /** * Get a description of stored procedures available in a * catalog. * *

Only procedure descriptions matching the schema and * procedure name criteria are returned. They are ordered by * PROCEDURE_SCHEM, and PROCEDURE_NAME. * *

Each procedure description has the the following columns: *

    *
  1. PROCEDURE_CAT String => procedure catalog (may be null) *
  2. PROCEDURE_SCHEM String => procedure schema (may be null) *
  3. PROCEDURE_NAME String => procedure name *
  4. reserved for future use *
  5. reserved for future use *
  6. reserved for future use *
  7. REMARKS String => explanatory comment on the procedure *
  8. PROCEDURE_TYPE short => kind of procedure: *
      *
    • procedureResultUnknown - May return a result *
    • procedureNoResult - Does not return a result *
    • procedureReturnsResult - Returns a result *
    *
* * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schemaPattern a schema name pattern; "" retrieves those * without a schema * @param procedureNamePattern a procedure name pattern * @return ResultSet - each row is a procedure description * @see #getSearchStringEscape */ public RJResultSetInterface getProcedures(String catalog, String schemaPattern, String procedureNamePattern) throws RemoteException, SQLException { return new RJResultSetServer(jdbcMetadata_.getProcedures(catalog, schemaPattern, procedureNamePattern)); } /** * Get a description of a catalog's stored procedure parameters * and result columns. * *

Only descriptions matching the schema, procedure and * parameter name criteria are returned. They are ordered by * PROCEDURE_SCHEM and PROCEDURE_NAME. Within this, the return value, * if any, is first. Next are the parameter descriptions in call * order. The column descriptions follow in column number order. * *

Each row in the ResultSet is a parameter description or * column description with the following fields: *

    *
  1. PROCEDURE_CAT String => procedure catalog (may be null) *
  2. PROCEDURE_SCHEM String => procedure schema (may be null) *
  3. PROCEDURE_NAME String => procedure name *
  4. COLUMN_NAME String => column/parameter name *
  5. COLUMN_TYPE Short => kind of column/parameter: *
      *
    • procedureColumnUnknown - nobody knows *
    • procedureColumnIn - IN parameter *
    • procedureColumnInOut - INOUT parameter *
    • procedureColumnOut - OUT parameter *
    • procedureColumnReturn - procedure return value *
    • procedureColumnResult - result column in ResultSet *
    *
  6. DATA_TYPE short => SQL type from java.sql.Types *
  7. TYPE_NAME String => SQL type name *
  8. PRECISION int => precision *
  9. LENGTH int => length in bytes of data *
  10. SCALE short => scale *
  11. RADIX short => radix *
  12. NULLABLE short => can it contain NULL? *
      *
    • procedureNoNulls - does not allow NULL values *
    • procedureNullable - allows NULL values *
    • procedureNullableUnknown - nullability unknown *
    *
  13. REMARKS String => comment describing parameter/column *
* *

Note: Some databases may not return the column * descriptions for a procedure. Additional columns beyond * REMARKS can be defined by the database. * * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schemaPattern a schema name pattern; "" retrieves those * without a schema * @param procedureNamePattern a procedure name pattern * @param columnNamePattern a column name pattern * @return ResultSet - each row is a stored procedure parameter or * column description * @see #getSearchStringEscape */ public RJResultSetInterface getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern) throws RemoteException, SQLException { return new RJResultSetServer(jdbcMetadata_.getProcedureColumns(catalog, schemaPattern, procedureNamePattern, columnNamePattern)); } /** * Get a description of tables available in a catalog. * *

Only table descriptions matching the catalog, schema, table * name and type criteria are returned. They are ordered by * TABLE_TYPE, TABLE_SCHEM and TABLE_NAME. * *

Each table description has the following columns: *

    *
  1. TABLE_CAT String => table catalog (may be null) *
  2. TABLE_SCHEM String => table schema (may be null) *
  3. TABLE_NAME String => table name *
  4. TABLE_TYPE String => table type. Typical types are "TABLE", * "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", * "LOCAL TEMPORARY", "ALIAS", "SYNONYM". *
  5. REMARKS String => explanatory comment on the table *
* *

Note: Some databases may not return information for * all tables. * * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schemaPattern a schema name pattern; "" retrieves those * without a schema * @param tableNamePattern a table name pattern * @param types a list of table types to include; null returns all types * @return ResultSet - each row is a table description * @see #getSearchStringEscape */ public RJResultSetInterface getTables(String catalog, String schemaPattern, String tableNamePattern, String types[]) throws RemoteException, SQLException { return new RJResultSetServer(jdbcMetadata_.getTables(catalog, schemaPattern, tableNamePattern, types)); } /** * Get the schema names available in this database. The results * are ordered by schema name. * *

The schema column is: *

    *
  1. TABLE_SCHEM String => schema name *
* * @return ResultSet - each row has a single String column that is a * schema name */ public RJResultSetInterface getSchemas() throws RemoteException, SQLException { return new RJResultSetServer(jdbcMetadata_.getSchemas()); } /** * Get the catalog names available in this database. The results * are ordered by catalog name. * *

The catalog column is: *

    *
  1. TABLE_CAT String => catalog name *
* * @return ResultSet - each row has a single String column that is a * catalog name */ public RJResultSetInterface getCatalogs() throws RemoteException, SQLException { return new RJResultSetServer(jdbcMetadata_.getCatalogs()); } /** * Get the table types available in this database. The results * are ordered by table type. * *

The table type is: *

    *
  1. TABLE_TYPE String => table type. Typical types are "TABLE", * "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY", * "LOCAL TEMPORARY", "ALIAS", "SYNONYM". *
* * @return ResultSet - each row has a single String column that is a * table type */ public RJResultSetInterface getTableTypes() throws RemoteException, SQLException { return new RJResultSetServer(jdbcMetadata_.getTableTypes()); } /** * Get a description of table columns available in a catalog. * *

Only column descriptions matching the catalog, schema, table * and column name criteria are returned. They are ordered by * TABLE_SCHEM, TABLE_NAME and ORDINAL_POSITION. * *

Each column description has the following columns: *

    *
  1. TABLE_CAT String => table catalog (may be null) *
  2. TABLE_SCHEM String => table schema (may be null) *
  3. TABLE_NAME String => table name *
  4. COLUMN_NAME String => column name *
  5. DATA_TYPE short => SQL type from java.sql.Types *
  6. TYPE_NAME String => Data source dependent type name *
  7. COLUMN_SIZE int => column size. For char or date * types this is the maximum number of characters, for numeric or * decimal types this is precision. *
  8. BUFFER_LENGTH is not used. *
  9. DECIMAL_DIGITS int => the number of fractional digits *
  10. NUM_PREC_RADIX int => Radix (typically either 10 or 2) *
  11. NULLABLE int => is NULL allowed? *
      *
    • columnNoNulls - might not allow NULL values *
    • columnNullable - definitely allows NULL values *
    • columnNullableUnknown - nullability unknown *
    *
  12. REMARKS String => comment describing column (may be null) *
  13. COLUMN_DEF String => default value (may be null) *
  14. SQL_DATA_TYPE int => unused *
  15. SQL_DATETIME_SUB int => unused *
  16. CHAR_OCTET_LENGTH int => for char types the * maximum number of bytes in the column *
  17. ORDINAL_POSITION int => index of column in table * (starting at 1) *
  18. IS_NULLABLE String => "NO" means column definitely * does not allow NULL values; "YES" means the column might * allow NULL values. An empty string means nobody knows. *
* * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schemaPattern a schema name pattern; "" retrieves those * without a schema * @param tableNamePattern a table name pattern * @param columnNamePattern a column name pattern * @return ResultSet - each row is a column description * @see #getSearchStringEscape */ public RJResultSetInterface getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) throws RemoteException, SQLException { return new RJResultSetServer(jdbcMetadata_.getColumns(catalog, schemaPattern, tableNamePattern, columnNamePattern)); } /** * Get a description of the access rights for a table's columns. * *

Only privileges matching the column name criteria are * returned. They are ordered by COLUMN_NAME and PRIVILEGE. * *

Each privilige description has the following columns: *

    *
  1. TABLE_CAT String => table catalog (may be null) *
  2. TABLE_SCHEM String => table schema (may be null) *
  3. TABLE_NAME String => table name *
  4. COLUMN_NAME String => column name *
  5. GRANTOR => grantor of access (may be null) *
  6. GRANTEE String => grantee of access *
  7. PRIVILEGE String => name of access (SELECT, * INSERT, UPDATE, REFRENCES, ...) *
  8. IS_GRANTABLE String => "YES" if grantee is permitted * to grant to others; "NO" if not; null if unknown *
* * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schema a schema name; "" retrieves those without a schema * @param table a table name * @param columnNamePattern a column name pattern * @return ResultSet - each row is a column privilege description * @see #getSearchStringEscape */ public RJResultSetInterface getColumnPrivileges(String catalog, String schema, String table, String columnNamePattern) throws RemoteException, SQLException { return new RJResultSetServer(jdbcMetadata_.getColumnPrivileges(catalog, schema, table, columnNamePattern)); } /** * Get a description of the access rights for each table available * in a catalog. Note that a table privilege applies to one or * more columns in the table. It would be wrong to assume that * this priviledge applies to all columns (this may be true for * some systems but is not true for all.) * *

Only privileges matching the schema and table name * criteria are returned. They are ordered by TABLE_SCHEM, * TABLE_NAME, and PRIVILEGE. * *

Each privilige description has the following columns: *

    *
  1. TABLE_CAT String => table catalog (may be null) *
  2. TABLE_SCHEM String => table schema (may be null) *
  3. TABLE_NAME String => table name *
  4. GRANTOR => grantor of access (may be null) *
  5. GRANTEE String => grantee of access *
  6. PRIVILEGE String => name of access (SELECT, * INSERT, UPDATE, REFRENCES, ...) *
  7. IS_GRANTABLE String => "YES" if grantee is permitted * to grant to others; "NO" if not; null if unknown *
* * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schemaPattern a schema name pattern; "" retrieves those * without a schema * @param tableNamePattern a table name pattern * @return ResultSet - each row is a table privilege description * @see #getSearchStringEscape */ public RJResultSetInterface getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern) throws RemoteException, SQLException { return new RJResultSetServer(jdbcMetadata_.getTablePrivileges(catalog, schemaPattern, tableNamePattern)); } /** * Get a description of a table's optimal set of columns that * uniquely identifies a row. They are ordered by SCOPE. * *

Each column description has the following columns: *

    *
  1. SCOPE short => actual scope of result *
      *
    • bestRowTemporary - very temporary, while using row *
    • bestRowTransaction - valid for remainder of current transaction *
    • bestRowSession - valid for remainder of current session *
    *
  2. COLUMN_NAME String => column name *
  3. DATA_TYPE short => SQL data type from java.sql.Types *
  4. TYPE_NAME String => Data source dependent type name *
  5. COLUMN_SIZE int => precision *
  6. BUFFER_LENGTH int => not used *
  7. DECIMAL_DIGITS short => scale *
  8. PSEUDO_COLUMN short => is this a pseudo column * like an Oracle ROWID *
      *
    • bestRowUnknown - may or may not be pseudo column *
    • bestRowNotPseudo - is NOT a pseudo column *
    • bestRowPseudo - is a pseudo column *
    *
* * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schema a schema name; "" retrieves those without a schema * @param table a table name * @param scope the scope of interest; use same values as SCOPE * @param nullable include columns that are nullable? * @return ResultSet - each row is a column description */ public RJResultSetInterface getBestRowIdentifier(String catalog, String schema, String table, int scope, boolean nullable) throws RemoteException, SQLException { return new RJResultSetServer(jdbcMetadata_.getBestRowIdentifier(catalog, schema, table, scope, nullable)); } /** * Get a description of a table's columns that are automatically * updated when any value in a row is updated. They are * unordered. * *

Each column description has the following columns: *

    *
  1. SCOPE short => is not used *
  2. COLUMN_NAME String => column name *
  3. DATA_TYPE short => SQL data type from java.sql.Types *
  4. TYPE_NAME String => Data source dependent type name *
  5. COLUMN_SIZE int => precision *
  6. BUFFER_LENGTH int => length of column value in bytes *
  7. DECIMAL_DIGITS short => scale *
  8. PSEUDO_COLUMN short => is this a pseudo column * like an Oracle ROWID *
      *
    • versionColumnUnknown - may or may not be pseudo column *
    • versionColumnNotPseudo - is NOT a pseudo column *
    • versionColumnPseudo - is a pseudo column *
    *
* * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schema a schema name; "" retrieves those without a schema * @param table a table name * @return ResultSet - each row is a column description */ public RJResultSetInterface getVersionColumns(String catalog, String schema, String table) throws RemoteException, SQLException { return new RJResultSetServer(jdbcMetadata_.getVersionColumns(catalog, schema, table)); } /** * Get a description of a table's primary key columns. They * are ordered by COLUMN_NAME. * *

Each primary key column description has the following columns: *

    *
  1. TABLE_CAT String => table catalog (may be null) *
  2. TABLE_SCHEM String => table schema (may be null) *
  3. TABLE_NAME String => table name *
  4. COLUMN_NAME String => column name *
  5. KEY_SEQ short => sequence number within primary key *
  6. PK_NAME String => primary key name (may be null) *
* * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schema a schema name pattern; "" retrieves those * without a schema * @param table a table name * @return ResultSet - each row is a primary key column description */ public RJResultSetInterface getPrimaryKeys(String catalog, String schema, String table) throws RemoteException, SQLException { return new RJResultSetServer(jdbcMetadata_.getPrimaryKeys(catalog, schema, table)); } /** * Get a description of the primary key columns that are * referenced by a table's foreign key columns (the primary keys * imported by a table). They are ordered by PKTABLE_CAT, * PKTABLE_SCHEM, PKTABLE_NAME, and KEY_SEQ. * *

Each primary key column description has the following columns: *

    *
  1. PKTABLE_CAT String => primary key table catalog * being imported (may be null) *
  2. PKTABLE_SCHEM String => primary key table schema * being imported (may be null) *
  3. PKTABLE_NAME String => primary key table name * being imported *
  4. PKCOLUMN_NAME String => primary key column name * being imported *
  5. FKTABLE_CAT String => foreign key table catalog (may be null) *
  6. FKTABLE_SCHEM String => foreign key table schema (may be null) *
  7. FKTABLE_NAME String => foreign key table name *
  8. FKCOLUMN_NAME String => foreign key column name *
  9. KEY_SEQ short => sequence number within foreign key *
  10. UPDATE_RULE short => What happens to * foreign key when primary is updated: *
      *
    • importedNoAction - do not allow update of primary * key if it has been imported *
    • importedKeyCascade - change imported key to agree * with primary key update *
    • importedKeySetNull - change imported key to NULL if * its primary key has been updated *
    • importedKeySetDefault - change imported key to default values * if its primary key has been updated *
    • importedKeyRestrict - same as importedKeyNoAction * (for ODBC 2.x compatibility) *
    *
  11. DELETE_RULE short => What happens to * the foreign key when primary is deleted. *
      *
    • importedKeyNoAction - do not allow delete of primary * key if it has been imported *
    • importedKeyCascade - delete rows that import a deleted key *
    • importedKeySetNull - change imported key to NULL if * its primary key has been deleted *
    • importedKeyRestrict - same as importedKeyNoAction * (for ODBC 2.x compatibility) *
    • importedKeySetDefault - change imported key to default if * its primary key has been deleted *
    *
  12. FK_NAME String => foreign key name (may be null) *
  13. PK_NAME String => primary key name (may be null) *
  14. DEFERRABILITY short => can the evaluation of foreign key * constraints be deferred until commit *
      *
    • importedKeyInitiallyDeferred - see SQL92 for definition *
    • importedKeyInitiallyImmediate - see SQL92 for definition *
    • importedKeyNotDeferrable - see SQL92 for definition *
    *
* * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schema a schema name pattern; "" retrieves those * without a schema * @param table a table name * @return ResultSet - each row is a primary key column description * @see #getExportedKeys */ public RJResultSetInterface getImportedKeys(String catalog, String schema, String table) throws RemoteException, SQLException { return new RJResultSetServer(jdbcMetadata_.getImportedKeys(catalog, schema, table)); } /** * Get a description of the foreign key columns that reference a * table's primary key columns (the foreign keys exported by a * table). They are ordered by FKTABLE_CAT, FKTABLE_SCHEM, * FKTABLE_NAME, and KEY_SEQ. * *

Each foreign key column description has the following columns: *

    *
  1. PKTABLE_CAT String => primary key table catalog (may be null) *
  2. PKTABLE_SCHEM String => primary key table schema (may be null) *
  3. PKTABLE_NAME String => primary key table name *
  4. PKCOLUMN_NAME String => primary key column name *
  5. FKTABLE_CAT String => foreign key table catalog (may be null) * being exported (may be null) *
  6. FKTABLE_SCHEM String => foreign key table schema (may be null) * being exported (may be null) *
  7. FKTABLE_NAME String => foreign key table name * being exported *
  8. FKCOLUMN_NAME String => foreign key column name * being exported *
  9. KEY_SEQ short => sequence number within foreign key *
  10. UPDATE_RULE short => What happens to * foreign key when primary is updated: *
      *
    • importedNoAction - do not allow update of primary * key if it has been imported *
    • importedKeyCascade - change imported key to agree * with primary key update *
    • importedKeySetNull - change imported key to NULL if * its primary key has been updated *
    • importedKeySetDefault - change imported key to default values * if its primary key has been updated *
    • importedKeyRestrict - same as importedKeyNoAction * (for ODBC 2.x compatibility) *
    *
  11. DELETE_RULE short => What happens to * the foreign key when primary is deleted. *
      *
    • importedKeyNoAction - do not allow delete of primary * key if it has been imported *
    • importedKeyCascade - delete rows that import a deleted key *
    • importedKeySetNull - change imported key to NULL if * its primary key has been deleted *
    • importedKeyRestrict - same as importedKeyNoAction * (for ODBC 2.x compatibility) *
    • importedKeySetDefault - change imported key to default if * its primary key has been deleted *
    *
  12. FK_NAME String => foreign key name (may be null) *
  13. PK_NAME String => primary key name (may be null) *
  14. DEFERRABILITY short => can the evaluation of foreign key * constraints be deferred until commit *
      *
    • importedKeyInitiallyDeferred - see SQL92 for definition *
    • importedKeyInitiallyImmediate - see SQL92 for definition *
    • importedKeyNotDeferrable - see SQL92 for definition *
    *
* * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schema a schema name pattern; "" retrieves those * without a schema * @param table a table name * @return ResultSet - each row is a foreign key column description * @see #getImportedKeys */ public RJResultSetInterface getExportedKeys(String catalog, String schema, String table) throws RemoteException, SQLException { return new RJResultSetServer(jdbcMetadata_.getExportedKeys(catalog, schema, table)); } /** * Get a description of the foreign key columns in the foreign key * table that reference the primary key columns of the primary key * table (describe how one table imports another's key.) This * should normally return a single foreign key/primary key pair * (most tables only import a foreign key from a table once.) They * are ordered by FKTABLE_CAT, FKTABLE_SCHEM, FKTABLE_NAME, and * KEY_SEQ. * *

Each foreign key column description has the following columns: *

    *
  1. PKTABLE_CAT String => primary key table catalog (may be null) *
  2. PKTABLE_SCHEM String => primary key table schema (may be null) *
  3. PKTABLE_NAME String => primary key table name *
  4. PKCOLUMN_NAME String => primary key column name *
  5. FKTABLE_CAT String => foreign key table catalog (may be null) * being exported (may be null) *
  6. FKTABLE_SCHEM String => foreign key table schema (may be null) * being exported (may be null) *
  7. FKTABLE_NAME String => foreign key table name * being exported *
  8. FKCOLUMN_NAME String => foreign key column name * being exported *
  9. KEY_SEQ short => sequence number within foreign key *
  10. UPDATE_RULE short => What happens to * foreign key when primary is updated: *
      *
    • importedNoAction - do not allow update of primary * key if it has been imported *
    • importedKeyCascade - change imported key to agree * with primary key update *
    • importedKeySetNull - change imported key to NULL if * its primary key has been updated *
    • importedKeySetDefault - change imported key to default values * if its primary key has been updated *
    • importedKeyRestrict - same as importedKeyNoAction * (for ODBC 2.x compatibility) *
    *
  11. DELETE_RULE short => What happens to * the foreign key when primary is deleted. *
      *
    • importedKeyNoAction - do not allow delete of primary * key if it has been imported *
    • importedKeyCascade - delete rows that import a deleted key *
    • importedKeySetNull - change imported key to NULL if * its primary key has been deleted *
    • importedKeyRestrict - same as importedKeyNoAction * (for ODBC 2.x compatibility) *
    • importedKeySetDefault - change imported key to default if * its primary key has been deleted *
    *
  12. FK_NAME String => foreign key name (may be null) *
  13. PK_NAME String => primary key name (may be null) *
  14. DEFERRABILITY short => can the evaluation of foreign key * constraints be deferred until commit *
      *
    • importedKeyInitiallyDeferred - see SQL92 for definition *
    • importedKeyInitiallyImmediate - see SQL92 for definition *
    • importedKeyNotDeferrable - see SQL92 for definition *
    *
* * @param primaryCatalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param primarySchema a schema name pattern; "" retrieves those * without a schema * @param primaryTable the table name that exports the key * @param foreignCatalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param foreignSchema a schema name pattern; "" retrieves those * without a schema * @param foreignTable the table name that imports the key * @return ResultSet - each row is a foreign key column description * @see #getImportedKeys */ public RJResultSetInterface getCrossReference( String primaryCatalog, String primarySchema, String primaryTable, String foreignCatalog, String foreignSchema, String foreignTable) throws RemoteException, SQLException { return new RJResultSetServer(jdbcMetadata_.getCrossReference( primaryCatalog, primarySchema, primaryTable, foreignCatalog, foreignSchema, foreignTable)); } /** * Get a description of all the standard SQL types supported by * this database. They are ordered by DATA_TYPE and then by how * closely the data type maps to the corresponding JDBC SQL type. * *

Each type description has the following columns: *

    *
  1. TYPE_NAME String => Type name *
  2. DATA_TYPE short => SQL data type from java.sql.Types *
  3. PRECISION int => maximum precision *
  4. LITERAL_PREFIX String => prefix used to quote a literal * (may be null) *
  5. LITERAL_SUFFIX String => suffix used to quote a literal (may be null) *
  6. CREATE_PARAMS String => parameters used in creating * the type (may be null) *
  7. NULLABLE short => can you use NULL for this type? *
      *
    • typeNoNulls - does not allow NULL values *
    • typeNullable - allows NULL values *
    • typeNullableUnknown - nullability unknown *
    *
  8. CASE_SENSITIVE boolean=> is it case sensitive? *
  9. SEARCHABLE short => can you use "WHERE" based on this type: *
      *
    • typePredNone - No support *
    • typePredChar - Only supported with WHERE .. LIKE *
    • typePredBasic - Supported except for WHERE .. LIKE *
    • typeSearchable - Supported for all WHERE .. *
    *
  10. UNSIGNED_ATTRIBUTE boolean => is it unsigned? *
  11. FIXED_PREC_SCALE boolean => can it be a money value? *
  12. AUTO_INCREMENT boolean => can it be used for an * auto-increment value? *
  13. LOCAL_TYPE_NAME String => localized version of type name * (may be null) *
  14. MINIMUM_SCALE short => minimum scale supported *
  15. MAXIMUM_SCALE short => maximum scale supported *
  16. SQL_DATA_TYPE int => unused *
  17. SQL_DATETIME_SUB int => unused *
  18. NUM_PREC_RADIX int => usually 2 or 10 *
* * @return ResultSet - each row is a SQL type description */ public RJResultSetInterface getTypeInfo() throws RemoteException, SQLException { return new RJResultSetServer(jdbcMetadata_.getTypeInfo()); } /** * Get a description of a table's indices and statistics. They are * ordered by NON_UNIQUE, TYPE, INDEX_NAME, and ORDINAL_POSITION. * *

Each index column description has the following columns: *

    *
  1. TABLE_CAT String => table catalog (may be null) *
  2. TABLE_SCHEM String => table schema (may be null) *
  3. TABLE_NAME String => table name *
  4. NON_UNIQUE boolean => Can index values be non-unique? * false when TYPE is tableIndexStatistic *
  5. INDEX_QUALIFIER String => index catalog (may be null); * null when TYPE is tableIndexStatistic *
  6. INDEX_NAME String => index name; null when TYPE is * tableIndexStatistic *
  7. TYPE short => index type: *
      *
    • tableIndexStatistic - this identifies table statistics that are * returned in conjuction with a table's index descriptions *
    • tableIndexClustered - this is a clustered index *
    • tableIndexHashed - this is a hashed index *
    • tableIndexOther - this is some other style of index *
    *
  8. ORDINAL_POSITION short => column sequence number * within index; zero when TYPE is tableIndexStatistic *
  9. COLUMN_NAME String => column name; null when TYPE is * tableIndexStatistic *
  10. ASC_OR_DESC String => column sort sequence, "A" => ascending, * "D" => descending, may be null if sort sequence is not supported; * null when TYPE is tableIndexStatistic *
  11. CARDINALITY int => When TYPE is tableIndexStatistic, then * this is the number of rows in the table; otherwise, it is the * number of unique values in the index. *
  12. PAGES int => When TYPE is tableIndexStatisic then * this is the number of pages used for the table, otherwise it * is the number of pages used for the current index. *
  13. FILTER_CONDITION String => Filter condition, if any. * (may be null) *
* * @param catalog a catalog name; "" retrieves those without a * catalog; null means drop catalog name from the selection criteria * @param schema a schema name pattern; "" retrieves those without a schema * @param table a table name * @param unique when true, return only indices for unique values; * when false, return indices regardless of whether unique or not * @param approximate when true, result is allowed to reflect approximate * or out of data values; when false, results are requested to be * accurate * @return ResultSet - each row is an index column description */ public RJResultSetInterface getIndexInfo(String catalog, String schema, String table, boolean unique, boolean approximate) throws RemoteException, SQLException { return new RJResultSetServer(jdbcMetadata_.getIndexInfo(catalog, schema, table, unique, approximate)); } // JDBC 2. Added Aug 2000, Peter Hearty (peter.hearty@lutris.com). public boolean updatesAreDetected(int type) throws RemoteException, SQLException { return jdbcMetadata_.updatesAreDetected(type); } public boolean supportsResultSetType(int type) throws RemoteException, SQLException { return jdbcMetadata_.supportsResultSetType(type); } public boolean supportsResultSetConcurrency(int type, int concurrency) throws RemoteException, SQLException { return jdbcMetadata_.supportsResultSetConcurrency(type,concurrency); } public boolean ownUpdatesAreVisible(int type) throws RemoteException, SQLException { return jdbcMetadata_.ownUpdatesAreVisible(type); } public boolean ownInsertsAreVisible(int type) throws RemoteException, SQLException { return jdbcMetadata_.ownInsertsAreVisible(type); } public boolean ownDeletesAreVisible(int type) throws RemoteException, SQLException { return jdbcMetadata_.ownDeletesAreVisible(type); } public boolean othersUpdatesAreVisible(int type) throws RemoteException, SQLException { return jdbcMetadata_.othersUpdatesAreVisible(type); } public boolean othersInsertsAreVisible(int type) throws RemoteException, SQLException { return jdbcMetadata_.othersInsertsAreVisible(type); } public boolean othersDeletesAreVisible(int type) throws RemoteException, SQLException { return jdbcMetadata_.othersDeletesAreVisible(type); } public boolean insertsAreDetected(int type) throws RemoteException, SQLException { return jdbcMetadata_.insertsAreDetected(type); } public ResultSet getUDTs(String catalog, String schemaPattern, String typeNamePattern, int[] types) throws RemoteException, SQLException { return jdbcMetadata_.getUDTs(catalog,schemaPattern,typeNamePattern,types); } public boolean supportsBatchUpdates() throws RemoteException, SQLException { return jdbcMetadata_.supportsBatchUpdates(); } public Connection getConnection() throws RemoteException, SQLException { return jdbcMetadata_.getConnection(); } public boolean deletesAreDetected(int type) throws RemoteException, SQLException { return jdbcMetadata_.deletesAreDetected(type); } }; PK 2Oi+ RJDriver.java /** * RmiJdbc client/server JDBC Driver * (C) GIE Dyade (Groupe BULL / INRIA Research Center) 1997 * * @version 1.0 * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com) */ package RmiJdbc; import java.sql.*; import java.rmi.RemoteException; import java.rmi.registry.*; import java.net.InetAddress; import java.util.*; /** *

The Java SQL framework allows for multiple database drivers. * *

Each driver should supply a class that implements * the Driver interface. * *

The DriverManager will try to load as many drivers as it can * find and then for any given connection request, it will ask each * driver in turn to try to connect to the target URL. * *

It is strongly recommended that each Driver class should be * small and standalone so that the Driver class can be loaded and * queried without bringing in vast quantities of supporting code. * *

When a Driver class is loaded, it should create an instance of * itself and register it with the DriverManager. This means that a * user can load and register a driver by doing * Class.forName("foo.bah.Driver"). * * @see DriverManager * @see Connection */ public class RJDriver implements java.sql.Driver, java.io.Serializable { static { try { // register the driver with the JDBC DriverManager DriverManager.registerDriver(new RmiJdbc.RJDriver()); } catch (Exception e) { e.printStackTrace(); } } public RJDriver() throws Exception {} private static int RMI_REGISTRY = 0; private static int RMI_ADDRESS = 1; private static int JDBC_URL = 2; private String[] splitURL(String url) { /* The url has the format: "jdbc:rmi:///" First, get a reference to the RJDriverServer running on computer . Then, connect using the server's registered jdbc driver */ String serverHostName, jdbcUrl; if(url.substring(9,11).equals("//")) { serverHostName = url.substring(9, url.indexOf("/",11)); jdbcUrl = url.substring(url.indexOf("/",11)+1); } else { try { serverHostName = "//" + InetAddress.getLocalHost().getHostName(); } catch(Exception e) { System.err.println( "WARNING: can\'t retrieve local host name, //localhost will be used !" + " Exception follows:"); e.printStackTrace(); serverHostName = "//localhost"; } jdbcUrl = url.substring(9); // Check if there was something wierd in the RMI URL part: // If so, skip it! if(! jdbcUrl.toLowerCase().startsWith("jdbc")) { System.err.println( "WARNING: Wierd RMI server URL: localhost will be used."); jdbcUrl = url.substring(url.indexOf("/", 9) + 1); } } String rmiAddr = serverHostName + "/RmiJdbcServer"; String split[] = new String[3]; split[RMI_REGISTRY] = serverHostName.substring(2); split[RMI_ADDRESS] = rmiAddr; split[JDBC_URL] = jdbcUrl; return split; } /** * Try to make a database connection to the given URL. * The driver should return "null" if it realizes it is the wrong kind * of driver to connect to the given URL. This will be common, as when * the JDBC driver manager is asked to connect to a given URL it passes * the URL to each loaded driver in turn. * *

The driver should raise a SQLException if it is the right * driver to connect to the given URL, but has trouble connecting to * the database. * *

The java.util.Properties argument can be used to passed arbitrary * string tag/value pairs as connection arguments. * Normally at least "user" and "password" properties should be * included in the Properties. * * @param url The URL of the database to connect to * * @param info a list of arbitrary string tag/value pairs as * connection arguments; normally at least a "user" and * "password" property should be included * * @return a Connection to the URL */ public java.sql.Connection connect(String url,Properties info) throws SQLException { if (!acceptsURL(url)) return null; //Will cause a "No suitable driver" upon DriverManager call try { String split[] = splitURL(url); Connection c = new RJConnection( split[RMI_REGISTRY], split[RMI_ADDRESS], split[JDBC_URL], info); return c; } catch(Exception e) { e.printStackTrace(); throw new SQLException(e.getMessage()); } } /** * Returns true if the driver thinks that it can open a connection * to the given URL. Typically drivers will return true if they * understand the subprotocol specified in the URL and false if * they don't. * * @param url The URL of the database. * @return True if this driver can connect to the given URL. */ public boolean acceptsURL(String url) throws SQLException { return url.startsWith("jdbc:rmi:"); } /** *

The getPropertyInfo method is intended to allow a generic GUI tool to * discover what properties it should prompt a human for in order to get * enough information to connect to a database. Note that depending on * the values the human has supplied so far, additional values may become * necessary, so it may be necessary to iterate though several calls * to getPropertyInfo. * * @param url The URL of the database to connect to. * @param info A proposed list of tag/value pairs that will be sent on * connect open. * @return An array of DriverPropertyInfo objects describing possible * properties. This array may be an empty array if no properties * are required. */ public java.sql.DriverPropertyInfo[] getPropertyInfo(String url, java.util.Properties info) throws SQLException { try { String split[] = splitURL(url); Registry registry = LocateRegistry.getRegistry(split[RMI_REGISTRY]); RJDriverInterface drv = (RJDriverInterface)registry.lookup( split[RMI_ADDRESS]); // DriverPropertyInfo is not serializable: // the reason for RJDriverPropertyInfo ! RJDriverPropertyInfo infos[] = drv.getPropertyInfo(split[JDBC_URL], info); if(infos == null) return null; DriverPropertyInfo dpis[] = new DriverPropertyInfo[infos.length]; for(int i=0; iThe Java SQL framework allows for multiple database drivers. * *

Each driver should supply a class that implements * the Driver interface. * *

The DriverManager will try to load as many drivers as it can * find and then for any given connection request, it will ask each * driver in turn to try to connect to the target URL. * *

It is strongly recommended that each Driver class should be * small and standalone so that the Driver class can be loaded and * queried without bringing in vast quantities of supporting code. * *

When a Driver class is loaded, it should create an instance of * itself and register it with the DriverManager. This means that a * user can load and register a driver by doing * Class.forName("foo.bah.Driver"). * * @see DriverManager * @see Connection */ public interface RJDriverInterface extends java.rmi.Remote { /** * Try to make a database connection to the given URL. * The driver should return "null" if it realizes it is the wrong kind * of driver to connect to the given URL. This will be common, as when * the JDBC driver manager is asked to connect to a given URL it passes * the URL to each loaded driver in turn. * *

The driver should raise a java.rmi.RemoteException if it is the right * driver to connect to the given URL, but has trouble connecting to * the database. * *

The java.util.Properties argument can be used to passed arbitrary * string tag/value pairs as connection arguments. * Normally at least "user" and "password" properties should be * included in the Properties. * * @param url The URL of the database to connect to * * @param info a list of arbitrary string tag/value pairs as * connection arguments; normally at least a "user" and * "password" property should be included * * @return a Connection to the URL */ RJConnectionInterface connect(String url, java.util.Properties info) throws RemoteException, SQLException; /** * Returns true if the driver thinks that it can open a connection * to the given URL. Typically drivers will return true if they * understand the subprotocol specified in the URL and false if * they don't. * * @param url The URL of the database. * @return True if this driver can connect to the given URL. */ boolean acceptsURL(String url) throws RemoteException, SQLException; /** *

The getPropertyInfo method is intended to allow a generic GUI tool to * discover what properties it should prompt a human for in order to get * enough information to connect to a database. Note that depending on * the values the human has supplied so far, additional values may become * necessary, so it may be necessary to iterate though several calls * to getPropertyInfo. * * @param url The URL of the database to connect to. * @param info A proposed list of tag/value pairs that will be sent on * connect open. * @return An array of DriverPropertyInfo objects describing possible * properties. This array may be an empty array if no properties * are required. */ RJDriverPropertyInfo[] getPropertyInfo(String url, java.util.Properties info) throws RemoteException, SQLException; /** * Get the driver's major version number. Initially this should be 1. */ int getMajorVersion() throws RemoteException, SQLException; /** * Get the driver's minor version number. Initially this should be 0. */ int getMinorVersion() throws RemoteException, SQLException; /** * Report whether the Driver is a genuine JDBC COMPLIANT (tm) driver. * A driver may only report "true" here if it passes the JDBC compliance * tests, otherwise it is required to return false. * * JDBC compliance requires full support for the JDBC API and full support * for SQL 92 Entry Level. It is expected that JDBC compliant drivers will * be available for all the major commercial databases. * * This method is not intended to encourage the development of non-JDBC * compliant drivers, but is a recognition of the fact that some vendors * are interested in using the JDBC API and framework for lightweight * databases that do not support full database functionality, or for * special databases such as document information retrieval where a SQL * implementation may not be feasible. */ boolean jdbcCompliant() throws RemoteException, SQLException; } PK Mi+o7  RJDriverPropertyInfo.java /** * RmiJdbc client/server JDBC Driver * (C) GIE Dyade (Groupe BULL / INRIA Research Center) 1997 * * @version 1.0 * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com) */ package RmiJdbc; import java.sql.DriverPropertyInfo; /** * This class is used to make DriverPropertyInfo serializable, so the * driver's getPropertyInfo() return can be accessed remotely. */ public class RJDriverPropertyInfo implements java.io.Serializable { protected String name_; protected String value_; protected boolean required_; protected String description_; protected String choices_[]; protected RJDriverPropertyInfo(DriverPropertyInfo dpi) { choices_ = dpi.choices; description_ = dpi.description; name_ = dpi.name; required_ = dpi.required; value_ = dpi.value; } protected DriverPropertyInfo getPropertyInfo() { DriverPropertyInfo dpi = new DriverPropertyInfo(name_, value_); dpi.choices = choices_; dpi.description = description_; dpi.required = required_; return dpi; } }; PK ]j+P@RJDriverServer.java /** * RmiJdbc client/server JDBC Driver * (C) GIE Dyade (Groupe BULL / INRIA Research Center) 1997 * * @version 1.0 * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com) * Additional SSL Support * Douglas Hammond(djhammond@sympatico.ca) */ package RmiJdbc; import java.rmi.*; import java.sql.*; import java.rmi.server.Unreferenced; /** *

The Java SQL framework allows for multiple database drivers. * *

Each driver should supply a class that implements * the Driver interface. * *

The DriverManager will try to load as many drivers as it can * find and then for any given connection request, it will ask each * driver in turn to try to connect to the target URL. * *

It is strongly recommended that each Driver class should be * small and standalone so that the Driver class can be loaded and * queried without bringing in vast quantities of supporting code. * *

When a Driver class is loaded, it should create an instance of * itself and register it with the DriverManager. This means that a * user can load and register a driver by doing * Class.forName("foo.bah.Driver"). * * @see DriverManager * @see Connection */ public class RJDriverServer extends java.rmi.server.UnicastRemoteObject implements RJDriverInterface, Unreferenced { public RJDriverServer() throws RemoteException { super(RJJdbcServer.rmiJdbcListenerPort, RJJdbcServer.rmiClientSocketFactory, RJJdbcServer.rmiServerSocketFactory); //System.out.println("constructing a RJDriverServer"); } public void unreferenced() { System.out.println("RJDriverServer.unreferenced() -> garbage collecting"); Runtime.getRuntime().gc(); } /** * Try to make a database connection to the given URL. * The driver should return "null" if it realizes it is the wrong kind * of driver to connect to the given URL. This will be common, as when * the JDBC driver manager is asked to connect to a given URL it passes * the URL to each loaded driver in turn. * *

The driver should raise a java.rmi.RemoteException if it is the right * driver to connect to the given URL, but has trouble connecting to * the database. * *

The java.util.Properties argument can be used to passed arbitrary * string tag/value pairs as connection arguments. * Normally at least "user" and "password" properties should be * included in the Properties. * * @param url The URL of the database to connect to * * @param info a list of arbitrary string tag/value pairs as * connection arguments; normally at least a "user" and * "password" property should be included * * @return a Connection to the URL */ public RJConnectionInterface connect(String url, java.util.Properties info) throws RemoteException, SQLException { java.sql.Driver jdbcDriver; if ((jdbcDriver = DriverManager.getDriver(url)) == null) { throw new java.rmi.RemoteException( "RJDriverServer::connect: No suitable Driver"); } //System.out.println("RJDriverServer.connect("+url+")"); Connection c = jdbcDriver.connect(url, info); if(c == null) { throw new java.rmi.RemoteException( "RJDriverServer::connect: Underlying driver couldn\'t establish the connection: connect() returned null, check the configuration"); } return new RJConnectionServer(jdbcDriver.connect(url, info)); } /** * Returns true if the driver thinks that it can open a connection * to the given URL. Typically drivers will return true if they * understand the subprotocol specified in the URL and false if * they don't. * * @param url The URL of the database. * @return True if this driver can connect to the given URL. */ public boolean acceptsURL(String url) throws RemoteException, SQLException { return(DriverManager.getDriver(url) != null); } /** *

The getPropertyInfo method is intended to allow a generic GUI tool to * discover what properties it should prompt a human for in order to get * enough information to connect to a database. Note that depending on * the values the human has supplied so far, additional values may become * necessary, so it may be necessary to iterate though several calls * to getPropertyInfo. * * @param url The URL of the database to connect to. * @param info A proposed list of tag/value pairs that will be sent on * connect open. * @return An array of DriverPropertyInfo objects describing possible * properties. This array may be an empty array if no properties * are required. */ public RJDriverPropertyInfo[] getPropertyInfo(String url, java.util.Properties info) throws RemoteException, SQLException { java.sql.Driver jdbcDriver; if((jdbcDriver = DriverManager.getDriver(url)) == null) { throw new java.rmi.RemoteException( "RJDriverServer::getPropertyInfo: No suitable Driver"); } // DriverPropertyInfo is not serializable: // the reason for RJDriverPropertyInfo ! DriverPropertyInfo infos[] = jdbcDriver.getPropertyInfo(url, info); if(infos == null) return null; RJDriverPropertyInfo dpis[] = new RJDriverPropertyInfo[infos.length]; for(int i=0; i 0) { rmiRef = new String("//" + host + ":" + port + "/" + name); } // RWS REMOVED // RJDriverServer theDriver = new RJDriverServer(); RJDriverServer theDriver = buildDriverServer(); // RWS ADDED if (!startreg) { // External registry assumed Naming.rebind(rmiRef, theDriver); return; } // No external registry, start one if (port <= 0) port = rmiJdbcDefaultPort; Registry registry = LocateRegistry.createRegistry(port); registry.rebind(name, theDriver); // registry.rebind(rmiRef, theDriver); } /** * Build the driver server object. This is a separate method * so extensions can build different driver-server classes. * * @since 8-May-1999 */ RJDriverServer buildDriverServer() throws java.rmi.RemoteException { return new RJDriverServer(); } public static void main(String[] args) { try { Class.forName("RmiJdbc.RJDriverServer_Stub"); } catch(ClassNotFoundException cnfe) { System.out.println("Can't find stub!"); System.exit(0); } verboseMode = Boolean.valueOf( System.getProperty("RmiJdbc.verbose", "true")).booleanValue(); processArgs(args); printMsg("Starting RmiJdbc Server !"); // RWS ADDED -- broke up main into two routines initServer(new RJJdbcServer()); // RWS ADDED // RWS ADDED } static void initServer(RJJdbcServer theServer) { // RWS ADDED try { // Check for valid listener port if(lport_<0) { printMsg(" Invalid TCP port \" "+lport_+" \" as listener port for remote objects: Using an anonymous port"); } else if(lport_>0) { rmiJdbcListenerPort=lport_; printMsg("Remote objects will be listening on port number: "+rmiJdbcListenerPort); } // Args on the command line are interpreted as jdbc Driver class names // Try to register them in the jdbc DriverManager // For example, to register the driver for InstantDB free database: // java RJJdbcServer jdbc.idbDriver // Of course, you can also use the jdbc.drivers System property for(int i = 0; i < drivers_.size(); i++) { String drv = (String)drivers_.elementAt(i); try { // Class.forName(...) should be enough, without newInstance() ! // On some platforms, it is not... Class.forName(drv).newInstance(); printMsg(drv + " registered in DriverManager"); } catch(Exception e) { System.err.println("*** Can't register jdbc Driver for " + drv); System.err.println("Error message is: " + e.getMessage()); } } // The following code is useful on some platforms where the ClassLoader // has a strange behaviour (that causes "No suitable driver" exceptions // concerning properly registered drivers !) java.util.Enumeration ed = DriverManager.getDrivers(); while(ed.hasMoreElements()) { Driver d = (Driver)ed.nextElement(); } // We do load a special RMISecurityManager to relax RMI Security Mgr. // restrictions. This is because we need to remove some of the // restrictions from the default RMISecurityManager, since the RMI // threads will/might need to access database or local files and this // is not allowed by default. // // IMPORTANT NOTE: the specialized RJRMISecurityManager is only // required if your RMI threads might do I/O operations, otherwise // you can use the default RMISecurityManager and uncomment the // following line below to use it instead. // // FIXME: Make it optional (configurable). // // NOTE: If RmiJdbc is ran _embedded_ within an application, then // there might be a possibility that the application has already // installed a Security Manager; so in that case we will let that // one run instead of the RMI Security Manager and we will print // a warning. // // System.setSecurityManager(new RMISecurityManager()); // if (System.getSecurityManager() == (SecurityManager) null) { // check if we've asked not to install rmi security manager if (installRMISecurityMgr) System.setSecurityManager( (SecurityManager)new RJRMISecurityManager()); else printMsg("No installation of RMI Security Manager..."); } else { // We print a warning message and decide to continue // (ignore this at it is possible that the application // embedding us had already installed set a security Mgr. printMsg( "** Warning: RMI Security Manager has NOT been installed as "); printMsg( "** a Security Manager was already installed by the application...\n"); } // RWS REMOVED // RJJdbcServer theServer = new RJJdbcServer(); printMsg("Binding RmiJdbcServer..."); theServer.register("RmiJdbcServer", port_, startreg_); printMsg("RmiJdbcServer bound in rmi registry"); // If the server has its own registry, make sure the process keeps running if (startreg_) { //System.out.println("server has its own registry"); // suspend the main thread to ensure that this process // will continue to run // Thread.currentThread().suspend(); Thread tt = new Thread(); tt.suspend(); } } catch(Exception e) { System.err.println("Got Exception: "+e.getMessage()); e.printStackTrace(); System.exit(1); } } /** * Convenient static method to dump timestamped passed-in * message to the standard output. * * If RmiJdbc.verbose system property is set to false, then the messages * are not written out to standard output at all. */ public static void printMsg(String msg) { if (verboseMode) System.out.println(new java.util.Date().toString() + ": [RmiJdbc] " + msg); } }; PK 9Oi+-YYRJPreparedStatement.java /** * RmiJdbc client/server JDBC Driver * (C) GIE Dyade (Groupe BULL / INRIA Research Center) 1997 * * @version 1.0 * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com) */ package RmiJdbc; import java.sql.*; import java.rmi.RemoteException; import java.io.*; import java.math.BigDecimal; import java.util.Calendar; // TBD: WARNING This file contains a hack for InputStream class... // InputStream is not serializable, of course ! // The right way would be to encapsulate InputStream in a RMI remote object // (hope I'll find time to do that) /** *

A SQL statement is pre-compiled and stored in a * PreparedStatement object. This object can then be used to * efficiently execute this statement multiple times. * *

Note: The setXXX methods for setting IN parameter values * must specify types that are compatible with the defined SQL type of * the input parameter. For instance, if the IN parameter has SQL type * Integer then setInt should be used. * *

If arbitrary parameter type conversions are required then the * setObject method should be used with a target SQL type. * * @see Connection#prepareStatement * @see ResultSet */ public class RJPreparedStatement extends RJStatement implements java.sql.PreparedStatement, java.io.Serializable { RJPreparedStatementInterface rmiPrepStmt_; public RJPreparedStatement(RJPreparedStatementInterface p) { super(p); rmiPrepStmt_ = p; } /** * A prepared SQL query is executed and its ResultSet is returned. * * @return a ResultSet that contains the data produced by the * query; never null */ public java.sql.ResultSet executeQuery() throws SQLException { try { return new RJResultSet(rmiPrepStmt_.executeQuery()); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Execute a SQL INSERT, UPDATE or DELETE statement. In addition, * SQL statements that return nothing such as SQL DDL statements * can be executed. * * @return either the row count for INSERT, UPDATE or DELETE; or 0 * for SQL statements that return nothing */ public int executeUpdate() throws SQLException { try { return rmiPrepStmt_.executeUpdate(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Set a parameter to SQL NULL. * *

Note: You must specify the parameter's SQL type. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param sqlType SQL type code defined by java.sql.Types */ public void setNull(int parameterIndex, int sqlType) throws SQLException { try { rmiPrepStmt_.setNull(parameterIndex, sqlType); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Set a parameter to a Java boolean value. The driver converts this * to a SQL BIT value when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ public void setBoolean(int parameterIndex, boolean x) throws SQLException { try { rmiPrepStmt_.setBoolean(parameterIndex, x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Set a parameter to a Java byte value. The driver converts this * to a SQL TINYINT value when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ public void setByte(int parameterIndex, byte x) throws SQLException { try { rmiPrepStmt_.setByte(parameterIndex, x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Set a parameter to a Java short value. The driver converts this * to a SQL SMALLINT value when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ public void setShort(int parameterIndex, short x) throws SQLException { try { rmiPrepStmt_.setShort(parameterIndex, x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Set a parameter to a Java int value. The driver converts this * to a SQL INTEGER value when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ public void setInt(int parameterIndex, int x) throws SQLException { try { rmiPrepStmt_.setInt(parameterIndex, x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Set a parameter to a Java long value. The driver converts this * to a SQL BIGINT value when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ public void setLong(int parameterIndex, long x) throws SQLException { try { rmiPrepStmt_.setLong(parameterIndex, x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Set a parameter to a Java float value. The driver converts this * to a SQL FLOAT value when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ public void setFloat(int parameterIndex, float x) throws SQLException { try { rmiPrepStmt_.setFloat(parameterIndex, x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Set a parameter to a Java double value. The driver converts this * to a SQL DOUBLE value when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ public void setDouble(int parameterIndex, double x) throws SQLException { try { rmiPrepStmt_.setDouble(parameterIndex, x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Set a parameter to a java.lang.BigDecimal value. The driver converts * this to a SQL NUMERIC value when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ public void setBigDecimal(int parameterIndex, java.math.BigDecimal x) throws SQLException { try { rmiPrepStmt_.setBigDecimal(parameterIndex, x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Set a parameter to a Java String value. The driver converts this * to a SQL VARCHAR or LONGVARCHAR value (depending on the arguments * size relative to the driver's limits on VARCHARs) when it sends * it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ public void setString(int parameterIndex, String x) throws SQLException { try { rmiPrepStmt_.setString(parameterIndex, x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Set a parameter to a Java array of bytes. The driver converts * this to a SQL VARBINARY or LONGVARBINARY (depending on the * argument's size relative to the driver's limits on VARBINARYs) * when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ public void setBytes(int parameterIndex, byte x[]) throws SQLException { try { rmiPrepStmt_.setBytes(parameterIndex, x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Set a parameter to a java.sql.Date value. The driver converts this * to a SQL DATE value when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ public void setDate(int parameterIndex, java.sql.Date x) throws SQLException { try { rmiPrepStmt_.setDate(parameterIndex, x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Set a parameter to a java.sql.Time value. The driver converts this * to a SQL TIME value when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ public void setTime(int parameterIndex, java.sql.Time x) throws SQLException { try { rmiPrepStmt_.setTime(parameterIndex, x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Set a parameter to a java.sql.Timestamp value. The driver * converts this to a SQL TIMESTAMP value when it sends it to the * database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ public void setTimestamp(int parameterIndex, java.sql.Timestamp x) throws SQLException { try { rmiPrepStmt_.setTimestamp(parameterIndex, x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * When a very large ASCII value is input to a LONGVARCHAR * parameter, it may be more practical to send it via a * java.io.InputStream. JDBC will read the data from the stream * as needed, until it reaches end-of-file. The JDBC driver will * do any necessary conversion from ASCII to the database char format. * *

Note: This stream object can either be a standard * Java stream object or your own subclass that implements the * standard interface. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the java input stream which contains the ASCII parameter value * @param length the number of bytes in the stream */ //TBD InputStream is not serializable: I transmit all the data in a byte[] public void setAsciiStream(int parameterIndex, java.io.InputStream x, int length) throws SQLException { try { // rmiPrepStmt_.setAsciiStream(parameterIndex, x, length); /** // I read the whole InputStream into a StringBuffer, then send the // StringBuffer's bytes to the server !! Awful, isn't it :( // The right way is to "RMIze" InputStream, or what ?? StringBuffer buf = new StringBuffer(); BufferedReader r = new BufferedReader(new InputStreamReader(x)); char cbuf[] = new char[256]; int nb; while((nb = r.read(cbuf, 0, 255)) >= 0) { if(nb > 0) buf.append(cbuf, 0, nb); } r.close(); rmiPrepStmt_.setAsciiStream(parameterIndex, buf.toString().getBytes(), length); **/ BufferedInputStream s = new BufferedInputStream(x); ByteArrayOutputStream bos = new ByteArrayOutputStream(); byte buf[] = new byte[256]; int br; while((br = s.read(buf)) >= 0){ if (br > 0) bos.write(buf, 0, br); } s.close(); rmiPrepStmt_.setAsciiStream(parameterIndex, bos.toByteArray(), length); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } catch(IOException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * When a very large UNICODE value is input to a LONGVARCHAR * parameter, it may be more practical to send it via a * java.io.InputStream. JDBC will read the data from the stream * as needed, until it reaches end-of-file. The JDBC driver will * do any necessary conversion from UNICODE to the database char format. * *

Note: This stream object can either be a standard * Java stream object or your own subclass that implements the * standard interface. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the java input stream which contains the * UNICODE parameter value * @param length the number of bytes in the stream */ //TBD InputStream is not serializable: I transmit all the data in a byte[] public void setUnicodeStream(int parameterIndex, java.io.InputStream x, int length) throws SQLException { try { // rmiPrepStmt_.setUnicodeStream(parameterIndex, x, length); /** // I read the whole InputStream into a StringBuffer, then send the // StringBuffer's bytes to the server !! Awful, isn't it :( // The right way is to "RMIze" InputStream, or what ?? StringBuffer buf = new StringBuffer(); BufferedReader r = new BufferedReader(new InputStreamReader(x)); char cbuf[] = new char[256]; int nb; while((nb = r.read(cbuf, 0, 255)) >= 0) { if(nb > 0) buf.append(cbuf, 0, nb); } r.close(); rmiPrepStmt_.setUnicodeStream(parameterIndex, buf.toString().getBytes(), length); **/ BufferedInputStream s = new BufferedInputStream(x); ByteArrayOutputStream bos = new ByteArrayOutputStream(); byte buf[] = new byte[256]; int br; while((br = s.read(buf)) >= 0){ if (br > 0) bos.write(buf, 0, br); } s.close(); rmiPrepStmt_.setUnicodeStream(parameterIndex, bos.toByteArray(), length); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } catch(IOException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * When a very large binary value is input to a LONGVARBINARY * parameter, it may be more practical to send it via a * java.io.InputStream. JDBC will read the data from the stream * as needed, until it reaches end-of-file. * *

Note: This stream object can either be a standard * Java stream object or your own subclass that implements the * standard interface. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the java input stream which contains the binary parameter value * @param length the number of bytes in the stream */ //TBD InputStream is not serializable: I transmit all the data in a byte[] public void setBinaryStream(int parameterIndex, java.io.InputStream x, int length) throws SQLException { try { // rmiPrepStmt_.setBinaryStream(parameterIndex, x, length); /* // I read the whole InputStream into a StringBuffer, then send the // StringBuffer's bytes to the server !! Awful, isn't it :( // The right way is to "RMIze" InputStream, or what ?? StringBuffer buf = new StringBuffer(); BufferedReader r = new BufferedReader(new InputStreamReader(x)); char cbuf[] = new char[256]; int nb; while((nb = r.read(cbuf, 0, 255)) >= 0) { if(nb > 0) buf.append(cbuf, 0, nb); } r.close(); rmiPrepStmt_.setBinaryStream(parameterIndex, buf.toString().getBytes(), length); */ BufferedInputStream s = new BufferedInputStream(x); ByteArrayOutputStream bos = new ByteArrayOutputStream(); byte buf[] = new byte[256]; int br; while((br = s.read(buf)) >= 0){ if (br > 0) bos.write(buf, 0, br); } s.close(); rmiPrepStmt_.setBinaryStream(parameterIndex, bos.toByteArray(), length); /** TBD Proposed by P.Hearty rmiPrepStmt_.setBinaryStream( parameterIndex, RJResultSetServer.getBytesFromInputStream(x), length); **/ } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } catch(IOException e) { throw new java.sql.SQLException(e.getMessage()); } } /** *

In general, parameter values remain in force for repeated use of a * Statement. Setting a parameter value automatically clears its * previous value. However, in some cases it is useful to immediately * release the resources used by the current parameter values; this can * be done by calling clearParameters. */ public void clearParameters() throws SQLException { try { rmiPrepStmt_.clearParameters(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } //---------------------------------------------------------------------- // Advanced features: /** *

Set the value of a parameter using an object; use the * java.lang equivalent objects for integral values. * *

The given Java object will be converted to the targetSqlType * before being sent to the database. * *

Note that this method may be used to pass datatabase- * specific abstract data types. This is done by using a Driver- * specific Java type and using a targetSqlType of * java.sql.types.OTHER. * * @param parameterIndex The first parameter is 1, the second is 2, ... * @param x The object containing the input parameter value * @param targetSqlType The SQL type (as defined in java.sql.Types) to be * sent to the database. The scale argument may further qualify this type. * @param scale For java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types * this is the number of digits after the decimal. For all other * types this value will be ignored, * @see Types */ public void setObject(int parameterIndex, Object x, int targetSqlType, int scale) throws SQLException { try { rmiPrepStmt_.setObject(parameterIndex, x, targetSqlType, scale); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * This method is like setObject above, but assumes a scale of zero. */ public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException { try { rmiPrepStmt_.setObject(parameterIndex, x, targetSqlType); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** *

Set the value of a parameter using an object; use the * java.lang equivalent objects for integral values. * *

The JDBC specification specifies a standard mapping from * Java Object types to SQL types. The given argument java object * will be converted to the corresponding SQL type before being * sent to the database. * *

Note that this method may be used to pass datatabase * specific abstract data types, by using a Driver specific Java * type. * * @param parameterIndex The first parameter is 1, the second is 2, ... * @param x The object containing the input parameter value */ public void setObject(int parameterIndex, Object x) throws SQLException { try { rmiPrepStmt_.setObject(parameterIndex, x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Some prepared statements return multiple results; the execute * method handles these complex statements as well as the simpler * form of statements handled by executeQuery and executeUpdate. * * @see Statement#execute */ public boolean execute() throws SQLException { try { return rmiPrepStmt_.execute(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } // JDBC 2.0 methods added by Mike Jennings // sometime in the summer of 1999 // Implementation added by Peter Hearty, Aug 2000, (peter.hearty@lutris.com). public void setTimestamp(int parameterIndex, Timestamp x, java.util.Calendar cal) throws SQLException { try { rmiPrepStmt_.setTimestamp(parameterIndex,x,cal); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void setTime(int parameterIndex, Time x, java.util.Calendar cal) throws SQLException { try { rmiPrepStmt_.setTime(parameterIndex,x,cal); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void setRef(int i,Ref x) throws SQLException { try { rmiPrepStmt_.setRef(i,x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void setNull(int paramIndex, int sqlType, String typeName) throws SQLException { try { rmiPrepStmt_.setNull(paramIndex,sqlType,typeName); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void setDate(int parameterIndex, Date x, java.util.Calendar cal) throws SQLException { try { rmiPrepStmt_.setDate(parameterIndex,x,cal); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void setClob(int i, Clob x) throws SQLException { try { rmiPrepStmt_.setClob(i,x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void setCharacterStream(int parameterIndex, java.io.Reader reader, int length) throws SQLException { try { // rmiPrepStmt_.setCharacterStream(parameterIndex,reader,length); rmiPrepStmt_.setCharacterStream(parameterIndex, RJSerializer.toCharArray(reader), length); } catch(Exception e) { throw new java.sql.SQLException(e.getMessage()); } } public void setBlob(int i, Blob x) throws SQLException { try { rmiPrepStmt_.setBlob(i,x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void setArray(int i, Array x) throws SQLException { try { rmiPrepStmt_.setArray(i,x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public ResultSetMetaData getMetaData() throws SQLException { try { return new RJResultSetMetaData(rmiPrepStmt_.getMetaData()); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void addBatch() throws SQLException { try { rmiPrepStmt_.addBatch(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } }; PK Mi+9P9P!RJPreparedStatementInterface.java /** * RmiJdbc client/server JDBC Driver * (C) GIE Dyade (Groupe BULL / INRIA Research Center) 1997 * * @version 1.0 * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com) */ package RmiJdbc; import java.sql.*; import java.rmi.RemoteException; import java.math.BigDecimal; import java.util.Calendar; // TBD: WARNING This file contains a hack for InputStream class... // InputStream is not serializable, of course ! // The right way would be to encapsulate InputStream in a RMI remote object // (hope I'll find time to do that) /** *

A SQL statement is pre-compiled and stored in a * PreparedStatement object. This object can then be used to * efficiently execute this statement multiple times. * *

Note: The setXXX methods for setting IN parameter values * must specify types that are compatible with the defined SQL type of * the input parameter. For instance, if the IN parameter has SQL type * Integer then setInt should be used. * *

If arbitrary parameter type conversions are required then the * setObject method should be used with a target SQL type. * * @see Connection#prepareStatement * @see ResultSet */ public interface RJPreparedStatementInterface extends RJStatementInterface { /** * A prepared SQL query is executed and its ResultSet is returned. * * @return a ResultSet that contains the data produced by the * query; never null */ RJResultSetInterface executeQuery() throws RemoteException, SQLException; /** * Execute a SQL INSERT, UPDATE or DELETE statement. In addition, * SQL statements that return nothing such as SQL DDL statements * can be executed. * * @return either the row count for INSERT, UPDATE or DELETE; or 0 * for SQL statements that return nothing */ int executeUpdate() throws RemoteException, SQLException; /** * Set a parameter to SQL NULL. * *

Note: You must specify the parameter's SQL type. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param sqlType SQL type code defined by java.sql.Types */ void setNull(int parameterIndex, int sqlType) throws RemoteException, SQLException; /** * Set a parameter to a Java boolean value. The driver converts this * to a SQL BIT value when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ void setBoolean(int parameterIndex, boolean x) throws RemoteException, SQLException; /** * Set a parameter to a Java byte value. The driver converts this * to a SQL TINYINT value when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ void setByte(int parameterIndex, byte x) throws RemoteException, SQLException; /** * Set a parameter to a Java short value. The driver converts this * to a SQL SMALLINT value when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ void setShort(int parameterIndex, short x) throws RemoteException, SQLException; /** * Set a parameter to a Java int value. The driver converts this * to a SQL INTEGER value when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ void setInt(int parameterIndex, int x) throws RemoteException, SQLException; /** * Set a parameter to a Java long value. The driver converts this * to a SQL BIGINT value when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ void setLong(int parameterIndex, long x) throws RemoteException, SQLException; /** * Set a parameter to a Java float value. The driver converts this * to a SQL FLOAT value when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ void setFloat(int parameterIndex, float x) throws RemoteException, SQLException; /** * Set a parameter to a Java double value. The driver converts this * to a SQL DOUBLE value when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ void setDouble(int parameterIndex, double x) throws RemoteException, SQLException; /** * Set a parameter to a java.lang.BigDecimal value. The driver converts * this to a SQL NUMERIC value when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ void setBigDecimal(int parameterIndex, java.math.BigDecimal x) throws RemoteException, SQLException; /** * Set a parameter to a Java String value. The driver converts this * to a SQL VARCHAR or LONGVARCHAR value (depending on the arguments * size relative to the driver's limits on VARCHARs) when it sends * it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ void setString(int parameterIndex, String x) throws RemoteException, SQLException; /** * Set a parameter to a Java array of bytes. The driver converts * this to a SQL VARBINARY or LONGVARBINARY (depending on the * argument's size relative to the driver's limits on VARBINARYs) * when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ void setBytes(int parameterIndex, byte x[]) throws RemoteException, SQLException; /** * Set a parameter to a java.sql.Date value. The driver converts this * to a SQL DATE value when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ void setDate(int parameterIndex, java.sql.Date x) throws RemoteException, SQLException; /** * Set a parameter to a java.sql.Time value. The driver converts this * to a SQL TIME value when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ void setTime(int parameterIndex, java.sql.Time x) throws RemoteException, SQLException; /** * Set a parameter to a java.sql.Timestamp value. The driver * converts this to a SQL TIMESTAMP value when it sends it to the * database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ void setTimestamp(int parameterIndex, java.sql.Timestamp x) throws RemoteException, SQLException; /** * When a very large ASCII value is input to a LONGVARCHAR * parameter, it may be more practical to send it via a * java.io.InputStream. JDBC will read the data from the stream * as needed, until it reaches end-of-file. The JDBC driver will * do any necessary conversion from ASCII to the database char format. * *

Note: This stream object can either be a standard * Java stream object or your own subclass that implements the * standard interface. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the java input stream which contains the ASCII parameter value * @param length the number of bytes in the stream */ //TBD This is a hack (InputStream not serializable) // void setAsciiStream(int parameterIndex, java.io.InputStream x, void setAsciiStream(int parameterIndex, byte[] x, int length) throws RemoteException, SQLException; /** * When a very large UNICODE value is input to a LONGVARCHAR * parameter, it may be more practical to send it via a * java.io.InputStream. JDBC will read the data from the stream * as needed, until it reaches end-of-file. The JDBC driver will * do any necessary conversion from UNICODE to the database char format. * *

Note: This stream object can either be a standard * Java stream object or your own subclass that implements the * standard interface. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the java input stream which contains the * UNICODE parameter value * @param length the number of bytes in the stream */ //TBD This is a hack (InputStream not serializable) // void setUnicodeStream(int parameterIndex, java.io.InputStream x, void setUnicodeStream(int parameterIndex, byte[] x, int length) throws RemoteException, SQLException; /** * When a very large binary value is input to a LONGVARBINARY * parameter, it may be more practical to send it via a * java.io.InputStream. JDBC will read the data from the stream * as needed, until it reaches end-of-file. * *

Note: This stream object can either be a standard * Java stream object or your own subclass that implements the * standard interface. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the java input stream which contains the binary parameter value * @param length the number of bytes in the stream */ //TBD This is a hack (InputStream not serializable) // void setBinaryStream(int parameterIndex, java.io.InputStream x, void setBinaryStream(int parameterIndex, byte[] x, int length) throws RemoteException, SQLException; /** *

In general, parameter values remain in force for repeated use of a * Statement. Setting a parameter value automatically clears its * previous value. However, in some cases it is useful to immediately * release the resources used by the current parameter values; this can * be done by calling clearParameters. */ void clearParameters() throws RemoteException, SQLException; //---------------------------------------------------------------------- // Advanced features: /** *

Set the value of a parameter using an object; use the * java.lang equivalent objects for integral values. * *

The given Java object will be converted to the targetSqlType * before being sent to the database. * *

Note that this method may be used to pass datatabase- * specific abstract data types. This is done by using a Driver- * specific Java type and using a targetSqlType of * java.sql.types.OTHER. * * @param parameterIndex The first parameter is 1, the second is 2, ... * @param x The object containing the input parameter value * @param targetSqlType The SQL type (as defined in java.sql.Types) to be * sent to the database. The scale argument may further qualify this type. * @param scale For java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types * this is the number of digits after the decimal. For all other * types this value will be ignored, * @see Types */ void setObject(int parameterIndex, Object x, int targetSqlType, int scale) throws RemoteException, SQLException; /** * This method is like setObject above, but assumes a scale of zero. */ void setObject(int parameterIndex, Object x, int targetSqlType) throws RemoteException, SQLException; /** *

Set the value of a parameter using an object; use the * java.lang equivalent objects for integral values. * *

The JDBC specification specifies a standard mapping from * Java Object types to SQL types. The given argument java object * will be converted to the corresponding SQL type before being * sent to the database. * *

Note that this method may be used to pass datatabase * specific abstract data types, by using a Driver specific Java * type. * * @param parameterIndex The first parameter is 1, the second is 2, ... * @param x The object containing the input parameter value */ void setObject(int parameterIndex, Object x) throws RemoteException, SQLException; /** * Some prepared statements return multiple results; the execute * method handles these complex statements as well as the simpler * form of statements handled by executeQuery and executeUpdate. * * @see Statement#execute */ boolean execute() throws RemoteException, SQLException; //--------------------------JDBC 2.0----------------------------- /** * JDBC 2.0 * * Adds a set of parameters to the batch. * * @exception SQLException if a database access error occurs * @see Statement#addBatch */ void addBatch() throws java.rmi.RemoteException, SQLException; /** * JDBC 2.0 * * Sets the designated parameter to the given Reader * object, which is the given number of characters long. * When a very large UNICODE value is input to a LONGVARCHAR * parameter, it may be more practical to send it via a * java.io.Reader. JDBC will read the data from the stream * as needed, until it reaches end-of-file. The JDBC driver will * do any necessary conversion from UNICODE to the database char format. * *

Note: This stream object can either be a standard * Java stream object or your own subclass that implements the * standard interface. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the java reader which contains the UNICODE data * @param length the number of characters in the stream * @exception SQLException if a database access error occurs */ void setCharacterStream(int parameterIndex, java.io.Reader reader, int length) throws java.rmi.RemoteException, SQLException; // TBD The following hack allows to transfer the reader's content as a char // array... not optimal, but readers are nor serializable! void setCharacterStream(int parameterIndex, char serialized[], int length) throws java.rmi.RemoteException, SQLException; /** * JDBC 2.0 * * Sets a REF(<structured-type>) parameter. * * @param i the first parameter is 1, the second is 2, ... * @param x an object representing data of an SQL REF Type * @exception SQLException if a database access error occurs */ void setRef (int i, Ref x) throws java.rmi.RemoteException, SQLException; /** * JDBC 2.0 * * Sets a BLOB parameter. * * @param i the first parameter is 1, the second is 2, ... * @param x an object representing a BLOB * @exception SQLException if a database access error occurs */ void setBlob (int i, Blob x) throws java.rmi.RemoteException, SQLException; /** * JDBC 2.0 * * Sets a CLOB parameter. * * @param i the first parameter is 1, the second is 2, ... * @param x an object representing a CLOB * @exception SQLException if a database access error occurs */ void setClob (int i, Clob x) throws java.rmi.RemoteException, SQLException; /** * JDBC 2.0 * * Sets an Array parameter. * * @param i the first parameter is 1, the second is 2, ... * @param x an object representing an SQL array * @exception SQLException if a database access error occurs */ void setArray (int i, Array x) throws java.rmi.RemoteException, SQLException; /** * JDBC 2.0 * * Gets the number, types and properties of a ResultSet's columns. * * @return the description of a ResultSet's columns * @exception SQLException if a database access error occurs */ RJResultSetMetaDataInterface getMetaData() throws java.rmi.RemoteException, SQLException; /** * JDBC 2.0 * * Sets the designated parameter to a java.sql.Date value, * using the given Calendar object. The driver uses * the Calendar object to construct an SQL DATE, * which the driver then sends to the database. With a * a Calendar object, the driver can calculate the date * taking into account a custom timezone and locale. If no * Calendar object is specified, the driver uses the default * timezone and locale. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value * @param cal the Calendar object the driver will use * to construct the date * @exception SQLException if a database access error occurs */ void setDate(int parameterIndex, java.sql.Date x, Calendar cal) throws java.rmi.RemoteException, SQLException; /** * JDBC 2.0 * * Sets the designated parameter to a java.sql.Time value, * using the given Calendar object. The driver uses * the Calendar object to construct an SQL TIME, * which the driver then sends to the database. With a * a Calendar object, the driver can calculate the time * taking into account a custom timezone and locale. If no * Calendar object is specified, the driver uses the default * timezone and locale. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value * @param cal the Calendar object the driver will use * to construct the time * @exception SQLException if a database access error occurs */ void setTime(int parameterIndex, java.sql.Time x, Calendar cal) throws java.rmi.RemoteException, SQLException; /** * JDBC 2.0 * * Sets the designated parameter to a java.sql.Timestamp value, * using the given Calendar object. The driver uses * the Calendar object to construct an SQL TIMESTAMP, * which the driver then sends to the database. With a * a Calendar object, the driver can calculate the timestamp * taking into account a custom timezone and locale. If no * Calendar object is specified, the driver uses the default * timezone and locale. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value * @param cal the Calendar object the driver will use * to construct the timestamp * @exception SQLException if a database access error occurs */ void setTimestamp(int parameterIndex, java.sql.Timestamp x, Calendar cal) throws java.rmi.RemoteException, SQLException; /** * JDBC 2.0 * * Sets the designated parameter to SQL NULL. This version of setNull should * be used for user-named types and REF type parameters. Examples * of user-named types include: STRUCT, DISTINCT, JAVA_OBJECT, and * named array types. * *

Note: To be portable, applications must give the * SQL type code and the fully-qualified SQL type name when specifying * a NULL user-defined or REF parameter. In the case of a user-named type * the name is the type name of the parameter itself. For a REF * parameter the name is the type name of the referenced type. If * a JDBC driver does not need the type code or type name information, * it may ignore it. * * Although it is intended for user-named and Ref parameters, * this method may be used to set a null parameter of any JDBC type. * If the parameter does not have a user-named or REF type, the given * typeName is ignored. * * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param sqlType a value from java.sql.Types * @param typeName the fully-qualified name of an SQL user-named type, * ignored if the parameter is not a user-named type or REF * @exception SQLException if a database access error occurs */ void setNull (int paramIndex, int sqlType, String typeName) throws java.rmi.RemoteException, SQLException; }; PK Mi+Y\[[RJPreparedStatementServer.java /** * RmiJdbc client/server JDBC Driver * (C) GIE Dyade (Groupe BULL / INRIA Research Center) 1997 * * @version 1.0 * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com) */ package RmiJdbc; import java.sql.*; import java.rmi.*; import java.rmi.server.Unreferenced; import java.math.BigDecimal; import java.util.Calendar; import java.io.CharArrayReader; // TBD: WARNING This file contains a hack for InputStream class... // InputStream is not serializable, of course ! // The right way would be to encapsulate InputStream in a RMI remote object // (hope I'll find time to do that) /** *

A SQL statement is pre-compiled and stored in a * PreparedStatement object. This object can then be used to * efficiently execute this statement multiple times. * *

Note: The setXXX methods for setting IN parameter values * must specify types that are compatible with the defined SQL type of * the input parameter. For instance, if the IN parameter has SQL type * Integer then setInt should be used. * *

If arbitrary parameter type conversions are required then the * setObject method should be used with a target SQL type. * * @see Connection#prepareStatement * @see ResultSet */ public class RJPreparedStatementServer extends RJStatementServer implements RJPreparedStatementInterface, Unreferenced { java.sql.PreparedStatement jdbcPrepStmt_; public RJPreparedStatementServer(java.sql.PreparedStatement p) throws RemoteException { super(p); jdbcPrepStmt_ = p; } public void unreferenced() { Runtime.getRuntime().gc(); } /** * A prepared SQL query is executed and its ResultSet is returned. * * @return a ResultSet that contains the data produced by the * query; never null */ public RJResultSetInterface executeQuery() throws RemoteException, SQLException { return new RJResultSetServer(jdbcPrepStmt_.executeQuery()); } /** * Execute a SQL INSERT, UPDATE or DELETE statement. In addition, * SQL statements that return nothing such as SQL DDL statements * can be executed. * * @return either the row count for INSERT, UPDATE or DELETE; or 0 * for SQL statements that return nothing */ public int executeUpdate() throws RemoteException, SQLException { return jdbcPrepStmt_.executeUpdate(); } /** * Set a parameter to SQL NULL. * *

Note: You must specify the parameter's SQL type. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param sqlType SQL type code defined by java.sql.Types */ public void setNull(int parameterIndex, int sqlType) throws RemoteException, SQLException { jdbcPrepStmt_.setNull(parameterIndex, sqlType); } /** * Set a parameter to a Java boolean value. The driver converts this * to a SQL BIT value when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ public void setBoolean(int parameterIndex, boolean x) throws RemoteException, SQLException { jdbcPrepStmt_.setBoolean(parameterIndex, x); } /** * Set a parameter to a Java byte value. The driver converts this * to a SQL TINYINT value when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ public void setByte(int parameterIndex, byte x) throws RemoteException, SQLException { jdbcPrepStmt_.setByte(parameterIndex, x); } /** * Set a parameter to a Java short value. The driver converts this * to a SQL SMALLINT value when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ public void setShort(int parameterIndex, short x) throws RemoteException, SQLException { jdbcPrepStmt_.setShort(parameterIndex, x); } /** * Set a parameter to a Java int value. The driver converts this * to a SQL INTEGER value when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ public void setInt(int parameterIndex, int x) throws RemoteException, SQLException { jdbcPrepStmt_.setInt(parameterIndex, x); } /** * Set a parameter to a Java long value. The driver converts this * to a SQL BIGINT value when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ public void setLong(int parameterIndex, long x) throws RemoteException, SQLException { jdbcPrepStmt_.setLong(parameterIndex, x); } /** * Set a parameter to a Java float value. The driver converts this * to a SQL FLOAT value when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ public void setFloat(int parameterIndex, float x) throws RemoteException, SQLException { jdbcPrepStmt_.setFloat(parameterIndex, x); } /** * Set a parameter to a Java double value. The driver converts this * to a SQL DOUBLE value when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ public void setDouble(int parameterIndex, double x) throws RemoteException, SQLException { jdbcPrepStmt_.setDouble(parameterIndex, x); } /** * Set a parameter to a java.lang.BigDecimal value. The driver converts * this to a SQL NUMERIC value when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ public void setBigDecimal(int parameterIndex, java.math.BigDecimal x) throws RemoteException, SQLException { jdbcPrepStmt_.setBigDecimal(parameterIndex, x); } /** * Set a parameter to a Java String value. The driver converts this * to a SQL VARCHAR or LONGVARCHAR value (depending on the arguments * size relative to the driver's limits on VARCHARs) when it sends * it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ public void setString(int parameterIndex, String x) throws RemoteException, SQLException { jdbcPrepStmt_.setString(parameterIndex, x); } /** * Set a parameter to a Java array of bytes. The driver converts * this to a SQL VARBINARY or LONGVARBINARY (depending on the * argument's size relative to the driver's limits on VARBINARYs) * when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ public void setBytes(int parameterIndex, byte x[]) throws RemoteException, SQLException { jdbcPrepStmt_.setBytes(parameterIndex, x); } /** * Set a parameter to a java.sql.Date value. The driver converts this * to a SQL DATE value when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ public void setDate(int parameterIndex, java.sql.Date x) throws RemoteException, SQLException { jdbcPrepStmt_.setDate(parameterIndex, x); } /** * Set a parameter to a java.sql.Time value. The driver converts this * to a SQL TIME value when it sends it to the database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ public void setTime(int parameterIndex, java.sql.Time x) throws RemoteException, SQLException { jdbcPrepStmt_.setTime(parameterIndex, x); } /** * Set a parameter to a java.sql.Timestamp value. The driver * converts this to a SQL TIMESTAMP value when it sends it to the * database. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value */ public void setTimestamp(int parameterIndex, java.sql.Timestamp x) throws RemoteException, SQLException { jdbcPrepStmt_.setTimestamp(parameterIndex, x); } /** * When a very large ASCII value is input to a LONGVARCHAR * parameter, it may be more practical to send it via a * java.io.InputStream. JDBC will read the data from the stream * as needed, until it reaches end-of-file. The JDBC driver will * do any necessary conversion from ASCII to the database char format. * *

Note: This stream object can either be a standard * Java stream object or your own subclass that implements the * standard interface. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the java input stream which contains the ASCII parameter value * @param length the number of bytes in the stream */ //TBD This is a hack (InputStream not serializable) // public void setAsciiStream(int parameterIndex, java.io.InputStream x, public void setAsciiStream(int parameterIndex, byte[] x, int length) throws RemoteException, SQLException { // jdbcPrepStmt_.setAsciiStream(parameterIndex, x, length); jdbcPrepStmt_.setAsciiStream(parameterIndex, new java.io.ByteArrayInputStream(x), length); } /** * When a very large UNICODE value is input to a LONGVARCHAR * parameter, it may be more practical to send it via a * java.io.InputStream. JDBC will read the data from the stream * as needed, until it reaches end-of-file. The JDBC driver will * do any necessary conversion from UNICODE to the database char format. * *

Note: This stream object can either be a standard * Java stream object or your own subclass that implements the * standard interface. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the java input stream which contains the * UNICODE parameter value * @param length the number of bytes in the stream */ //TBD This is a hack (InputStream not serializable) // public void setUnicodeStream(int parameterIndex, java.io.InputStream x, public void setUnicodeStream(int parameterIndex, byte[] x, int length) throws RemoteException, SQLException { // jdbcPrepStmt_.setUnicodeStream(parameterIndex, x, length); jdbcPrepStmt_.setUnicodeStream(parameterIndex, new java.io.ByteArrayInputStream(x), length); } /** * When a very large binary value is input to a LONGVARBINARY * parameter, it may be more practical to send it via a * java.io.InputStream. JDBC will read the data from the stream * as needed, until it reaches end-of-file. * *

Note: This stream object can either be a standard * Java stream object or your own subclass that implements the * standard interface. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the java input stream which contains the binary parameter value * @param length the number of bytes in the stream */ //TBD This is a hack (InputStream not serializable) // public void setBinaryStream(int parameterIndex, java.io.InputStream x, public void setBinaryStream(int parameterIndex, byte[] x, int length) throws RemoteException, SQLException { // jdbcPrepStmt_.setBinaryStream(parameterIndex, x, length); jdbcPrepStmt_.setBinaryStream(parameterIndex, new java.io.ByteArrayInputStream(x), length); } /** *

In general, parameter values remain in force for repeated use of a * Statement. Setting a parameter value automatically clears its * previous value. However, in some cases it is useful to immediately * release the resources used by the current parameter values; this can * be done by calling clearParameters. */ public void clearParameters() throws RemoteException, SQLException { jdbcPrepStmt_.clearParameters(); } //---------------------------------------------------------------------- // Advanced features: /** *

Set the value of a parameter using an object; use the * java.lang equivalent objects for integral values. * *

The given Java object will be converted to the targetSqlType * before being sent to the database. * *

Note that this method may be used to pass datatabase- * specific abstract data types. This is done by using a Driver- * specific Java type and using a targetSqlType of * java.sql.types.OTHER. * * @param parameterIndex The first parameter is 1, the second is 2, ... * @param x The object containing the input parameter value * @param targetSqlType The SQL type (as defined in java.sql.Types) to be * sent to the database. The scale argument may further qualify this type. * @param scale For java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types * this is the number of digits after the decimal. For all other * types this value will be ignored, * @see Types */ public void setObject(int parameterIndex, Object x, int targetSqlType, int scale) throws RemoteException, SQLException { jdbcPrepStmt_.setObject(parameterIndex, x, targetSqlType, scale); } /** * This method is like setObject above, but assumes a scale of zero. */ public void setObject(int parameterIndex, Object x, int targetSqlType) throws RemoteException, SQLException { jdbcPrepStmt_.setObject(parameterIndex, x, targetSqlType); } /** *

Set the value of a parameter using an object; use the * java.lang equivalent objects for integral values. * *

The JDBC specification specifies a standard mapping from * Java Object types to SQL types. The given argument java object * will be converted to the corresponding SQL type before being * sent to the database. * *

Note that this method may be used to pass datatabase * specific abstract data types, by using a Driver specific Java * type. * * @param parameterIndex The first parameter is 1, the second is 2, ... * @param x The object containing the input parameter value */ public void setObject(int parameterIndex, Object x) throws RemoteException, SQLException { jdbcPrepStmt_.setObject(parameterIndex, x); } /** * Some prepared statements return multiple results; the execute * method handles these complex statements as well as the simpler * form of statements handled by executeQuery and executeUpdate. * * @see Statement#execute */ public boolean execute() throws RemoteException, SQLException { return jdbcPrepStmt_.execute(); } //--------------------------JDBC 2.0----------------------------- // Added Aug 2000, Peter Hearty, peter.hearty@lutris.com. /** * JDBC 2.0 * * Adds a set of parameters to the batch. * * @exception SQLException if a database access error occurs * @see Statement#addBatch */ public void addBatch() throws RemoteException, SQLException { jdbcPrepStmt_.addBatch(); } /** * JDBC 2.0 * * Sets the designated parameter to the given Reader * object, which is the given number of characters long. * When a very large UNICODE value is input to a LONGVARCHAR * parameter, it may be more practical to send it via a * java.io.Reader. JDBC will read the data from the stream * as needed, until it reaches end-of-file. The JDBC driver will * do any necessary conversion from UNICODE to the database char format. * *

Note: This stream object can either be a standard * Java stream object or your own subclass that implements the * standard interface. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the java reader which contains the UNICODE data * @param length the number of characters in the stream * @exception SQLException if a database access error occurs */ // TBD This method is called by the one below... public void setCharacterStream(int parameterIndex, java.io.Reader reader, int length) throws RemoteException, SQLException { jdbcPrepStmt_.setCharacterStream(parameterIndex,reader,length); } public void setCharacterStream(int parameterIndex, char buf[], int length) throws RemoteException, SQLException { try { setCharacterStream(parameterIndex, RJSerializer.toReader(buf),length); } catch(Exception e) { throw new SQLException(e.getMessage()); } } /** * JDBC 2.0 * * Sets a REF(<structured-type>) parameter. * * @param i the first parameter is 1, the second is 2, ... * @param x an object representing data of an SQL REF Type * @exception SQLException if a database access error occurs */ public void setRef (int i, Ref x) throws RemoteException, SQLException { jdbcPrepStmt_.setRef (i, x); } /** * JDBC 2.0 * * Sets a BLOB parameter. * * @param i the first parameter is 1, the second is 2, ... * @param x an object representing a BLOB * @exception SQLException if a database access error occurs */ public void setBlob (int i, Blob x) throws RemoteException, SQLException { jdbcPrepStmt_.setBlob (i, x); } /** * JDBC 2.0 * * Sets a CLOB parameter. * * @param i the first parameter is 1, the second is 2, ... * @param x an object representing a CLOB * @exception SQLException if a database access error occurs */ public void setClob (int i, Clob x) throws RemoteException, SQLException { jdbcPrepStmt_.setClob (i, x); } /** * JDBC 2.0 * * Sets an Array parameter. * * @param i the first parameter is 1, the second is 2, ... * @param x an object representing an SQL array * @exception SQLException if a database access error occurs */ public void setArray (int i, Array x) throws RemoteException, SQLException { jdbcPrepStmt_.setArray (i, x); } /** * JDBC 2.0 * * Gets the number, types and properties of a ResultSet's columns. * * @return the description of a ResultSet's columns * @exception SQLException if a database access error occurs */ public RJResultSetMetaDataInterface getMetaData() throws RemoteException, SQLException { return new RJResultSetMetaDataServer(jdbcPrepStmt_.getMetaData()); } /** * JDBC 2.0 * * Sets the designated parameter to a java.sql.Date value, * using the given Calendar object. The driver uses * the Calendar object to construct an SQL DATE, * which the driver then sends to the database. With a * a Calendar object, the driver can calculate the date * taking into account a custom timezone and locale. If no * Calendar object is specified, the driver uses the default * timezone and locale. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value * @param cal the Calendar object the driver will use * to construct the date * @exception SQLException if a database access error occurs */ public void setDate(int parameterIndex, java.sql.Date x, Calendar cal) throws RemoteException, SQLException { jdbcPrepStmt_.setDate(parameterIndex, x, cal); } /** * JDBC 2.0 * * Sets the designated parameter to a java.sql.Time value, * using the given Calendar object. The driver uses * the Calendar object to construct an SQL TIME, * which the driver then sends to the database. With a * a Calendar object, the driver can calculate the time * taking into account a custom timezone and locale. If no * Calendar object is specified, the driver uses the default * timezone and locale. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value * @param cal the Calendar object the driver will use * to construct the time * @exception SQLException if a database access error occurs */ public void setTime(int parameterIndex, java.sql.Time x, Calendar cal) throws RemoteException, SQLException { jdbcPrepStmt_.setTime(parameterIndex, x, cal) ; } /** * JDBC 2.0 * * Sets the designated parameter to a java.sql.Timestamp value, * using the given Calendar object. The driver uses * the Calendar object to construct an SQL TIMESTAMP, * which the driver then sends to the database. With a * a Calendar object, the driver can calculate the timestamp * taking into account a custom timezone and locale. If no * Calendar object is specified, the driver uses the default * timezone and locale. * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param x the parameter value * @param cal the Calendar object the driver will use * to construct the timestamp * @exception SQLException if a database access error occurs */ public void setTimestamp(int parameterIndex, java.sql.Timestamp x, Calendar cal) throws RemoteException, SQLException { jdbcPrepStmt_.setTimestamp(parameterIndex, x, cal); } /** * JDBC 2.0 * * Sets the designated parameter to SQL NULL. This version of setNull should * be used for user-named types and REF type parameters. Examples * of user-named types include: STRUCT, DISTINCT, JAVA_OBJECT, and * named array types. * *

Note: To be portable, applications must give the * SQL type code and the fully-qualified SQL type name when specifying * a NULL user-defined or REF parameter. In the case of a user-named type * the name is the type name of the parameter itself. For a REF * parameter the name is the type name of the referenced type. If * a JDBC driver does not need the type code or type name information, * it may ignore it. * * Although it is intended for user-named and Ref parameters, * this method may be used to set a null parameter of any JDBC type. * If the parameter does not have a user-named or REF type, the given * typeName is ignored. * * * @param parameterIndex the first parameter is 1, the second is 2, ... * @param sqlType a value from java.sql.Types * @param typeName the fully-qualified name of an SQL user-named type, * ignored if the parameter is not a user-named type or REF * @exception SQLException if a database access error occurs */ public void setNull (int paramIndex, int sqlType, String typeName) throws RemoteException, SQLException { jdbcPrepStmt_.setNull (paramIndex, sqlType, typeName); } }; PK Mi+*)hT RJRMISecurityManager.java /** * RmiJdbc client/server JDBC Driver * (C) GIE Dyade (Groupe BULL / INRIA Research Center) 1997 * * @version 1.0 * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com) * @updated Francois Orsini (Cloudscape Inc.) * Removed/relaxed some of the RMI Security Manager restrictions. */ package RmiJdbc; import java.io.FileDescriptor; import java.rmi.*; /** *

This is a specialized RMI Security Manager for RmiJdbc when _embedded_ * applications/components are being accessed through RmiJdbc driver and * run in the same JVM than RmiJdbc. * This is required in order for the RMI threads to perform successfully * when accessing database/local files for instance and performing I/O * operations. The default RMI Security Manager is very restrictive and does * not allow RMI thread to perform some of the I/O operations for instance. * *

Note: There might be a cleaner solution in a near future, but * right now this one allows embedded applications that does I/O operations * throughout the RMI thread(s) to run inside RmiJdbc server. * * @see RMISecurityManager */ public class RJRMISecurityManager extends RMISecurityManager { /** * We do not restrict anything in particular here */ public void checkRead(FileDescriptor fd) throws java.lang.SecurityException { return; } /** * We do not restrict anything in particular here */ public void checkRead(String file) throws java.lang.SecurityException { return; } /** * We do not restrict anything in particular here */ public void checkRead(String file, Object context) throws java.lang.SecurityException { return; } /** * We do not restrict anything in particular here */ public void checkWrite(FileDescriptor fd) throws java.lang.SecurityException { return; } /** * We do not restrict anything in particular here */ public void checkWrite(String file) throws java.lang.SecurityException { return; } /** * We do not restrict anything in particular here */ public void checkDelete(String file) throws java.lang.SecurityException { return; } /** * We do not restrict anything in particular here */ public synchronized void checkCreateClassLoader() throws java.lang.SecurityException { return; } /** * We do not restrict anything in particular here */ public void checkMemberAccess(Class clazz, int which) { return; } /** * We do not restrict anything in particular here */ public synchronized void checkExec(String cmd) { return; } /** * We do not restrict anything in particular here */ public void checkPropertyAccess(String key) { return; } /** * We do not restrict anything in particular here */ public void checkPropertiesAccess() { return; } } PK =Oi+,G;33 RJRef.java /** * RmiJdbc client/server JDBC Driver * (C) ExperLog 1999-2000 * * @version 1.0 * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com) */ package RmiJdbc; import java.sql.*; import java.rmi.RemoteException; /** * A reference to an SQL structured type value in the database. * A Ref can be saved to persistent storage. A Ref is dereferenced by * passing it as a parameter to an SQL statement and executing the statement. */ public class RJRef implements java.sql.Ref, java.io.Serializable { RJRefInterface rmiRef_; public RJRef(RJRefInterface r) { rmiRef_ = r; } public String getBaseTypeName() throws SQLException { try { return rmiRef_.getBaseTypeName(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } }; PK Ni+$IIRJRefInterface.java /** * RmiJdbc client/server JDBC Driver * (C) ExperLog 1999-2000 * * @version 1.0 * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com) */ package RmiJdbc; import java.sql.*; import java.rmi.RemoteException; /** * A reference to an SQL structured type value in the database. * A Ref can be saved to persistent storage. A Ref is dereferenced by * passing it as a parameter to an SQL statement and executing the statement. */ public interface RJRefInterface extends java.rmi.Remote { String getBaseTypeName() throws RemoteException, SQLException; }; PK Ni+ؚRJRefServer.java /** * RmiJdbc client/server JDBC Driver * (C) ExperLog 1999-2000 * * @version 1.0 * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com) * Additional SSL Support * Douglas Hammond(djhammond@sympatico.ca) */ package RmiJdbc; import java.sql.*; import java.rmi.RemoteException; import java.rmi.server.UnicastRemoteObject; import java.rmi.server.Unreferenced; /** * A reference to an SQL structured type value in the database. * A Ref can be saved to persistent storage. A Ref is dereferenced by * passing it as a parameter to an SQL statement and executing the statement. */ public class RJRefServer extends java.rmi.server.UnicastRemoteObject implements RJRefInterface, Unreferenced { java.sql.Ref jdbcRef_; public RJRefServer(java.sql.Ref r) throws RemoteException { super(RJJdbcServer.rmiJdbcListenerPort, RJJdbcServer.rmiClientSocketFactory, RJJdbcServer.rmiServerSocketFactory); jdbcRef_ = r; } public void unreferenced() { Runtime.getRuntime().gc(); } public String getBaseTypeName() throws RemoteException, SQLException { return jdbcRef_.getBaseTypeName(); } }; PK COi+g|22RJResultSet.java /** * RmiJdbc client/server JDBC Driver * (C) GIE Dyade (Groupe BULL / INRIA Research Center) 1997 * * @version 1.0 * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com) */ package RmiJdbc; import java.math.BigDecimal; import java.sql.*; import java.rmi.RemoteException; // TBD: WARNING This file contains a hack for InputStream class... // InputStream is not serializable, of course ! // The right way would be to encapsulate InputStream in a RMI remote object // (hope I'll find time to do that) /** *

A ResultSet provides access to a table of data generated by * executing a Statement. The table rows are retrieved in * sequence. Within a row its column values can be accessed in any * order. * *

A ResultSet maintains a cursor pointing to its current row of * data. Initially the cursor is positioned before the first row. * The 'next' method moves the cursor to the next row. * *

The getXXX methods retrieve column values for the current * row. You can retrieve values either using the index number of the * column, or by using the name of the column. In general using the * column index will be more efficient. Columns are numbered from 1. * *

For maximum portability, ResultSet columns within each row should be * read in left-to-right order and each column should be read only once. * *

For the getXXX methods, the JDBC driver attempts to convert the * underlying data to the specified Java type and returns a suitable * Java value. See the JDBC specification for allowable mappings * from SQL types to Java types with the ResultSet.getXXX methods. * *

Column names used as input to getXXX methods are case insensitive. * When performing a getXXX using a column name, if several columns have * the same name, then the value of the first matching column will be * returned. * *

A ResultSet is automatically closed by the Statement that * generated it when that Statement is closed, re-executed, or is used * to retrieve the next result from a sequence of multiple results. * *

The number, types and properties of a ResultSet's columns are * provided by the ResulSetMetaData object returned by the getMetaData * method. * * @see Statement#executeQuery * @see Statement#getResultSet * @see ResultSetMetaData */ public class RJResultSet implements java.sql.ResultSet, java.io.Serializable { RJResultSetInterface rmiResultSet_; public RJResultSet(RJResultSetInterface r) { rmiResultSet_ = r; } /** * A ResultSet is initially positioned before its first row; the * first call to next makes the first row the current row; the * second call makes the second row the current row, etc. * *

If an input stream from the previous row is open, it is * implicitly closed. The ResultSet's warning chain is cleared * when a new row is read. * * @return true if the new current row is valid; false if there * are no more rows */ public boolean next() throws java.sql.SQLException { try { return rmiResultSet_.next(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * In some cases, it is desirable to immediately release a * ResultSet's database and JDBC resources instead of waiting for * this to happen when it is automatically closed; the close * method provides this immediate release. * *

Note: A ResultSet is automatically closed by the * Statement that generated it when that Statement is closed, * re-executed, or is used to retrieve the next result from a * sequence of multiple results. A ResultSet is also automatically * closed when it is garbage collected. */ public void close() throws java.sql.SQLException { try { rmiResultSet_.close(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * A column may have the value of SQL NULL; wasNull reports whether * the last column read had this special value. * Note that you must first call getXXX on a column to try to read * its value and then call wasNull() to find if the value was * the SQL NULL. * * @return true if last column read was SQL NULL */ public boolean wasNull() throws java.sql.SQLException { try { return rmiResultSet_.wasNull(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } //====================================================================== // Methods for accessing results by column index //====================================================================== /** * Get the value of a column in the current row as a Java String. * * @param columnIndex the first column is 1, the second is 2, ... * @return the column value; if the value is SQL NULL, the result is null */ public String getString(int columnIndex) throws java.sql.SQLException { try { return rmiResultSet_.getString(columnIndex); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a column in the current row as a Java boolean. * * @param columnIndex the first column is 1, the second is 2, ... * @return the column value; if the value is SQL NULL, the result is false */ public boolean getBoolean(int columnIndex) throws java.sql.SQLException { try { return rmiResultSet_.getBoolean(columnIndex); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a column in the current row as a Java byte. * * @param columnIndex the first column is 1, the second is 2, ... * @return the column value; if the value is SQL NULL, the result is 0 */ public byte getByte(int columnIndex) throws java.sql.SQLException { try { return rmiResultSet_.getByte(columnIndex); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a column in the current row as a Java short. * * @param columnIndex the first column is 1, the second is 2, ... * @return the column value; if the value is SQL NULL, the result is 0 */ public short getShort(int columnIndex) throws java.sql.SQLException { try { return rmiResultSet_.getShort(columnIndex); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a column in the current row as a Java int. * * @param columnIndex the first column is 1, the second is 2, ... * @return the column value; if the value is SQL NULL, the result is 0 */ public int getInt(int columnIndex) throws java.sql.SQLException { try { return rmiResultSet_.getInt(columnIndex); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a column in the current row as a Java long. * * @param columnIndex the first column is 1, the second is 2, ... * @return the column value; if the value is SQL NULL, the result is 0 */ public long getLong(int columnIndex) throws java.sql.SQLException { try { return rmiResultSet_.getLong(columnIndex); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a column in the current row as a Java float. * * @param columnIndex the first column is 1, the second is 2, ... * @return the column value; if the value is SQL NULL, the result is 0 */ public float getFloat(int columnIndex) throws java.sql.SQLException { try { return rmiResultSet_.getFloat(columnIndex); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a column in the current row as a Java double. * * @param columnIndex the first column is 1, the second is 2, ... * @return the column value; if the value is SQL NULL, the result is 0 */ public double getDouble(int columnIndex) throws java.sql.SQLException { try { return rmiResultSet_.getDouble(columnIndex); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a column in the current row as a java.lang.BigDecimal object. * * @param columnIndex the first column is 1, the second is 2, ... * @param scale the number of digits to the right of the decimal * @return the column value; if the value is SQL NULL, the result is null */ public BigDecimal getBigDecimal(int columnIndex, int scale) throws java.sql.SQLException { try { return rmiResultSet_.getBigDecimal(columnIndex, scale); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a column in the current row as a Java byte array. * The bytes represent the raw values returned by the driver. * * @param columnIndex the first column is 1, the second is 2, ... * @return the column value; if the value is SQL NULL, the result is null */ public byte[] getBytes(int columnIndex) throws java.sql.SQLException { try { return rmiResultSet_.getBytes(columnIndex); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a column in the current row as a java.sql.Date object. * * @param columnIndex the first column is 1, the second is 2, ... * @return the column value; if the value is SQL NULL, the result is null */ public java.sql.Date getDate(int columnIndex) throws java.sql.SQLException { try { return rmiResultSet_.getDate(columnIndex); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a column in the current row as a java.sql.Time object. * * @param columnIndex the first column is 1, the second is 2, ... * @return the column value; if the value is SQL NULL, the result is null */ public java.sql.Time getTime(int columnIndex) throws java.sql.SQLException { try { return rmiResultSet_.getTime(columnIndex); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a column in the current row as a java.sql.Timestamp object. * * @param columnIndex the first column is 1, the second is 2, ... * @return the column value; if the value is SQL NULL, the result is null */ public java.sql.Timestamp getTimestamp(int columnIndex) throws java.sql.SQLException { try { return rmiResultSet_.getTimestamp(columnIndex); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * A column value can be retrieved as a stream of ASCII characters * and then read in chunks from the stream. This method is particularly * suitable for retrieving large LONGVARCHAR values. The JDBC driver will * do any necessary conversion from the database format into ASCII. * *

Note: All the data in the returned stream must be * read prior to getting the value of any other column. The next * call to a get method implicitly closes the stream. . Also, a * stream may return 0 for available() whether there is data * available or not. * * @param columnIndex the first column is 1, the second is 2, ... * @return a Java input stream that delivers the database column value * as a stream of one byte ASCII characters. If the value is SQL NULL * then the result is null. */ // TBD There's a hack there (InputStream not serializable) public java.io.InputStream getAsciiStream(int columnIndex) throws java.sql.SQLException { try { byte[] val = rmiResultSet_.getAsciiStream(columnIndex); if(val == null) return null; return new java.io.ByteArrayInputStream(val); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * A column value can be retrieved as a stream of Unicode characters * and then read in chunks from the stream. This method is particularly * suitable for retrieving large LONGVARCHAR values. The JDBC driver will * do any necessary conversion from the database format into Unicode. * *

Note: All the data in the returned stream must be * read prior to getting the value of any other column. The next * call to a get method implicitly closes the stream. . Also, a * stream may return 0 for available() whether there is data * available or not. * * @param columnIndex the first column is 1, the second is 2, ... * @return a Java input stream that delivers the database column value * as a stream of two byte Unicode characters. If the value is SQL NULL * then the result is null. */ // TBD There's a hack there (InputStream not serializable) public java.io.InputStream getUnicodeStream(int columnIndex) throws java.sql.SQLException { try { byte[] val = rmiResultSet_.getUnicodeStream(columnIndex); if(val == null) return null; return new java.io.ByteArrayInputStream(val); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * A column value can be retrieved as a stream of uninterpreted bytes * and then read in chunks from the stream. This method is particularly * suitable for retrieving large LONGVARBINARY values. * *

Note: All the data in the returned stream must be * read prior to getting the value of any other column. The next * call to a get method implicitly closes the stream. Also, a * stream may return 0 for available() whether there is data * available or not. * * @param columnIndex the first column is 1, the second is 2, ... * @return a Java input stream that delivers the database column value * as a stream of uninterpreted bytes. If the value is SQL NULL * then the result is null. */ // TBD There's a hack there (InputStream not serializable) public java.io.InputStream getBinaryStream(int columnIndex) throws java.sql.SQLException { try { byte[] val = rmiResultSet_.getBinaryStream(columnIndex); if(val == null) return null; return new java.io.ByteArrayInputStream(val); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } //====================================================================== // Methods for accessing results by column name //====================================================================== /** * Get the value of a column in the current row as a Java String. * * @param columnName is the SQL name of the column * @return the column value; if the value is SQL NULL, the result is null */ public String getString(String columnName) throws java.sql.SQLException { try { return rmiResultSet_.getString(columnName); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a column in the current row as a Java boolean. * * @param columnName is the SQL name of the column * @return the column value; if the value is SQL NULL, the result is false */ public boolean getBoolean(String columnName) throws java.sql.SQLException { try { return rmiResultSet_.getBoolean(columnName); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a column in the current row as a Java byte. * * @param columnName is the SQL name of the column * @return the column value; if the value is SQL NULL, the result is 0 */ public byte getByte(String columnName) throws java.sql.SQLException { try { return rmiResultSet_.getByte(columnName); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a column in the current row as a Java short. * * @param columnName is the SQL name of the column * @return the column value; if the value is SQL NULL, the result is 0 */ public short getShort(String columnName) throws java.sql.SQLException { try { return rmiResultSet_.getShort(columnName); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a column in the current row as a Java int. * * @param columnName is the SQL name of the column * @return the column value; if the value is SQL NULL, the result is 0 */ public int getInt(String columnName) throws java.sql.SQLException { try { return rmiResultSet_.getInt(columnName); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a column in the current row as a Java long. * * @param columnName is the SQL name of the column * @return the column value; if the value is SQL NULL, the result is 0 */ public long getLong(String columnName) throws java.sql.SQLException { try { return rmiResultSet_.getLong(columnName); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a column in the current row as a Java float. * * @param columnName is the SQL name of the column * @return the column value; if the value is SQL NULL, the result is 0 */ public float getFloat(String columnName) throws java.sql.SQLException { try { return rmiResultSet_.getFloat(columnName); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a column in the current row as a Java double. * * @param columnName is the SQL name of the column * @return the column value; if the value is SQL NULL, the result is 0 */ public double getDouble(String columnName) throws java.sql.SQLException { try { return rmiResultSet_.getDouble(columnName); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a column in the current row as a java.lang.BigDecimal object. * * @param columnName is the SQL name of the column * @param scale the number of digits to the right of the decimal * @return the column value; if the value is SQL NULL, the result is null */ public BigDecimal getBigDecimal(String columnName, int scale) throws java.sql.SQLException { try { return rmiResultSet_.getBigDecimal(columnName, scale); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a column in the current row as a Java byte array. * The bytes represent the raw values returned by the driver. * * @param columnName is the SQL name of the column * @return the column value; if the value is SQL NULL, the result is null */ public byte[] getBytes(String columnName) throws java.sql.SQLException { try { return rmiResultSet_.getBytes(columnName); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a column in the current row as a java.sql.Date object. * * @param columnName is the SQL name of the column * @return the column value; if the value is SQL NULL, the result is null */ public java.sql.Date getDate(String columnName) throws java.sql.SQLException { try { return rmiResultSet_.getDate(columnName); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a column in the current row as a java.sql.Time object. * * @param columnName is the SQL name of the column * @return the column value; if the value is SQL NULL, the result is null */ public java.sql.Time getTime(String columnName) throws java.sql.SQLException { try { return rmiResultSet_.getTime(columnName); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the value of a column in the current row as a java.sql.Timestamp object. * * @param columnName is the SQL name of the column * @return the column value; if the value is SQL NULL, the result is null */ public java.sql.Timestamp getTimestamp(String columnName) throws java.sql.SQLException { try { return rmiResultSet_.getTimestamp(columnName); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * A column value can be retrieved as a stream of ASCII characters * and then read in chunks from the stream. This method is particularly * suitable for retrieving large LONGVARCHAR values. The JDBC driver will * do any necessary conversion from the database format into ASCII. * *

Note: All the data in the returned stream must * be read prior to getting the value of any other column. The * next call to a get method implicitly closes the stream. * * @param columnName is the SQL name of the column * @return a Java input stream that delivers the database column value * as a stream of one byte ASCII characters. If the value is SQL NULL * then the result is null. */ // TBD There's a hack there (InputStream not serializable) public java.io.InputStream getAsciiStream(String columnName) throws java.sql.SQLException { try { byte[] val = rmiResultSet_.getAsciiStream(columnName); if(val == null) return null; return new java.io.ByteArrayInputStream(val); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * A column value can be retrieved as a stream of Unicode characters * and then read in chunks from the stream. This method is particularly * suitable for retrieving large LONGVARCHAR values. The JDBC driver will * do any necessary conversion from the database format into Unicode. * *

Note: All the data in the returned stream must * be read prior to getting the value of any other column. The * next call to a get method implicitly closes the stream. * * @param columnName is the SQL name of the column * @return a Java input stream that delivers the database column value * as a stream of two byte Unicode characters. If the value is SQL NULL * then the result is null. */ // TBD There's a hack there (InputStream not serializable) public java.io.InputStream getUnicodeStream(String columnName) throws java.sql.SQLException { try { byte[] val = rmiResultSet_.getUnicodeStream(columnName); if(val == null) return null; return new java.io.ByteArrayInputStream(val); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * A column value can be retrieved as a stream of uninterpreted bytes * and then read in chunks from the stream. This method is particularly * suitable for retrieving large LONGVARBINARY values. * *

Note: All the data in the returned stream must * be read prior to getting the value of any other column. The * next call to a get method implicitly closes the stream. * * @param columnName is the SQL name of the column * @return a Java input stream that delivers the database column value * as a stream of uninterpreted bytes. If the value is SQL NULL * then the result is null. */ // TBD There's a hack there (InputStream not serializable) public java.io.InputStream getBinaryStream(String columnName) throws java.sql.SQLException { try { byte[] val = rmiResultSet_.getBinaryStream(columnName); if(val == null) return null; return new java.io.ByteArrayInputStream(val); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } //===================================================================== // Advanced features: //===================================================================== /** *

The first warning reported by calls on this ResultSet is * returned. Subsequent ResultSet warnings will be chained to this * SQLWarning. * *

The warning chain is automatically cleared each time a new * row is read. * *

Note: This warning chain only covers warnings caused * by ResultSet methods. Any warning caused by statement methods * (such as reading OUT parameters) will be chained on the * Statement object. * * @return the first SQLWarning or null */ public SQLWarning getWarnings() throws java.sql.SQLException { try { return rmiResultSet_.getWarnings(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * After this call getWarnings returns null until a new warning is * reported for this ResultSet. */ public void clearWarnings() throws java.sql.SQLException { try { rmiResultSet_.clearWarnings(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * Get the name of the SQL cursor used by this ResultSet. * *

In SQL, a result table is retrieved through a cursor that is * named. The current row of a result can be updated or deleted * using a positioned update/delete statement that references the * cursor name. * *

JDBC supports this SQL feature by providing the name of the * SQL cursor used by a ResultSet. The current row of a ResultSet * is also the current row of this SQL cursor. * *

Note: If positioned update is not supported a * java.sql.SQLException is thrown * * @return the ResultSet's SQL cursor name */ public String getCursorName() throws java.sql.SQLException { try { return rmiResultSet_.getCursorName(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** * The number, types and properties of a ResultSet's columns * are provided by the getMetaData method. * * @return the description of a ResultSet's columns */ public java.sql.ResultSetMetaData getMetaData() throws java.sql.SQLException { try { return new RJResultSetMetaData(rmiResultSet_.getMetaData()); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** *

Get the value of a column in the current row as a Java object. * *

This method will return the value of the given column as a * Java object. The type of the Java object will be the default * Java Object type corresponding to the column's SQL type, * following the mapping specified in the JDBC spec. * *

This method may also be used to read datatabase specific abstract * data types. * * @param columnIndex the first column is 1, the second is 2, ... * @return A java.lang.Object holding the column value. */ public Object getObject(int columnIndex) throws java.sql.SQLException { try { return rmiResultSet_.getObject(columnIndex); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } /** *

Get the value of a column in the current row as a Java object. * *

This method will return the value of the given column as a * Java object. The type of the Java object will be the default * Java Object type corresponding to the column's SQL type, * following the mapping specified in the JDBC spec. * *

This method may also be used to read datatabase specific abstract * data types. * * @param columnName is the SQL name of the column * @return A java.lang.Object holding the column value. */ public Object getObject(String columnName) throws java.sql.SQLException { try { return rmiResultSet_.getObject(columnName); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } //---------------------------------------------------------------- /** * Map a Resultset column name to a ResultSet column index. * * @param columnName the name of the column * @return the column index */ public int findColumn(String columnName) throws java.sql.SQLException { try { return rmiResultSet_.findColumn(columnName); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } // JDBC 2.0 methods // added by Mike Jennings sometime in the // summer of 1999 // remove comments to compile for JDBC 2.0 // Implementation added Aug 2000 by Peter Hearty (peter.hearty@lutris.com). public void updateTimestamp(String columnName, Timestamp x) throws SQLException { try { rmiResultSet_.updateTimestamp(columnName,x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateTimestamp(int columnIndex,Timestamp x) throws SQLException { try { rmiResultSet_.updateTimestamp(columnIndex,x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateTime(String columnName,Time x) throws SQLException { try { rmiResultSet_.updateTime(columnName,x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateTime(int columnIndex, Time x) throws SQLException { try { rmiResultSet_.updateTime(columnIndex,x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateString(String columnName, String x) throws SQLException { try { rmiResultSet_.updateString(columnName,x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateString(int columnIndex, String x) throws SQLException { try { rmiResultSet_.updateString(columnIndex,x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateShort(int columnIndex, short x) throws SQLException { try { rmiResultSet_.updateShort(columnIndex,x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateShort(String columnName, short x) throws SQLException { try { rmiResultSet_.updateShort(columnName,x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateRow() throws SQLException { try { rmiResultSet_.updateRow(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateObject(String columnName, Object x, int scale) throws SQLException { try { rmiResultSet_.updateObject(columnName,x,scale); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateObject(String columnName, Object x) throws SQLException { try { rmiResultSet_.updateObject(columnName,x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateObject(int columnIndex, Object x, int scale) throws SQLException { try { rmiResultSet_.updateObject(columnIndex,x,scale); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateObject(int columnIndex, Object x) throws SQLException { try { rmiResultSet_.updateObject(columnIndex,x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateNull(String columnName) throws SQLException { try { rmiResultSet_.updateNull(columnName); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateNull(int columnIndex) throws SQLException { try { rmiResultSet_.updateNull(columnIndex); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateLong(String columnName, long x) throws SQLException { try { rmiResultSet_.updateLong(columnName,x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateLong(int columnIndex, long x) throws SQLException { try { rmiResultSet_.updateLong(columnIndex,x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateInt(String columnName, int x) throws SQLException { try { rmiResultSet_.updateInt(columnName,x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateInt(int columnIndex, int x) throws SQLException { try { rmiResultSet_.updateInt(columnIndex,x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateFloat(String columnName, float x) throws SQLException { try { rmiResultSet_.updateFloat(columnName,x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateFloat(int columnIndex, float x) throws SQLException { try { rmiResultSet_.updateFloat(columnIndex,x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateDouble(String columnName, double x) throws SQLException { try { rmiResultSet_.updateDouble(columnName,x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateDouble(int columnIndex, double x) throws SQLException { try { rmiResultSet_.updateDouble(columnIndex,x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateDate(String columnName, Date x) throws SQLException { try { rmiResultSet_.updateDate(columnName,x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateDate(int columnIndex, Date x) throws SQLException { try { rmiResultSet_.updateDate(columnIndex,x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateCharacterStream(String columnName, java.io.Reader reader, int length) throws SQLException { try { rmiResultSet_.updateCharacterStream(columnName,reader,length); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateCharacterStream(int columnIndex, java.io.Reader x, int length) throws SQLException { try { rmiResultSet_.updateCharacterStream(columnIndex,x,length); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateBytes(String columnName, byte[] x) throws SQLException { try { rmiResultSet_.updateBytes(columnName,x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateBytes(int columnIndex, byte[] x) throws SQLException { try { rmiResultSet_.updateBytes(columnIndex,x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateByte(String columnName, byte x) throws SQLException { try { rmiResultSet_.updateByte(columnName,x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateByte(int columnIndex, byte x) throws SQLException { try { rmiResultSet_.updateByte(columnIndex,x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateBoolean(String columnName, boolean x) throws SQLException { try { rmiResultSet_.updateBoolean(columnName,x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateBoolean(int columnIndex, boolean x) throws SQLException { try { rmiResultSet_.updateBoolean(columnIndex,x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateBinaryStream(String columnName, java.io.InputStream x, int length) throws SQLException { try { rmiResultSet_.updateBinaryStream(columnName,x,length); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateBinaryStream(int columnIndex, java.io.InputStream x, int length) throws SQLException { try { rmiResultSet_.updateBinaryStream(columnIndex,x,length); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateBigDecimal(String columnName, BigDecimal x) throws SQLException { try { rmiResultSet_.updateBigDecimal(columnName,x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException { try { rmiResultSet_.updateBigDecimal(columnIndex,x); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateAsciiStream(String columnName, java.io.InputStream x, int length) throws SQLException { try { rmiResultSet_.updateAsciiStream(columnName,x,length); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void updateAsciiStream(int columnIndex, java.io.InputStream x, int length) throws SQLException { try { rmiResultSet_.updateAsciiStream(columnIndex,x,length); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void setFetchSize(int rows) throws SQLException { try { rmiResultSet_.setFetchSize(rows); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void setFetchDirection(int direction) throws SQLException { try { rmiResultSet_.setFetchDirection(direction); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public boolean rowUpdated() throws SQLException { try { return rmiResultSet_.rowUpdated(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public boolean rowInserted() throws SQLException { try { return rmiResultSet_.rowInserted(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public boolean rowDeleted() throws SQLException { try { return rmiResultSet_.rowDeleted(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public boolean relative(int rows) throws SQLException { try { return rmiResultSet_.relative(rows); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void refreshRow() throws SQLException { try { rmiResultSet_.refreshRow(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public boolean previous() throws SQLException { try { return rmiResultSet_.previous(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void moveToInsertRow() throws SQLException { try { rmiResultSet_.moveToInsertRow(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void moveToCurrentRow() throws SQLException { try { rmiResultSet_.moveToCurrentRow(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public boolean last() throws SQLException { try { return rmiResultSet_.last(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public boolean isLast() throws SQLException { try { return rmiResultSet_.isLast(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public boolean isFirst() throws SQLException { try { return rmiResultSet_.isFirst(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public boolean isBeforeFirst() throws SQLException { try { return rmiResultSet_.isBeforeFirst(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public boolean isAfterLast() throws SQLException { try { return rmiResultSet_.isAfterLast(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void insertRow() throws SQLException { try { rmiResultSet_.insertRow(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public int getType() throws SQLException { try { return rmiResultSet_.getType(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public Timestamp getTimestamp(String columnName, java.util.Calendar cal) throws SQLException { try { return rmiResultSet_.getTimestamp(columnName,cal); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public Timestamp getTimestamp(int columnIndex, java.util.Calendar cal) throws SQLException { try { return rmiResultSet_.getTimestamp(columnIndex,cal); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public Time getTime(String columnName, java.util.Calendar cal) throws SQLException { try { return rmiResultSet_.getTime(columnName,cal); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public Time getTime(int columnIndex, java.util.Calendar cal) throws SQLException { try { return rmiResultSet_.getTime(columnIndex,cal); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public Statement getStatement() throws SQLException { try { return new RJStatement(rmiResultSet_.getStatement()); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public Ref getRef(String colName) throws SQLException { try { return new RJRef(rmiResultSet_.getRef(colName)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public Ref getRef(int i) throws SQLException { try { return new RJRef(rmiResultSet_.getRef(i)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public Object getObject(String colName, java.util.Map map) throws SQLException { try { return rmiResultSet_.getObject(colName,map); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public Object getObject(int i, java.util.Map map) throws SQLException { try { return rmiResultSet_.getObject(i,map) ; } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public int getFetchSize() throws SQLException { try { return rmiResultSet_.getFetchSize(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public int getFetchDirection() throws SQLException { try { return rmiResultSet_.getFetchDirection(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public Date getDate(String columnName, java.util.Calendar cal) throws SQLException { try { return rmiResultSet_.getDate(columnName,cal); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public Date getDate(int columnIndex, java.util.Calendar cal) throws SQLException { try { return rmiResultSet_.getDate(columnIndex,cal); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public int getConcurrency() throws SQLException { try { return rmiResultSet_.getConcurrency(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public Clob getClob(String colName) throws SQLException { try { return new RJClob(rmiResultSet_.getClob(colName)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public Clob getClob(int i) throws SQLException { try { return new RJClob(rmiResultSet_.getClob(i)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public java.io.Reader getCharacterStream(String columnName) throws SQLException { try { return rmiResultSet_.getCharacterStream(columnName); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public java.io.Reader getCharacterStream(int columnIndex) throws SQLException { try { return rmiResultSet_.getCharacterStream(columnIndex); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public Blob getBlob(String colName) throws SQLException { try { return new RJBlob(rmiResultSet_.getBlob(colName)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public Blob getBlob(int i) throws SQLException { try { return new RJBlob(rmiResultSet_.getBlob(i)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public BigDecimal getBigDecimal(String columnName) throws SQLException { try { return rmiResultSet_.getBigDecimal(columnName); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public BigDecimal getBigDecimal(int columnIndex) throws SQLException { try { return rmiResultSet_.getBigDecimal(columnIndex); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public Array getArray(String colName) throws SQLException { try { return new RJArray(rmiResultSet_.getArray(colName)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public Array getArray(int i) throws SQLException { try { return new RJArray(rmiResultSet_.getArray(i)); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public boolean first() throws SQLException { try { return rmiResultSet_.first(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void cancelRowUpdates() throws SQLException { try { rmiResultSet_.cancelRowUpdates(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void deleteRow() throws SQLException { try { rmiResultSet_.deleteRow(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void beforeFirst() throws SQLException { try { rmiResultSet_.beforeFirst(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public void afterLast() throws SQLException { try { rmiResultSet_.afterLast(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public boolean absolute(int row) throws SQLException { try { return rmiResultSet_.absolute(row); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } public int getRow() throws SQLException { try { return rmiResultSet_.getRow(); } catch(RemoteException e) { throw new java.sql.SQLException(e.getMessage()); } } }; PK Ni+=o'o'RJResultSetInterface.java /** * RmiJdbc client/server JDBC Driver * (C) GIE Dyade (Groupe BULL / INRIA Research Center) 1997 * (C) ExperLog 1999-2000 * * @version 1.0 * @author Pierre-Yves Gibello (pierreyves.gibello@experlog.com) */ package RmiJdbc; import java.math.BigDecimal; import java.util.Calendar; import java.sql.*; import java.rmi.*; // TBD: WARNING This file contains a hack for InputStream class... // InputStream is not serializable, of course ! // The right way would be to encapsulate InputStream in a RMI remote object // (hope I'll find time to do that) /** *

A ResultSet provides access to a table of data generated by * executing a Statement. The table rows are retrieved in * sequence. Within a row its column values can be accessed in any * order. * *

A ResultSet maintains a cursor pointing to its current row of * data. Initially the cursor is positioned before the first row. * The 'next' method moves the cursor to the next row. * *

The getXXX methods retrieve column values for the current * row. You can retrieve values either using the index number of the * column, or by using the name of the column. In general using the * column index will be more efficient. Columns are numbered from 1. * *

For maximum portability, ResultSet columns within each row should be * read in left-to-right order and each column should be read only once. * *

For the getXXX methods, the JDBC driver attempts to convert the * underlying data to the specified Java type and returns a suitable * Java value. See the JDBC specification for allowable mappings * from SQL types to Java types with the ResultSet.getXXX methods. * *

Column names used as input to getXXX methods are case insensitive. * When performing a getXXX using a column name, if several columns have * the same name, then the value of the first matching column will be * returned. * *

A ResultSet is automatically closed by the Statement that * generated it when that Statement is closed, re-executed, or is used * to retrieve the next result from a sequence of multiple results. * *

The number, types and properties of a ResultSet's columns are * provided by the ResulSetMetaData object returned by the getMetaData * method. * * @see Statement#executeQuery * @see Statement#getResultSet * @see ResultSetMetaData */ public interface RJResultSetInterface extends java.rmi.Remote { /** * A ResultSet is initially positioned before its first row; the * first call to next makes the first row the current row; the * second call makes the second row the current row, etc. * *

If an input stream from the previous row is open, it is * implicitly closed. The ResultSet's warning chain is cleared * when a new row is read. * * @return true if the new current row is valid; false if there * are no more rows */ boolean next() throws java.rmi.RemoteException, SQLException; /** * In some cases, it is desirable to immediately release a * ResultSet's database and JDBC resources instead of waiting for * this to happen when it is automatically closed; the close * method provides this immediate release. * *

Note: A ResultSet is automatically closed by the * Statement that generated it when that Statement is closed, * re-executed, or is used to retrieve the next result from a * sequence of multiple results. A ResultSet is also automatically * closed when it is garbage collected. */ void close() throws java.rmi.RemoteException, SQLException; /** * A column may have the value of SQL NULL; wasNull reports whether * the last column read had this special value. * Note that you must first call getXXX on a column to try to read * its value and then call wasNull() to find if the value was * the SQL NULL. * * @return true if last column read was SQL NULL */ boolean wasNull() throws java.rmi.RemoteException, SQLException; //====================================================================== // Methods for accessing results by column index //====================================================================== /** * Get the value of a column in the current row as a Java String. * * @param columnIndex the first column is 1, the second is 2, ... * @return the column value; if the value is SQL NULL, the result is null */ String getString(int columnIndex) throws java.rmi.RemoteException, SQLException; /** * Get the value of a column in the current row as a Java boolean. * * @param columnIndex the first column is 1, the second is 2, ... * @return the column value; if the value is SQL NULL, the result is false */ boolean getBoolean(int columnIndex) throws java.rmi.RemoteException, SQLException; /** * Get the value of a column in the current row as a Java byte. * * @param columnIndex the first column is 1, the second is 2, ... * @return the column value; if the value is SQL NULL, the result is 0 */ byte getByte(int columnIndex) throws java.rmi.RemoteException, SQLException; /** * Get the value of a column in the current row as a Java short. * * @param columnIndex the first column is 1, the second is 2, ... * @return the column value; if the value is SQL NULL, the result is 0 */ short getShort(int columnIndex) throws java.rmi.RemoteException, SQLException; /** * Get the value of a column in the current row as a Java int. * * @param columnIndex the first column is 1, the second is 2, ... * @return the column value; if the value is SQL NULL, the result is 0 */ int getInt(int columnIndex) throws java.rmi.RemoteException, SQLException; /** * Get the value of a column in the current row as a Java long. * * @param columnIndex the first column is 1, the second is 2, ... * @return the column value; if the value is SQL NULL, the result is 0 */ long getLong(int columnIndex) throws java.rmi.RemoteException, SQLException; /** * Get the value of a column in the current row as a Java float. * * @param columnIndex the first column is 1, the second is 2, ... * @return the column value; if the value is SQL NULL, the result is 0 */ float getFloat(int columnIndex) throws java.rmi.RemoteException, SQLException; /** * Get the value of a column in the current row as a Java double. * * @param columnIndex the first column is 1, the second is 2, ... * @return the column value; if the value is SQL NULL, the result is 0 */ double getDouble(int columnIndex) throws java.rmi.RemoteException, SQLException; /** * Get the value of a column in the current row as a java.lang.BigDecimal object. * * @param columnIndex the first column is 1, the second is 2, ... * @param scale the number of digits to the right of the decimal * @return the column value; if the value is SQL NULL, the result is null */ BigDecimal getBigDecimal(int columnIndex, int scale) throws java.rmi.RemoteException, SQLException; /** * Get the value of a column in the current row as a Java byte array. * The bytes represent the raw values returned by the driver. * * @param columnIndex the first column is 1, the second is 2, ... * @return the column value; if the value is SQL NULL, the result is null */ byte[] getBytes(int columnIndex) throws java.rmi.RemoteException, SQLException; /** * Get the value of a column in the current row as a java.sql.Date object. * * @param columnIndex the first column is 1, the second is 2, ... * @return the column value; if the value is SQL NULL, the result is null */ java.sql.Date getDate(int columnIndex) throws java.rmi.RemoteException, SQLException; /** * Get the value of a column in the current row as a java.sql.Time object. * * @param columnIndex the first column is 1, the second is 2, ... * @return the column value; if the value is SQL NULL, the result is null */ java.sql.Time getTime(int columnIndex) throws java.rmi.RemoteException, SQLException; /** * Get the value of a column in the current row as a java.sql.Timestamp object. * * @param columnIndex the first column is 1, the second is 2, ... * @return the column value; if the value is SQL NULL, the result is null */ java.sql.Timestamp getTimestamp(int columnIndex) throws java.rmi.RemoteException, SQLException; /** * A column value can be retrieved as a stream of ASCII characters * and then read in chunks from the stream. This method is particularly * suitable for retrieving large LONGVARCHAR values. The JDBC driver will * do any necessary conversion from the database format into ASCII. * *

Note: All the data in the returned stream must be * read prior to getting the value of any other column. The next * call to a get method implicitly closes the stream. . Also, a * stream may return 0 for available() whether there is data * available or not. * * @param columnIndex the first column is 1, the second is 2, ... * @return a Java input stream that delivers the database column value * as a stream of one byte ASCII characters. If the value is SQL NULL * then the result is null. */ // java.io.InputStream getAsciiStream(int columnIndex) // TBD This is a hack (InputStream not serializable) byte[] getAsciiStream(int columnIndex) throws java.rmi.RemoteException, SQLException; /** * A column value can be retrieved as a stream of Unicode characters * and then read in chunks from the stream. This method is particularly * suitable for retrieving large LONGVARCHAR values. The JDBC driver will * do any necessary conversion from the database format into Unicode. * *

Note: All the data in the returned stream must be * read prior to getting the value of any other column. The next * call to a get method implicitly closes the stream. . Also, a * stream may return 0 for available() whether there is data * available or not. * * @param columnIndex the first column is 1, the second is 2, ... * @return a Java input stream that delivers the database column value * as a stream of two byte Unicode characters. If the value is SQL NULL * then the result is null. */ // java.io.InputStream getUnicodeStream(int columnIndex) // TBD This is a hack (InputStream not serializable) byte[] getUnicodeStream(int columnIndex) throws java.rmi.RemoteException, SQLException; /** * A column value can be retrieved as a stream of uninterpreted bytes * and then read in chunks from the stream. This method is particularly * suitable for retrieving large LONGVARBINARY values. * *

Note: All the data in the returned stream must be * read prior to getting the value of any other column. The next * call to a get method implicitly closes the stream. Also, a * stream may return 0 for available() whether there is data * available or not. * * @param columnIndex the first column is 1, the second is 2, ... * @return a Java input stream that delivers the database column value * as a stream of uninterpreted bytes. If the value is SQL NULL * then the result is null. */ // java.io.InputStream getBinaryStream(int columnIndex) // TBD This is a hack (InputStream not serializable) byte[] getBinaryStream(int columnIndex) throws java.rmi.RemoteException, SQLException; //====================================================================== // Methods for accessing results by column name //====================================================================== /** * Get the value of a column in the current row as a Java String. * * @param columnName is the SQL name of the column * @return the column value; if the value is SQL NULL, the result is null */ String getString(String columnName) throws java.rmi.RemoteException, SQLException; /** * Get the value of a column in the current row as a Java boolean. * * @param columnName is the SQL name of the column * @return the column value; if the value is SQL NULL, the result is false */ boolean getBoolean(String columnName) throws java.rmi.RemoteException, SQLException; /** * Get the value of a column in the current row as a Java byte. * * @param columnName is the SQL name of the column * @return the column value; if the value is SQL NULL, the result is 0 */ byte getByte(String columnName) throws java.rmi.RemoteException, SQLException; /** * Get the value of a column in the current row as a Java short. * * @param columnName is the SQL name of the column * @return the column value; if the value is SQL NULL, the result is 0 */ short getShort(String columnName) throws java.rmi.RemoteException, SQLException; /** * Get the value of a column in the current row as a Java int. * * @param columnName is the SQL name of the column * @return the column value; if the value is SQL NULL, the result is 0 */ int getInt(String columnName) throws java.rmi.RemoteException, SQLException; /** * Get the value of a column in the current row as a Java long. * * @param columnName is the SQL name of the column * @return the column value; if the value is SQL NULL, the result is 0 */ long getLong(String columnName) throws java.rmi.RemoteException, SQLException; /** * Get the value of a column in the current row as a Java float. * * @param columnName is the SQL name of the column * @return the column value; if the value is SQL NULL, the result is 0 */ float getFloat(String columnName) throws java.rmi.RemoteException, SQLException; /** * Get the value of a column in the current row as a Java double. * * @param columnName is the SQL name of the column * @return the column value; if the value is SQL NULL, the result is 0 */ double getDouble(String columnName) throws java.rmi.RemoteException, SQLException; /** * Get the value of a column in the current row as a java.lang.BigDecimal object. * * @param columnName is the SQL name of the column * @param scale the number of digits to the right of the decimal * @return the column value; if the value is SQL NULL, the result is null */ BigDecimal getBigDecimal(String columnName, int scale) throws java.rmi.RemoteException, SQLException; /** * Get the value of a column in the current row as a Java byte array. * The bytes represent the raw values returned by the driver. * * @param columnName is the SQL name of the column * @return the column value; if the value is SQL NULL, the result is null */ byte[] getBytes(String columnName) throws java.rmi.RemoteException, SQLException; /** * Get the value of a column in the current row as a java.sql.Date object. * * @param columnName is the SQL name of the column * @return the column value; if the value is SQL NULL, the result is null */ java.sql.Date getDate(String columnName) throws java.rmi.RemoteException, SQLException; /** * Get the value of a column in the current row as a java.sql.Time object. * * @param columnName is the SQL name of the column * @return the column value; if the value is SQL NULL, the result is null */ java.sql.Time getTime(String columnName) throws java.rmi.RemoteException, SQLException; /** * Get the value of a column in the current row as a java.sql.Timestamp object. * * @param columnName is the SQL name of the column * @return the column value; if the value is SQL NULL, the result is null */ java.sql.Timestamp getTimestamp(String columnName) throws java.rmi.RemoteException, SQLException; /** * A column value can be retrieved as a stream of ASCII characters * and then read in chunks from the stream. This method is particularly * suitable for retrieving large LONGVARCHAR values. The JDBC driver will * do any necessary conversion from the database format into ASCII. * *

Note: All the data in the returned stream must * be read prior to getting the value of any other column. The * next call to a get method implicitly closes the stream. * * @param columnName is the SQL name of the column * @return a Java input stream that delivers the database column value * as a stream of one byte ASCII characters. If the value is SQL NULL * then the result is null. */ // java.io.InputStream getAsciiStream(String columnName) // TBD This is a hack (InputStream not serializable) byte[] getAsciiStream(String columnName) throws java.rmi.RemoteException, SQLException; /** * A column value can be retrieved as a stream of Unicode characters * and then read in chunks from the stream. This method is particularly * suitable for retrieving large LONGVARCHAR values. The JDBC driver will * do any necessary conversion from the database format into Unicode. * *

Note: All the data in the returned stream must * be read prior to getting the value of any other column. The * next call to a get method implicitly closes the stream. * * @param columnName is the SQL name of the column * @return a Java input stream that delivers the database column value * as a stream of two byte Unicode characters. If the value is SQL NULL * then the result is null. */ // java.io.InputStream getUnicodeStream(String columnName) // TBD This is a hack (InputStream not serializable) byte[] getUnicodeStream(String columnName) throws java.rmi.RemoteException, SQLException; /** * A column value can be retrieved as a stream of uninterpreted bytes * and then read in chunks from the stream. This method is particularly * suitable for retrieving large LONGVARBINARY values. * *

Note: All the data in the returned stream must * be read prior to getting the value of any other column. The * next call to a get method implicitly closes the stream. * * @param columnName is the SQL name of the column * @return a Java input stream that delivers the database column value * as a stream of uninterpreted bytes. If the value is SQL NULL * then the result is null. */ // java.io.InputStream getBinaryStream(String columnName) // TBD This is a hack (InputStream not serializable) byte[] getBinaryStream(String columnName) throws java.rmi.RemoteException, SQLException; //===================================================================== // Advanced features: //===================================================================== /** *

The first warning reported by calls on this ResultSet is * returned. Subsequent ResultSet warnings will be chained to this * SQLWarning. * *

The warning chain is automatically cleared each time a new * row is read. * *

Note: This warning chain only covers warnings caused * by ResultSet methods. Any warning caused by statement methods * (such as reading OUT parameters) will be chained on the * Statement object. * * @return the first SQLWarning or null */ SQLWarning getWarnings() throws java.rmi.RemoteException, SQLException; /** * After this call getWarnings returns null until a new warning is * reported for this ResultSet. */ void clearWarnings() throws java.rmi.RemoteException, SQLException; /** * Get the name of the SQL cursor used by this ResultSet. * *

In SQL, a result table is retrieved through a cursor that is * named. The current row of a result can be updated or deleted * using a positioned update/delete statement that references the * cursor name. * *

JDBC supports this SQL feature by providing the name of the * SQL cursor used by a ResultSet. The current row of a ResultSet * is also the current row of this SQL cursor. * *

Note: If positioned update is not supported a * SQLException is thrown * * @return the ResultSet's SQL cursor name */ String getCursorName() throws java.rmi.RemoteException, SQLException; /** * The number, types and properties of a ResultSet's columns * are provided by the getMetaData method. * * @return the description of a ResultSet's columns */ RJResultSetMetaDataInterface getMetaData() throws java.rmi.RemoteException, SQLException; /** *

Get the value of a column in the current row as a Java object. * *

This method will return the value of the given column as a * Java object. T