01: /**
02: * com.mckoi.database.ProcedureConnection 06 Mar 2003
03: *
04: * Mckoi SQL Database ( http://www.mckoi.com/database )
05: * Copyright (C) 2000, 2001, 2002 Diehl and Associates, Inc.
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License
09: * 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: */package com.mckoi.database;
24:
25: import java.sql.Connection;
26:
27: /**
28: * An interface for accessing a database connection inside a stored procedure.
29: *
30: * @author Tobias Downer
31: */
32:
33: public interface ProcedureConnection {
34:
35: /**
36: * Returns a JDBC Connection implementation for executing queries on this
37: * connection. The Connection has auto-commit turned off, and it
38: * disables the ability for the connection to 'commit' changes to the
39: * database.
40: * <p>
41: * This method is intended to provide the procedure developer with a
42: * convenient and consistent way to query and manipulate the database from
43: * the body of a stored procedure method.
44: * <p>
45: * The java.sql.Connection object returned here may invalidate when the
46: * procedure invokation call ends so the returned object must not be cached
47: * to be used again later.
48: * <p>
49: * The returned java.sql.Connection object is NOT thread safe and should
50: * only be used by a single thread. Accessing this connection from multiple
51: * threads will result in undefined behaviour.
52: * <p>
53: * The Connection object returned here has the same privs as the user who
54: * owns the stored procedure.
55: */
56: Connection getJDBCConnection();
57:
58: /**
59: * Returns the Database object for this database providing access to various
60: * general database features including backing up replication and
61: * configuration. Some procedures may not be allowed access to this object
62: * in which case a ProcedureException is thrown notifying of the security
63: * violation.
64: */
65: Database getDatabase();
66:
67: }
|