Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2006
    Posts
    14

    Unanswered: Is it possible to bind a "default" schema to a user?

    Hi,

    I'm quite new on the db2-terrain. If got this problem, in my pro-c code, i would like to call a specific "to_char" function. The problem is, everytime i run the precompiler, it says the sysibm.to_char function is not compatible to the parameters...etc. etc. Thats correct, in my schema i changed the to_char function.

    Now, one solution would be, to simply write <schema>.to_char, but thats something i'd like to avoid, cause the application should not be bind to one special schema.

    Is there anything db2-specific, with which i can force the db2 precompiler to use the user's schema?

    Thanks in advance

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Please give DB2 version and OS.

    Look in the manual for "CURRENT PATH" special register. You should be able to change it through the "SET PATH" statement. Something like:

    SET PATH = <schema>, CURRENT PATH

    HTH

    Andy

  3. #3
    Join Date
    Mar 2006
    Posts
    14
    Hi,

    OS = Win2k
    DB2 = 8.2

    I tried to set the schema with the "set schema" command, but still, if I call my own "to_char" function, the precompiler uses the sysibm.to_char function instead and reports an error because the parameters won't fit. Which in fact is correct, but I don't get why the precompiler does not use my function.
    For example, if there is no function with the same name in the sysibm schema, the precompiler uses my function.

  4. #4
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    Please re-read Andy's post.

    It is not set schema, but set path.

    Routines (SPs and UDFs) use the CURRENT PATH special register and NOT Current Schema

    HTH

    Sathyaram
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  5. #5
    Join Date
    Mar 2006
    Posts
    14
    I also tried it with set path, but the changes i made won't be saved. Its a bit strange in my opinion, because I set the path -> works fine; I re-read the path -> works fine, the path changed. But as soon as i close the db2cmd and reopen it, I get the old path value. Is this a normal behaviour ?

  6. #6
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    Yes, it is the normal behaviour.

    You may want to put this as part of a config file, at appl level or say, in db2cli.ini
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  7. #7
    Join Date
    Mar 2006
    Posts
    14
    Ah, okay - thanks to both of you

Posting Permissions

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