Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2003
    Posts
    2

    Unanswered: Using JDBC net driver w/o database alias

    I am trying to use the net drivers instead of the app drivers in a jdbc project. I have not been able to figure out a way to connect to the database if the database does not have an alias registered on the server.

    Does the net driver require a server alias, or is there a URL construct I can use which is able to reference a database through its instance.

    I would appreciate any assistance, Ed.

  2. #2
    Join Date
    Dec 2002
    Posts
    134

    Re: Using JDBC net driver w/o database alias

    use

    DriverManager.getConnection("jdbc:db2://SERVER:JDBC_PORT/DB", "USER", "PASSWORD")

  3. #3
    Join Date
    Mar 2003
    Posts
    2

    re: Using JDBC net driver w/o database alias

    Thanks for the response. The URL you are demonstrating assumes that the alias "DB" is registered on the server. Or maybe it does work when there is only on DB2 instance. The situation I'm in is that we have multiple instances running on one server. When I pass in the database name it does not connect. Somehow the instance needs to be referenced as well (If its even possible). The code I am using works fine on my development server, where I created the alias to the database.

    The obvious answer is "Just register the alias then". However, I am working at a huge company, and the DBAs are telling me that creating aliases are not something that they "normally" do. Now I am faced with the daunting task of getting the DBAs to change their "normal" process and do something special. Not easy in a company of this size.

    Thanks, Ed.

  4. #4
    Join Date
    Dec 2002
    Posts
    134

    Re: re: Using JDBC net driver w/o database alias

    Probably I do not understand something, but with URL string I provided you do not need to catalog db on the "client"

    On the "client" you need to know db server name (or ip addess) plus JDBC port and db name (as it cataloged on server box)
    On server you need to start jdbc daemon - db2jd (we use one per instance)

    And you do not need db2 client on the "client" box

    It does work for us,
    dmitri

Posting Permissions

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