1 /** 2 * com.mckoi.database.ProcedureConnection 06 Mar 2003 3 * 4 * Mckoi SQL Database ( http://www.mckoi.com/database ) 5 * Copyright (C) 2000, 2001, 2002 Diehl and Associates, Inc. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * Version 2 as published by the Free Software Foundation. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License Version 2 for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * Version 2 along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 * 20 * Change Log: 21 * 22 * 23 */ 24 25 package com.mckoi.database; 26 27 import java.sql.Connection; 28 29 /** 30 * An interface for accessing a database connection inside a stored procedure. 31 * 32 * @author Tobias Downer 33 */ 34 35 public interface ProcedureConnection { 36 37 /** 38 * Returns a JDBC Connection implementation for executing queries on this 39 * connection. The Connection has auto-commit turned off, and it 40 * disables the ability for the connection to 'commit' changes to the 41 * database. 42 * <p> 43 * This method is intended to provide the procedure developer with a 44 * convenient and consistent way to query and manipulate the database from 45 * the body of a stored procedure method. 46 * <p> 47 * The java.sql.Connection object returned here may invalidate when the 48 * procedure invokation call ends so the returned object must not be cached 49 * to be used again later. 50 * <p> 51 * The returned java.sql.Connection object is NOT thread safe and should 52 * only be used by a single thread. Accessing this connection from multiple 53 * threads will result in undefined behaviour. 54 * <p> 55 * The Connection object returned here has the same privs as the user who 56 * owns the stored procedure. 57 */ 58 Connection getJDBCConnection(); 59 60 /** 61 * Returns the Database object for this database providing access to various 62 * general database features including backing up replication and 63 * configuration. Some procedures may not be allowed access to this object 64 * in which case a ProcedureException is thrown notifying of the security 65 * violation. 66 */ 67 Database getDatabase(); 68 69 } 70 71