Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2004

    Unanswered: JDBC URL to use the hostname syntax

    Hi can anyone help me get my java application to connect to a DB2 v8.1 database.

    I have a java application that connects just fine to DB2

    for my string url i'm using
    and the driver i'm using is

    I'm running the application on the same computer as where my DB2 is installed.

    But i dont knw where this 'mydatabase' is created on my computer and how i can use the hostname syntax? and wht is it? So that if needed i can connect to my db from different machine.

    Can someone show me how to make a proper connection


  2. #2
    Join Date
    Aug 2004


    You may use the driver "",and write the URL like this:"jdbc:db2://hostname:6789/databasename"

  3. #3
    Join Date
    Jul 2004
    Thanks for replying
    but where this database will be created on my computer, in which folder?
    Can u paste some example code for reference.

  4. #4
    Join Date
    Jun 2003
    Toronto, Canada
    Provided Answers: 1
    It doesn't matter in which folder the database files are: "databasename" in the example given by somn is the name you specify in CREATE DATABASE - it will be cataloged on the server under that name.

  5. #5
    Join Date
    Jul 2004
    But the problem is ,i want to create a database using db2's CLP on my machine and then i wish to connect to that database from my java code using jdbc URL.
    And when i create database from CLP and to this DB i try to connect from jdbc it doesnt works and tables r not created in it but somewhere else.
    I using db2e drivers to connect to db

    String driver = "";
    String url = "jdbc:db2e://localhost:6789/mysample";

    SO i would like to knw how i can connect to mysample database from CLP of db2. Normal command
    Connect to mysample works but it doesnt show the tables which r created from jdbc.

Posting Permissions

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