ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » REG: Connecting to a DB2 Database using Java Application

Post new topic  Reply to topic
 REG: Connecting to a DB2 Database using Java Application « View previous topic :: View next topic » 
Author Message
ppraveen33
PostPosted: Fri Jan 17, 2014 6:31 am    Post subject: REG: Connecting to a DB2 Database using Java Application Reply with quote

Apprentice

Joined: 26 Jun 2013
Posts: 36

HI
I am developing a java application to connect to DB2 database. I am getting Class Not Found EXCEPTION. So can any one guide me on this.
I have added db2jcc.jar to my application

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.io.IOException;



public class TestDB {

/**
* @param args
*
*
*/
/* static{
try {
//Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
Class.forName("COM.ibm.db2.jcc.DB2Driver");

} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}*/

public static void main(String[] args) {


// TODO Auto-generated method stub
String dataSource="DSNV",userName="db2admin" , passWord = "db2admin";

try {
Class.forName("com.ibm.db2.jdbc.app.DB2Driver");
//COM.ibm.db2.jdbc.app.DB2Driver
Connection con = DriverManager.getConnection("jdbc:db2:"+dataSource,userName,passWord);

System.out.println("Connection :"+ con);

}
catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

}
Back to top
View user's profile Send private message
zurg
PostPosted: Fri Jan 17, 2014 7:19 am    Post subject: Reply with quote

Novice

Joined: 04 Feb 2013
Posts: 10

Please verify the guidelines about JDBC in WMB:

http://pic.dhe.ibm.com/infocenter/wmbhelp/v8r0m0/index.jsp?topic=%2Fcom.ibm.etools.mft.doc%2Fac30494_.htm
Back to top
View user's profile Send private message
premji
PostPosted: Mon Jan 20, 2014 11:56 pm    Post subject: Add one more jar file in class path db2cuiz.jar Reply with quote

Acolyte

Joined: 01 Jul 2013
Posts: 64

Check it both two jars in class path or not
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » REG: Connecting to a DB2 Database using Java Application
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.