473,404 Members | 2,178 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,404 software developers and data experts.

Scriptability for moving stored procedures

As the DBA for a development project a couple of years ago, I was in
charge of migrating/promoting stored procedures from the development
environment to the QA and production environments once they had been
proven. I automated the process with a script that sucked the source
code from source database, removed proc if exsists in target
environment, compiled it in the target enviroment and logged the
operation in a tracking table.

This now I am faced with a similar situation, but now have deal with
Java stored procedures instead of SQL stored procedures. I would like
to script the same operation but have hit a few snags. It's difficult
to use the SP Builder since my builds are generally batch driven
(i.e., migrate all procs in an approved list). Plus, using the export
function from the SPB doesn't generate source code in the target DB
once the script is executed on the target DB.

Here are the highlights of what I have so far:

1. Suck out Java source code:
export to $PROCNAME.dat of del lobs to ./mylobs/ lobfile lobs1
modified b
y lobsinfile select procname,class_source from sysibm.sysjarcontents
jc, syscat.
procedures p where p.procname = '$PROCNAME' and
p.procschema='$PROCSCHEMA' and substr(p.jar_id,locate('.',p.jar_id)+1)
= jc.jar_id

2. Rename and compile lobfile
mv lobs.001 $PROCNAME.java
javac $PROCNAME.java

3. Turn it into a .jar
jar cvf $PROCNAME.jar $PROCNAME.class

4. drop existing procedure and jar if exists
drop procedure $PROCNAME
sqlj.remove_jar...

5. Install jar
sqlj.install_jar...

I have had sucess up to here, but have been stumped in finding a way
to generate the procedure definition and the way to install the source
code into the target database. If anyone can help me out with these
last two high level steps, that would be great. If there's even a
better way to do this altogether, then I'm all ears as well.

Thanks in advance,
Mike
Nov 12 '05 #1
4 1887
Do you have the sqllib\\BIN\db2build.bat file?

PM
Nov 12 '05 #2
> Do you have the sqllib\\BIN\db2build.bat file?

PM


No. As soon as I posted, I realized that I had forgotten to mention my
platform. I'm running on 7.2 FP11 under AIX 4.3. The path and file
names suggest that the above is Windows-based utility. What does it
contain?

Mike
Nov 12 '05 #3
I think it is a v8.x feature.
Anyway,
....\sqllib\Stinger\TOOLS>jar -tf DB2DC.jar | find /i "db2build"
<snip>
com/ibm/db2/tools/dev/dc/svc/db/batch/DB2Build.class
<snip>

It's a java based tool so it should be available on most platforms. (what
db2 version?)
http://www-106.ibm.com/developerwork...0308nelin.html
Didn't try it yet but from my 5 mins. search, i get that it's a tool used
for SP's on db2 mainframe.

http://www.google.ca/search?q=db2bui...-8&hl=en&meta=

Until i try it, i can't say it would work on db2 linux/unix/windows.
Same thing goes for the Deploycmd command.

PM

"Mike L. Bell" <mi***********@yahoo.com> a écrit dans le message de
news:49*************************@posting.google.co m...
Do you have the sqllib\\BIN\db2build.bat file?

PM


No. As soon as I posted, I realized that I had forgotten to mention my
platform. I'm running on 7.2 FP11 under AIX 4.3. The path and file
names suggest that the above is Windows-based utility. What does it
contain?

Mike

Nov 12 '05 #4
Thanks, PM, for the links. I think that your assessment that it works
with OS/390 only appears to be correct.

What do the rest of you do in development environments where you deal
with the management of stored procs? Anyone else trying to integrate
PVCS (or similar source code tracking system) with stored procedure
code? Trackability and automation are my two main goals here.

Thanks for your input,
Mike
"PM \(pm3iinc-nospam\) CGO" <PM (pm3iinc-nospam)@cgocable.ca> wrote in message news:<0t*****************@charlie.risq.qc.ca>...
I think it is a v8.x feature.
Anyway,
...\sqllib\Stinger\TOOLS>jar -tf DB2DC.jar | find /i "db2build"
<snip>
com/ibm/db2/tools/dev/dc/svc/db/batch/DB2Build.class
<snip>

It's a java based tool so it should be available on most platforms. (what
db2 version?)
http://www-106.ibm.com/developerwork...0308nelin.html
Didn't try it yet but from my 5 mins. search, i get that it's a tool used
for SP's on db2 mainframe.

http://www.google.ca/search?q=db2bui...-8&hl=en&meta=

Until i try it, i can't say it would work on db2 linux/unix/windows.
Same thing goes for the Deploycmd command.

PM

Nov 12 '05 #5

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

Similar topics

11
by: jrefactors | last post by:
I want to know the differences between SQL Server 2000 stored procedures and oracle stored procedures? Do they have different syntax? The concept should be the same that the stored procedures...
2
by: scott | last post by:
Hi, Just wondering what sort of problems and advantages people have found using stored procedures. I have an app developed in VB6 & VB.NET and our developers are starting to re-write some of the...
0
by: Tim Bolla | last post by:
I have created ~30 stored procedures that I need to have running on a database in order to use the application that I have developed. I am looking for a solution so that these stored procedures...
2
by: Kent Lewandowski | last post by:
hi all, Recently I wrote some stored procedures using java jdbc code (admittedly my first stab) and then tried to implement the same within java packages (for code reuse). I encountered...
5
by: Tim Marshall | last post by:
I was following the thread "Re: Access Treeview - Is it Safe Yet?" with interest and on reading the post describing Lauren Quantrell's SmartTree, I've run into something I don't understand: Stored...
1
by: Nirbho | last post by:
Hi, I've got a c#.net web app that uses SQl Server 2000. It all works very well on my Development PC, but now I've got to install the app onto some real servers. I have 3 servers: 2 for the web...
28
by: mooreit | last post by:
The purpose for my questions is accessing these technologies from applications. I develop both applications and databases. Working with Microsoft C#.NET and Microsoft SQL Server 2000 Production and...
8
by: rick | last post by:
Hi I m trying to move only stored procedures from one database to another and also onto a database on another server, I tried db2 -x "select text from syscat.procedures where procschema =...
11
by: peter | last post by:
I am trying to get a SQL stored procedure to use user maintained MQT implicitly which raises questions on when they are used or not used. In theory you would expect the stored procedure to pick up...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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.