If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > DB2 Drivers

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-02-04, 16:29
JSPLearner JSPLearner is offline
Registered User
 
Join Date: Mar 2004
Posts: 1
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.*;
Reply With Quote
  #2 (permalink)  
Old 03-02-04, 17:09
chuzhoi chuzhoi is offline
Registered User
 
Join Date: Dec 2002
Posts: 134
Re: DB2 Drivers

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

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On