Results 1 to 6 of 6
-
08-02-2011, 03:02 AM #1Newcomer
- Join Date
- Aug 2011
- Posts
- 3
- Thanks
- 0
- Thanked 0 Times in 0 Posts
Problem with direct DB2 SQL queries
Hi,
I want to build an API to pull information from TSM.
I plan on using PHP and the DB2 extension to access the TSM DB2 database directly.
I've run into some odd problems though.
When I do some queries, columns containing the name of nodes, appear as NULL. Consider the following:
This returns:PHP Code:$sql = db2_exec($db, "select * from TSMDB1.BACKUPS")
var_dump(db2_fetch_assoc($sql));
This happens on all tables, I simply cannot get the information about the node, out of the DB2 database.Code:array(12) { ["NODE_NAME"]=> NULL ["FILESPACE_NAME"]=> string(14) "2F54534D444231" ["FILESPACE_ID"]=> int(888) ["STATE"]=> string(14) "ACTIVE_VERSION" ["TYPE"]=> string(4) "FILE" ["HL_NAME"]=> string(20) "5C4E4F4445303030305C" ["LL_NAME"]=> string(56) "46554C4C5F4241434B55502E32303131303830313034303032392E32" ["OBJECT_ID"]=> string(5) "10268" ["BACKUP_DATE"]=> string(26) "2011-08-01 04:00:33.000000" ["DEACTIVATE_DATE"]=> NULL ["OWNER"]=> string(0) "" ["CLASS_NAME"]=> string(7) "DEFAULT" }
Anyone know why this happens, and also if there are any ressources relating to TSM DB2 queries out there? Or maybe there's a better way to achieve my goal?
Thanks
-
08-02-2011, 08:53 AM #2Senior Member
- Join Date
- Nov 2005
- Location
- Montreal, CA
- Posts
- 636
- Thanks
- 0
- Thanked 4 Times in 4 Posts
What happens when you run the query directly on a bash shell (db2 "select .......")?. Make sure you login with the instance owner and load the environment variables.
-
08-02-2011, 09:02 AM #3Newcomer
- Join Date
- Aug 2011
- Posts
- 3
- Thanks
- 0
- Thanked 0 Times in 0 Posts
Sorry, I forgot to mention this is a remote DB2 server. I'm connecting to it using db2_connect() and a DSN - from an entirely different server.
If I run the query directly on the TSM server (windows), with Eclipse, it works fine - all values are returned correctly.
-
08-03-2011, 05:03 PM #4Member
- Join Date
- Apr 2008
- Location
- St. Louis, Missouri
- Posts
- 151
- Thanks
- 0
- Thanked 3 Times in 3 Posts
I vaguely remember looking at this a while ago and realizing that there wasn't anything listening on 523/tcp. Not sure if there is a way to enable that in the DB2 that is included.
-
08-04-2011, 02:59 AM #5Newcomer
- Join Date
- Aug 2011
- Posts
- 3
- Thanks
- 0
- Thanked 0 Times in 0 Posts
It's running on port 50000 and the connection works fine, since query results are returned - just returned as NULL.
Has noone else really every tried to connect to the db2 instance directly? What do people do when they want to query data from TSM in a web-API?
-
08-05-2011, 06:12 PM #6Member
- Join Date
- Apr 2008
- Location
- St. Louis, Missouri
- Posts
- 151
- Thanks
- 0
- Thanked 3 Times in 3 Posts
Did you enable TCP connections? They don't seem to be enabled on my instance.
Tom Kyle
http://lanigera.com/wordpress
Similar Threads
-
Tdp sql backup queries
By microosoft in forum Microsoft SQL ServerReplies: 2Last Post: 09-29-2010, 03:20 AM -
Collection of most used SQL queries
By djchopps0013 in forum ScriptingReplies: 3Last Post: 04-22-2008, 01:52 AM -
Feel lost in SQL queries!
By azrael in forum Backup / Archive DiscussionReplies: 6Last Post: 03-30-2008, 09:48 PM -
I need help with these two SQL queries
By gniagnia in forum TSM Reporting & MonitoringReplies: 3Last Post: 12-04-2006, 02:15 AM -
DB2 AIX and TDP direct log archiving
By cpasztor in forum TDP/Application Layer BackupReplies: 3Last Post: 03-29-2006, 01:45 AM


Reply With Quote
