Index: Connection.java =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Connection.java,v retrieving revision 1.18 diff -c -r1.18 Connection.java *** Connection.java 2001/07/15 04:21:26 1.18 --- Connection.java 2001/07/19 19:44:06 *************** *** 887,892 **** --- 887,922 ---- public abstract void close() throws 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 + * + * @exception SQLException if a database access error occurs + */ + public void setCatalog(String catalog) throws SQLException + { + if(catalog!=null && !catalog.equals(PG_DATABASE)) { + close(); + Properties info=new Properties(); + info.setProperty("user", PG_USER); + info.setProperty("password", PG_PASSWORD); + openConnection(PG_HOST, PG_PORT, info, catalog, this_url, this_driver); + } + } + + /** + * Return the connections current catalog name, or null if no + * catalog name is set, or we dont support catalogs. + * + * @return the current catalog name or null + * @exception SQLException if a database access error occurs + */ + public String getCatalog() throws SQLException + { + return PG_DATABASE; + } + + /** * Overides finalize(). If called, it closes the connection. * * This was done at the request of Rachel Greenham Index: jdbc1/Connection.java =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Connection.java,v retrieving revision 1.5 diff -c -r1.5 Connection.java *** jdbc1/Connection.java 2001/01/18 17:37:13 1.5 --- jdbc1/Connection.java 2001/07/19 19:44:08 *************** *** 273,302 **** } /** - * 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 - * - * @exception SQLException if a database access error occurs - */ - public void setCatalog(String catalog) throws SQLException - { - // No-op - } - - /** - * Return the connections current catalog name, or null if no - * catalog name is set, or we dont support catalogs. - * - * @return the current catalog name or null - * @exception SQLException if a database access error occurs - */ - public String getCatalog() throws SQLException - { - return null; - } - - /** * You can call this method to try to change the transaction * isolation level using one of the TRANSACTION_* values. * --- 273,278 ---- Index: jdbc2/Connection.java =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Connection.java,v retrieving revision 1.7 diff -c -r1.7 Connection.java *** jdbc2/Connection.java 2001/02/13 16:39:02 1.7 --- jdbc2/Connection.java 2001/07/19 19:44:11 *************** *** 356,385 **** } /** - * 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 - * - * @exception SQLException if a database access error occurs - */ - public void setCatalog(String catalog) throws SQLException - { - // No-op - } - - /** - * Return the connections current catalog name, or null if no - * catalog name is set, or we dont support catalogs. - * - * @return the current catalog name or null - * @exception SQLException if a database access error occurs - */ - public String getCatalog() throws SQLException - { - return null; - } - - /** * You can call this method to try to change the transaction * isolation level using one of the TRANSACTION_* values. * --- 356,361 ----