Temporary tables in QTEMP & legacy code

The place for general PHP questions and hints for PHP on IBM i
Post Reply
brya5265
Posts: 68
Joined: Tue Feb 19, 2013 2:26 pm

Temporary tables in QTEMP & legacy code

Post by brya5265 » Tue Nov 11, 2014 8:02 pm

I have a legacy program that creates a table of metrics in QTEMP. I'd like to call the program from PHP, then read the QTEMP table and then delete it, all in one request cycle. I'm running the toolkit "stateless" which says that the XTOOLKIT requests are handled in the SQL server job, but I suspect that even though I'm in a single request cycle, the DB connection I obtain for reading the temporary table may not be the same SQL server job that handled the toolkit request, and therefore I may not have access to the QTEMP table I just created. Any thoughts, ideas or suggestions?

--Bryan

aseiden
Posts: 875
Joined: Thu Apr 09, 2009 5:45 pm

Re: Temporary tables in QTEMP & legacy code

Post by aseiden » Wed Nov 12, 2014 12:01 am

Since you are using stateless mode, you can be assured that they're sharing the connection if you pass the database connection resource into the toolkit's "getInstance" method, as the first parameter.

brya5265
Posts: 68
Joined: Tue Feb 19, 2013 2:26 pm

Re: Temporary tables in QTEMP & legacy code

Post by brya5265 » Wed Nov 12, 2014 4:47 pm

Thanks! I didn't notice the alternate way of instantiating the tso before.
--Bryan

brya5265
Posts: 68
Joined: Tue Feb 19, 2013 2:26 pm

Re: Temporary tables in QTEMP & legacy code

Post by brya5265 » Fri Nov 14, 2014 7:42 pm

I'm no longer sure I can use stateless mode for the toolkit. Is there a way to get to QTEMP files generated in the XTOOLKIT jobs? Basically, I want to call a pgm that creates my data in QTEMP, then I'll read the data and then drop the file -- all in 1 request cycle.

--Bryan

Post Reply