473,398 Members | 2,403 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Describe non-table objects

Hi all,

How do I describe non-table objects, like UDF functions and
procedures, using db2's normal command line interface?

Database server = DB2/LINUX 9.1.0 Express-C running on Linux 2.6
Intel-32.

Regards,
Serman D.
--

Feb 19 '07 #1
12 4112
On Feb 19, 7:35 pm, "Serman D." <serma...@hotmail.comwrote:
Hi all,

How do I describe non-table objects, like UDF functions and
procedures, using db2's normal command line interface?

Database server = DB2/LINUX 9.1.0 Express-C running on Linux 2.6
Intel-32.

Regards,
Serman D.
--
select body from syscat.functions where (funcschema, funcname) = (?,?)

select text fropm syscat.procedures where (procschema, procname) =
(?,?)

HTH
/Lennart

Feb 19 '07 #2
Lennart wrote:
On Feb 19, 7:35 pm, "Serman D." <serma...@hotmail.comwrote:
>Hi all,

How do I describe non-table objects, like UDF functions and
procedures, using db2's normal command line interface?

Database server = DB2/LINUX 9.1.0 Express-C running on Linux 2.6
Intel-32.

select body from syscat.functions where (funcschema, funcname) = (?,?)

select text fropm syscat.procedures where (procschema, procname) =
(?,?)
Actually, SYSCAT.FUNCTIONS and SYSCAT.PROCEDURES are both outdated and
should not be used any longer. Instead, refer to SYSCAT.ROUTINES:

SELECT text
FROM syscat.routines
WHERE ( routine_schema, routine_name ) = ( ?, ? )

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Feb 19 '07 #3
On Feb 19, 9:03 pm, Knut Stolze <sto...@de.ibm.comwrote:
[...]
Actually, SYSCAT.FUNCTIONS and SYSCAT.PROCEDURES are both outdated and
should not be used any longer. Instead, refer to SYSCAT.ROUTINES:

SELECT text
FROM syscat.routines
WHERE ( routine_schema, routine_name ) = ( ?, ? )
Thanx, I wasn't aware of that. Is this new for V9?

/Lennart
Feb 19 '07 #4
Lennart wrote:
On Feb 19, 9:03 pm, Knut Stolze <sto...@de.ibm.comwrote:
[...]
>Actually, SYSCAT.FUNCTIONS and SYSCAT.PROCEDURES are both outdated and
should not be used any longer. Instead, refer to SYSCAT.ROUTINES:

SELECT text
FROM syscat.routines
WHERE ( routine_schema, routine_name ) = ( ?, ? )

Thanx, I wasn't aware of that. Is this new for V9?
V8.

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Feb 19 '07 #5

Knut Stolze wrote:
SELECT text
FROM syscat.routines
WHERE ( routine_schema, routine_name ) = ( ?, ? )
Thanks for your prompt response, Knut and Lennart.

I there a simple way to display the output vertically? (Either by some
built-in command option or by adjusting the field separator character
or something?)

E.g.

ROUTINESCHEMA=DB2INST1
ROUTINENAME=BONUS_INCREASE
ROUTINETYPE=P
[..]

Serman D.
--

Feb 19 '07 #6
On Feb 19, 9:35 pm, "Serman D." <serma...@hotmail.comwrote:
[...]
I there a simple way to display the output vertically? (Either by some
built-in command option or by adjusting the field separator character
or something?)

E.g.

ROUTINESCHEMA=DB2INST1
ROUTINENAME=BONUS_INCREASE
ROUTINETYPE=P
[..]

Serman D.
I dont think so. However it should rather easy to write a procedure or
a function in your host language that does that. Example in python:

import DB2
import sys

conn = DB2.connect(...)
sql = """
select routineschema, routinename, routinetype
from syscat.routines where routineschema = 'TOOLBOX'
"""
c1 = conn.cursor()
c1.execute(sql)
header = map(lambda t:t[0], c1.description)
for row in c1.fetchall():
# transpose resultset
for n in range(0,len(header)):
print "%s=%s" % (header[n], row[n])
>>>
ROUTINESCHEMA=TOOLBOX
ROUTINENAME=GET_JOIN
ROUTINETYPE=F
ROUTINESCHEMA=TOOLBOX
ROUTINENAME=BUILD_JOIN
ROUTINETYPE=F
[...]

Another idea is to import the output to excel, and transpose it there

/Lennart

Feb 19 '07 #7
On Mon, 19 Feb 2007 20:03:10 +0100, Knut Stolze wrote:
Actually, SYSCAT.FUNCTIONS and SYSCAT.PROCEDURES are both outdated and
should not be used any longer. Instead, refer to SYSCAT.ROUTINES:

SELECT text
FROM syscat.routines
WHERE ( routine_schema, routine_name ) = ( ?, ? )
Are there other ways to inspect code in user defined functions?

- You see: I would like to close down access to the
SYSCAT.{FUNCTIONS,PROCEDURES,ROUTINES} views because I don't want to allow
users to see the source of other user's UDFs/procedures.

An idea: For SYSCAT.ROUTINES, set up a view allowing access to CURRENT
USER's routines only. Does this sound reasonable?

Are there other ways to allow the users to view the contents of the
UDFs/SPs that they have created? - Or maybe even: A way to let users see
the body of routines owned by other users that share group membership with
the current user (while excluding others)?

