How can i connect to tables created in a schema with a username different from the schema name?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sastry.m.s@gmail.com

    How can i connect to tables created in a schema with a username different from the schema name?

    Hi,


    I have tables created in my DB2 database created under a schema. Now i
    want to get connected to these tables with a username different from
    this schema name from my java application. When i give the user name in
    my JDBC connection parameters, Its appending this username to the
    tables like username.tablen ame and thorws exceptions as the tables does
    not exists. How can i resolve this?? Help me!!!


    Thanks in advance,
    Sastry.

  • Mark A

    #2
    Re: How can i connect to tables created in a schema with a username different from the schema name?

    <sastry.m.s@gma il.com> wrote in message
    news:1142492759 .419295.41330@j 52g2000cwj.goog legroups.com...[color=blue]
    > Hi,
    >
    > I have tables created in my DB2 database created under a schema. Now i
    > want to get connected to these tables with a username different from
    > this schema name from my java application. When i give the user name in
    > my JDBC connection parameters, Its appending this username to the
    > tables like username.tablen ame and thorws exceptions as the tables does
    > not exists. How can i resolve this?? Help me!!!
    > Thanks in advance,
    > Sastry.
    >[/color]

    Any of these should work:

    1. Use the set schema statement
    2. Fully qualify the table names in your code (select from
    schema.table-name)
    3. create an alias for each table


    Comment

    • sastry.m.s@gmail.com

      #3
      Re: How can i connect to tables created in a schema with a username different from the schema name?

      Hi,

      Thanks for the reply. I resolved the issue in the following manner.
      I have given currentSchema attribute to my database url while getting
      the JDBC connetion.

      The syntax is
      jdbc:db2://<host>:<port>/<DB>;currentSch ema=<schema name>

      Thanks
      Sastry

      Comment

      Working...