decodePC.java

decodePC.sqr as written by David L. Price has been rewritten to decodePC.java and expanded. It's general purpose is decoding PeopleCode stored as BLOB. The PeopleSoft database is accessed via a JDBC connection therefore there is no need to use Application Designer to look at PeopleCode, Application Engine programs, SQL, and XSLT. decodePC.java can read Application Engine programs and Application Packages and output them to a text file so you can get on with solving business problems.



Example of compiling decodePC.java with Oracle JDBC on a Unix box from a command prompt in the directory where decodePC.java exists:



javac -classpath /directorypath/ojdbc14.jar ./decodePC.java



Example of running decodePC.class with Oracle JDBC on a Unix box from a command prompt in the directory where decodePC.class exists:



java -classpath .:/directorypath/ojdbc14.jar decodePC


AttachmentSize
decodePC.java.2007summer92.49 KB
decodePC.java.200709106.76 KB
decodePC.java progtxt is data type longraw118.29 KB
stagePeopleCode.txt4.89 KB
decodePC.java progtxt is data type blob113.66 KB

Thanks, but program keeps

Thanks, but program keeps crashing using

"decodePC.java progtxt is data type longraw"

my progtxt is type longraw.

I get the following message when trying to type anything like

/AP = XXX

#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x62f0c9a7, pid=3916, tid=5856
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_11-b03 mixed mode)
# Problematic frame:
# C [ocijdbc10.dll+0xc9a7]
#

Would it be possible to try with a different JDBC driver?

The error message seems to indicate a problem with the JDBC driver. The error message does not appear to be a Java error or caught exception in the program.

Are you able to try it using the classes12.jar JDBC driver?

Example from Windows XP with Oracle JDBC

Use JDBC within Oracle client version 11.1 against an Oracle 10gR2 database being used for the PeopleSoft application.


Copy decodePC.java onto a PC in directory c:\decodePC.

Create decodePC_build.bat to compile program decodePC.java into decodePC.class.

Create decodePC.bat to run decodePC.class.

Run the bat files from a Windows command prompt.


decodePC_build.bat contains 2 statements:

pushd c:\decodePC

c:\oracle\ora111\jdk\bin\javac -classpath .;c:\oracle\ora111\jdbc\lib\ojdbc5.jar decodePC.java


decodePC.bat contains 2 statements:

pushd c:\decodePC

c:\oracle\ora111\jdk\bin\java -Xmx350m -classpath .;c:\oracle\ora111\jdbc\lib\ojdbc5.jar decodePC


Oracle client version determined by running: Start > All Programs > Oracle > Application Development > sqlplus.

An Oracle 10gR2 database is most likely using data type Blob to store progtxt.

Excellent!

This is an excellent program and I need to get this up and running within our environment! Nice work!

Jeromy McMahon
ASU

The code fails to extract the string from the PROGTEXT field

Saw your code up on passportgeek that allows you to decode PeopleCode.

I got it running on my PT8.43 environment (bit of work as I am using jdbc:oracle:thin, but it doesn't work in PT8.48. (The code fails to extract the string from the progtext field)

I'm pretty sure the reason is that we have built the PS Portal 8.9 / PT8.48 environment on Oracle 10.2.0.3.0, and now PROGTEXT is stored as a BLOB, whereas in Ora9 it's stored as a LONG RAW.

The line that isn't working is somewhere around

OOB[row_cnt] = resultset.getString("progtxt");

I tried to merge the MySQL codeline as that looked BLOB related, but I started getting confused as to how on earth decoding into UTF-16LE etc is handled when converting from a BLOB to a string. It's just that
little bit out of my comfort zone, so I've backed off.

Anyway, good work on posting the code and I'll let you know if I keep playing with it.

Replacing LONG RAW Oracle code with BLOB MySQL code should work

Hi,

Start with program decodePC.java with comments from Nov 2007.

For example, within method stagePeopleCode comment out the Oracle code used for reading PROGTXT when declared as LONG RAW (Oracle begin, Oracle end) and uncomment the MySQL code which was written for datatype BLOB (MySQL begin, MySQL end), ignore the log entries.

This should work. Notice that David Price originally used a temporary table to copy the data from a table with PROGTXT declared as LONG RAW to one with it declared as BLOB. This allowed him to then use the Oracle version 9 BLOB functions (UTL_...).

Please post errors if you run into problems.

Regards

Code change necessary to read Oracle BLOB pspcmprog.progtxt

Hi,

I was wrong. A code change is necessary to read progtxt when it is defined as BLOB.

As far as I can tell, Oracle implemented progtxt as a BLOB of bytes. It is easily read into a byte array.

Previously progtxt was implemented as LONG RAW. I believe it is because of the limited functionality the Oracle database has with data type LONG RAW that although it's the same data as stored in BLOB it is necessary to read it into a String, convert it to a char array and convert that to a byte array.

The code for MySQL assumes the BLOB data is binary.

Method stagePeopleCode(Connection, String) from decodePC.java for reading pspcmprog when progtxt is of data type BLOB has been posted. decodePC.java will eventually be changed to read the Oracle catalog to determine progtxt's datatype and work with both LONG RAW and BLOB.