DB2 Java stored procedures privileges

DB2 Java stored procedures privileges

Post by David Simo » Wed, 20 Nov 2002 21:17:57



Hello,

I have created a Java stored procedure that executes a select and update
statement in the procedure owner schema. It works all fine when client
program connects as owner schema to execute the procedure, but it fails in
select statement when I try it connecting using a different schema. The
procedure begins execution but ceases at select. Documentation says Grant
has no effect in such procedures, what can I do?

My environment is DB2 6.1 for AIX.

Than you so much.

Here are the CREATE PROCEDURE statement and Java stored procedure code (it
works when Java client connects using SCHEMA1, but not using SCHEMA2):

CREATE PROCEDURE SCHEMA1.testProc (IN column char(2),OUT result
varchar(1000)) LANGUAGE JAVA MODIFIES SQL DATA PARAMETER STYLE JAVA NOT
FENCED EXTERNAL NAME 'TestProc.testGrant'

public static void testGrant(String column, String[] result) throws
java.sql.SQLException {

String dn = null;
String uid = null;
Connection con = null;
try {
con = DriverManager.getConnection("jdbc:default:connection");
ResultSet rs = null;
Statement stmt = con.createStatement();
rs = stmt.executeQuery("SELECT " + column +" FROM SCHEMA1.testP");

int numReg = 0;
int numMax = 0;
int iNum = 0;
int iMax = 0;
while (rs.next()) {
iNum = (int)rs.getInt(1);
iNum++;

Quote:}

stmt.close();

stmt = con.createStatement();
stmt.executeUpdate("UPDATE SCHEMA1.testP SET A = " + iNum);
stmt.close();
con.commit();
result[0]= "OK";

con.close();

return;

Quote:}

catch (Exception e)
{
result[0]="Error: "+e.getMessage();
Quote:}

finally {
try {
con.close();
Quote:}

catch (Exception e2) {
Quote:}
return;
}
}

 
 
 

1. Calling a Java Stored Procedure from another Java Stored Stored Procedure

Hi,
I'm using the stored procedure builder of DB2 UDB v6.1 on NT to create a
Java Stored Procedure to call another Java Stored Procedure. Both of
them belong to the same project in stored procedure builder.
The sp that calls another sp has the code as follows:
// Calling another java sp -- ErrorHandler
ErrorHandler err = new ErrorHandler();
err.execute("Test #1", 100, "Testing #1");
When I want to build the sp which calls another sp from within, it gave
me an error as follows:
C:\IBMVJava\ide\tools\com-ibm-db2-tools-dev-spb-ivj\spb\bld953747549650\
com\intertrac\datamart\sp\SelectBillShipAddr.java:18: Class
com.intertrac.datamart.sp.ErrorHandler not found in type declaration.
ErrorHandler err = new ErrorHandler();
Does anyone have any clue of how this can be properly done ? Please let
me know.
Thanks,
ra

Sent via Deja.com http://www.deja.com/
Before you buy.

2. value function in SQL does not work

3. Gettting SQL0751N trying to call java stored procedure from a java stored procedure

4. Permissions Surrounding "sp_OAxxx " Extended SPs

5. ---JAVA-----JAVA-----JAVA-----JAVA-----JAVA-----JAVA-----JAVA-----JAVA---

6. a quick question

7. DB2 - Global Stored Procedure in Stored Procedures

8. Good front-end GUI for Sybase?

9. Stored procedures problem using DB2 Stored Procedure Builder

10. Calling Java Stored Procedure from SQL Stored Procedure

11. DB2 java stored procedure

12. DB2 Java Stored procedures

13. SQLJ Java Stored Procedures with DB2 6 on OS/390