--
Regards,
Troels Arvin <tr****@arvin.dk>
http://troels.arvin.dk/
Feb 20 '07 #8
Troels Arvin wrote:
On Mon, 19 Feb 2007 20:03:10 +0100, Knut Stolze wrote:
>Actually, SYSCAT.FUNCTIONS and SYSCAT.PROCEDURES are both outdated and
should not be used any longer. Instead, refer to SYSCAT.ROUTINES:

SELECT text
FROM syscat.routines
WHERE ( routine_schema, routine_name ) = ( ?, ? )

Are there other ways to inspect code in user defined functions?
Not that I know of. The only other tools like db2look etc. would also
require certain privileges on the SYSCAT views, which you apparently don't
want to give away in the first place, right?
- You see: I would like to close down access to the
SYSCAT.{FUNCTIONS,PROCEDURES,ROUTINES} views because I don't want to allow
users to see the source of other user's UDFs/procedures.

An idea: For SYSCAT.ROUTINES, set up a view allowing access to CURRENT
USER's routines only. Does this sound reasonable?
Definitively.
Are there other ways to allow the users to view the contents of the
UDFs/SPs that they have created? - Or maybe even: A way to let users see
the body of routines owned by other users that share group membership with
the current user (while excluding others)?
Group memberships are a bit tricky. You will have to implement your own UDF
that determines if a user is in a certain group. Depending on your setup,
you may have to talk to the security plugin for that.

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Feb 21 '07 #9
Troels Arvin wrote:
On Mon, 19 Feb 2007 20:03:10 +0100, Knut Stolze wrote:
>Actually, SYSCAT.FUNCTIONS and SYSCAT.PROCEDURES are both outdated and
should not be used any longer. Instead, refer to SYSCAT.ROUTINES:

SELECT text
FROM syscat.routines
WHERE ( routine_schema, routine_name ) = ( ?, ? )

Are there other ways to inspect code in user defined functions?

- You see: I would like to close down access to the
SYSCAT.{FUNCTIONS,PROCEDURES,ROUTINES} views because I don't want to allow
users to see the source of other user's UDFs/procedures.

An idea: For SYSCAT.ROUTINES, set up a view allowing access to CURRENT
USER's routines only. Does this sound reasonable?

Are there other ways to allow the users to view the contents of the
UDFs/SPs that they have created? - Or maybe even: A way to let users see
the body of routines owned by other users that share group membership with
the current user (while excluding others)?
For my education... would you mind giving some background WHY you need
this capability?
How come your users aren't allowed to see each other's source code?

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Feb 21 '07 #10
On Wed, 21 Feb 2007 07:53:02 -0500, Serge Rielau wrote:
For my education... would you mind giving some background WHY you need
this capability?
How come your users aren't allowed to see each other's source code?
When reading a document like
http://publib.boulder.ibm.com/infoce...c/r0001941.htm
- especially the section on the RESTRICTIVE option, it suggests to me
that one of the things to consider is narrowing down access to certain
catalog views.

And I've seen that it may surprise users that the code of their SQL
routines is available to others. If you assume that your code is only
readable by yourself, you may put things into the code which aren't meant
to be read by others.

--
Regards,
Troels Arvin <tr****@arvin.dk>
http://troels.arvin.dk/
Feb 21 '07 #11
Troels Arvin wrote:
And I've seen that it may surprise users that the code of their SQL
routines is available to others. If you assume that your code is only
readable by yourself, you may put things into the code which aren't meant
to be read by others.
Like what? Crappy code? Back doors?
Is this about fear a developer runs away with your source code?

Cheers
Serge

PS: You can hide SQL procedure source code using GET/PUT_ROUTINE btw.
that is used by ISVs to protect their IP.

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Feb 22 '07 #12
Serge Rielau wrote:
Troels Arvin wrote:
>And I've seen that it may surprise users that the code of their SQL
routines is available to others. If you assume that your code is only
readable by yourself, you may put things into the code which aren't meant
to be read by others.

Like what? Crappy code? Back doors?
Is this about fear a developer runs away with your source code?
I think hiding this kind of information could be very helpful in school,
where you don't want to have one (or more) teams that just copies the stuff
from other teams. But then, you could fix that by using different
databases and managing access on that level. Besides that, I don't see any
real point either.

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Feb 22 '07 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: f | last post by:
I am writing a java code generation tool. The tool will take a java class description written in xml and translate it to java code using xslt. I am looking for samples of xml files that describe...
1
by: Bruce W.1 | last post by:
I want an XML file to describe hierarchical data where each node is different. Each node will contain different and varied other nodes. Describing this in an XML file would be easy but I'm having...
7
by: Phlip | last post by:
C++ dudes and dudettes: Ogle this code: static char * p; struct Q { char * p; }; static Q q; int main() { assert(p == NULL);
5
by: Reuven Nisser | last post by:
Hi, How can I describe an XML like this: <X> <Y/> <Z/> <Y/> <Y/> </X>
10
by: mattdaddym | last post by:
Hi all, I'm writing an application in asp .net and vb .net. The question I have just verifies I need to take an official programming course instead of this "learning on the fly" stuff :) ...
1
by: Daniel | last post by:
Can someone please describe why impersonation requires the impersonator to be local admin?
0
by: tamnguyen | last post by:
Hi everybody, I can't describe the package that has content: CREATE OR REPLACE PACKAGE TEST_NESTED_TYPES IS TYPE EmpRecord1 IS Record ( LEVEL_NO NUMBER(1) default 1, EMPNO ...
3
by: topsyk | last post by:
Is it possible to get just the type length from a describe command in db2?
1
by: kuntal dandapat | last post by:
2. Describe the operators and constants (Symbols) in Visual Basic .Net.
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.