Problem while accessing db2 from plugin project [message #328272] |
Tue, 20 May 2008 15:28 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: raguram.vidhyadharan.wipro.com
Hi,
These are the ways i have tried to connect db2. But i am not able to
populate the data from db while running as a plugin project.
1) import com.ibm.db2.jcc.DB2Driver;
DB2Driver.getMyClassLoader();
(or)
Class.forName("com.ibm.db2.jcc.DB2Driver");
I put the needed db2 jars(db2jcc.jar,db2jcc_license_cu.jar) in build path
of the project folder.This is working fine(populating the data from db)
when i run as standalone application. when we export our project folder as
plugin project the db2 jars are not getting exported inside plugin
project. I am getting NoClassDefFoundError in rule editor when i try to
populate dynamic population window (while pressing ctrl+space).
2) I added the needed db2 jars in Classpath tab of Plugin.xml->Runtime.
This also not working. The db2 jars are getting exported into plugin
project.Even i am getting
NoClassFound error com.ibm.db2.jcc.DB2Driver.
3) I created one more plugin project (chosen the option Plug-in from
Existing JAR archives) by adding the db2 jars inside. Exported it as
plug-in project.
I included this plugin project to my main plugin project by including it
in Required-plugins tab of Plugin.xml->Dependencies.
db2jars are came inside Plugin-dependencies folder of my plugin project.
This is working fine when i run as standalone.
*) After exporting to plugin project i am getting NoClassDefFoundError
if i use these statements import com.ibm.db2.jcc.DB2Driver;
DB2Driver.getMyClassLoader()) for connecting db.
*) After exporting to plugin project i am not getting any error in rule
editor
if i use Class.forName("com.ibm.db2.jcc.DB2Driver") for connecting db. But
the data are not populated from db.The execution is not going after this
statement Class.forName("com.ibm.db2.jcc.DB2Driver")
4) I added the db2 jars in java system library.This is also not working
after exporting plugin project.
Class.forName("com.ibm.db2.jcc.DB2Driver").newInstance();
Connection con =
DriverManager.getConnection("jdbc:db2://10.113.145.20:50000/db_CD1",
"username", "password");
stat =
con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSe t.CONCUR_READ_ONLY);
resultSet = stat.executeQuery("SELECT SEGMENT_TYP_ID,SEGMENT_TYP FROM
ECOM_SCH.TSEGMENT_TYP")
The same code is running fine while running as a standalone application.
DB2Driver class is getting loaded .
But this is not working after deploying as a plugin project.
please let me know is there any procedure to load the db2Driver class
while developing plugin project.
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03958 seconds