niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Databases » IBM DB2
DB2 and Java
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
Author Message
Santhosh
*nix forums beginner


Joined: 01 Dec 2005
Posts: 17

PostPosted: Tue Jul 18, 2006 4:09 am    Post subject: DB2 and Java Reply with quote

Hi All

I could't able to connect to Db2 DB using the java program [type 4
driver.] I received the following error:

Error is No suitable driver
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(DriverManager.java:545)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at DB2DailyCheckListH.processDB(DB2DailyCheckListH.java:7Cool
at DB2DailyCheckListH.<init>(DB2DailyCheckListH.java:146)
at DB2DailyCheckListH.main(DB2DailyCheckListH.java:197)

The Java program is:

try{
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
Connection connection =
DriverManager.getConnection("jdbc:db2://eapsdev10021:60000/DBAPPASP",userID,passWord);
if (connection != null) {

DBLine = "<TR><td>"+country+"</td><td>"+InstanceName

+"</td><td>"+DBname+"</td><td>"+"OK"+"</td><td>"+"&nbsp"+"</td></tr>";
addFileLine();

connection.close();
}
}
Back to top
4.spam@mail.ru
*nix forums beginner


Joined: 14 Jul 2005
Posts: 49

PostPosted: Tue Jul 18, 2006 5:46 am    Post subject: Re: DB2 and Java Reply with quote

Hello.
For type 4 driver you have to use these jar files:
db2jcc.jar
db2jcc_license_cu.jar (if you connects to DB2 v8 for LUW)
and in your hava code:
Class.forName("com.ibm.db2.jcc.DB2Driver").newInstance();

Quote:
Hi All

I could't able to connect to Db2 DB using the java program [type 4
driver.] I received the following error:

Error is No suitable driver
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(DriverManager.java:545)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at DB2DailyCheckListH.processDB(DB2DailyCheckListH.java:7Cool
at DB2DailyCheckListH.<init>(DB2DailyCheckListH.java:146)
at DB2DailyCheckListH.main(DB2DailyCheckListH.java:197)

The Java program is:

try{
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
Connection connection =
DriverManager.getConnection("jdbc:db2://eapsdev10021:60000/DBAPPASP",userID,passWord);
if (connection != null) {

DBLine = "<TR><td>"+country+"</td><td>"+InstanceName

+"</td><td>"+DBname+"</td><td>"+"OK"+"</td><td>"+"&nbsp"+"</td></tr>";
addFileLine();

connection.close();
}
}
Back to top
Larry Menard
*nix forums addict


Joined: 09 Oct 2005
Posts: 58

PostPosted: Tue Jul 18, 2006 9:04 am    Post subject: Re: DB2 and Java Reply with quote

"COM.ibm.db2.jdbc.app.DB2Driver" is not the Type 4 driver...
"com.ibm.db2.jcc.DB2Driver" is.

Santhosh wrote:
Quote:
Hi All

I could't able to connect to Db2 DB using the java program [type 4
driver.] I received the following error:

Error is No suitable driver
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(DriverManager.java:545)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at DB2DailyCheckListH.processDB(DB2DailyCheckListH.java:7Cool
at DB2DailyCheckListH.<init>(DB2DailyCheckListH.java:146)
at DB2DailyCheckListH.main(DB2DailyCheckListH.java:197)

The Java program is:

try{
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
Connection connection =
DriverManager.getConnection("jdbc:db2://eapsdev10021:60000/DBAPPASP",userID,passWord);
if (connection != null) {

DBLine = "<TR><td>"+country+"</td><td>"+InstanceName

+"</td><td>"+DBname+"</td><td>"+"OK"+"</td><td>"+"&nbsp"+"</td></tr>";
addFileLine();

connection.close();
}
}
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
The time now is Sat Nov 22, 2008 12:19 am | All times are GMT
navigation Forum index » Databases » IBM DB2
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts question for JAVA developer who r using postgres sql as b... deepak pal PostgreSQL 1 Fri Jul 21, 2006 9:00 am
No new posts Is there C/C++ corresponding function in Linux for Java's... xiebopublic@gmail.com apps 4 Fri Jul 21, 2006 3:22 am
No new posts Is there C/C++ corresponding function in Linux for Java's... xiebopublic@gmail.com C++ 1 Fri Jul 21, 2006 2:44 am
No new posts Using python code from Java? fortepianissimo python 4 Thu Jul 20, 2006 5:36 pm
No new posts FAQ 1.9 How does Perl compare with other languages like J... PerlFAQ Server Perl 0 Thu Jul 20, 2006 7:03 am

Free Ringtones | Sauna | Internet Advertising | Free Ringtones | Download Korean movies
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1520s ][ Queries: 16 (0.0739s) ][ GZIP on - Debug on ]