Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Problem while accessing db2 from plugin project
Problem while accessing db2 from plugin project [message #328272] Tue, 20 May 2008 15:28 Go to next message
Eclipse UserFriend
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.
Re: Problem while accessing db2 from plugin project [message #328336 is a reply to message #328272] Wed, 21 May 2008 20:36 Go to previous messageGo to next message
jeevan is currently offline jeevanFriend
Messages: 20
Registered: July 2009
Junior Member
open plugin editor for the plugin , select build tab and check in the
binary build section as to whether the libraries are included in the
binary build. without this it will not work in the exported version.

-Jeevan
Re: Problem while accessing db2 from plugin project [message #328358 is a reply to message #328336] Fri, 23 May 2008 05:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: raguram.vidhyadharan.wipro.com

Hi,
I created one directory inside my plugin project. I put the needed db2
jars inside that. Included that directory in binary build section of build
path tab. This is also not working.

Thanks & regards,
V.Raguram
Re: Problem while accessing db2 from plugin project [message #328373 is a reply to message #328272] Fri, 23 May 2008 14:11 Go to previous message
jeevan is currently offline jeevanFriend
Messages: 20
Registered: July 2009
Junior Member
i went through the your first mail again. having a separate plugin to
contain the db2 jars (option 3) is the one that I would recommend. Use the
"plugin from existing jar archives" option to create the plugin.

Every eclipse plugin would have its own class loader. changing anything in
the system classpath would not affect the plugin class loader, rather it
would take its class path from the .manifest file "Bundle-ClassPath:"
parameter.

Since you mentioned that you have the main plugin which has the db2 plugin
as its dependency, the classpath of the main plugin would be the classpath
of itself + classpath of the dependent plugin

All said and done, sometimes the plugin classpath would have problems
because of the build.properties file.

your db2 plugin build.properties should atleast have something like this

bin.includes = META-INF/,\
com/,\
javax/,\

.......
.......

the com/ is the one you would be interested (DB2 packages would be
com.ibm....)

also look into the .log file in the workspace. that would give you a
better idea of what the problem is.


-Jeevan
Previous Topic:how to use databinding to bind dynamic data
Next Topic:Default menues for an RCP
Goto Forum:
  


Current Time: Fri Aug 16 22:24:56 GMT 2024

Powered by FUDForum. Page generated in 0.03558 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top