Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2005
    Posts
    16

    Unanswered: Connecting to a particular schema using ODBC.

    Hi,

    Is it possible to configure a DSN Connection to connect to a particular Schema.

    DB2 is the database and i want to connect to a particular schema.

    TIA
    Yadu

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    You don't connect to a schema; you connect to a database.

    Please explain in detail what are you trying to achieve.

  3. #3
    Join Date
    Oct 2005
    Posts
    16
    I've a database called as "SAMPLE" which is in Schema "Test".

    I've created a DSN for this database using a login "db2admin".

    Whenever I try to connect to this database, the schema is defaulted is "db2admin". To overcome this, the schema name has to be mentioned in the code which is accessing the database.

    To avoid this hardcoding of schema name in the code, I'm looking for something like a parameter in DSN where in i can mention a default schema name.

    I've tried using the CLISCHEMA option but it does not work.

    Both the client and the database reside on windows env.

    Yadu

  4. #4
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by yadu
    To overcome this, the schema name has to be mentioned in the code which is accessing the database.
    It is a good development practice to specify schema names in your SQL.

    If you insist on doing wrong things you can either issue SET CURRENT SCHEMA statement or specify "CurrentSchema=whatever" in db2cli.ini

  5. #5
    Join Date
    Oct 2005
    Posts
    16

    Question

    I added the schema name in db2cli.ini file.

    The results were a bit odd.

    Though I did not get any errors, the resulting query did not return any of the data from the table.

    Can you tell me what could be the reason for this?

    PS: The table is having valid data which satisfies the query condition.

Posting Permissions

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