Results 1 to 6 of 6
  1. #1
    Newcomer
    Join Date
    Aug 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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:

    PHP Code:
    $sql db2_exec($db"select * from TSMDB1.BACKUPS")
    var_dump(db2_fetch_assoc($sql)); 
    This returns:

    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"
    }
    This happens on all tables, I simply cannot get the information about the node, out of the DB2 database.

    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

  2. #2
    Senior Member rore's Avatar
    Join Date
    Nov 2005
    Location
    Montreal, CA
    Posts
    637
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Default

    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.

  3. #3
    Newcomer
    Join Date
    Aug 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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.

  4. #4
    Member gimlet's Avatar
    Join Date
    Apr 2008
    Location
    St. Louis, Missouri
    Posts
    153
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    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.

  5. #5
    Newcomer
    Join Date
    Aug 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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?

  6. #6
    Member gimlet's Avatar
    Join Date
    Apr 2008
    Location
    St. Louis, Missouri
    Posts
    153
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    Did you enable TCP connections? They don't seem to be enabled on my instance.

Similar Threads

  1. Tdp sql backup queries
    By microosoft in forum Microsoft SQL Server
    Replies: 2
    Last Post: 09-29-2010, 03:20 AM
  2. Collection of most used SQL queries
    By djchopps0013 in forum Scripting
    Replies: 3
    Last Post: 04-22-2008, 01:52 AM
  3. Feel lost in SQL queries!
    By azrael in forum Backup / Archive Discussion
    Replies: 6
    Last Post: 03-30-2008, 09:48 PM
  4. I need help with these two SQL queries
    By gniagnia in forum TSM Reporting & Monitoring
    Replies: 3
    Last Post: 12-04-2006, 02:15 AM
  5. DB2 AIX and TDP direct log archiving
    By cpasztor in forum TDP/Application Layer Backup
    Replies: 3
    Last Post: 03-29-2006, 01:45 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •