Results 1 to 2 of 2

Thread: DB2 Drivers

  1. #1
    Join Date
    Mar 2004
    Posts
    1

    Unanswered: DB2 Drivers

    Am using DB2 and Webshpere in my final year project. Just changed my driver from import com.ibm.db2.app to import com.ibm.db2 but i'm getting a null pointer exception... I'm relatively new to DB2 so don't know what i did wrong, my connection code is

    public DBManager()
    {
    //Database Connection
    String url = "jdbc:db2:FYPDB";
    //Username and password

    try{


    Class.forName("com.ibm.db2.jcc.DB2Driver");
    System.out.println("Here");
    conn = DriverManager.getConnection("jdbc:db2:FYPDB","1000 63045","Eimear82");
    System.out.println("Here now");


    }
    catch(Exception sql)
    {
    sql.printStackTrace();
    System.out.println("SQL Exception on connection");
    }

    }

    public void getConnection()
    {
    try{
    conn.createStatement();
    }
    catch(Exception sqle)
    {
    sqle.printStackTrace();
    System.out.println("SQLE Exception");
    }
    }


    but it doesn't seem to recognise the import
    import com.ibm.db2.jcc.*;

  2. #2
    Join Date
    Dec 2002
    Posts
    134

    Re: DB2 Drivers

    I think you need to change url to something like
    "jdbc:db2://hostort/db"

Posting Permissions

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