Thought inc.

The Dynamic O/R Mapping Company
     

CocoBase Technical Support Forums
For access to developer site with software download and doc's, please request CocoBase download and password
will be emailed to you. Response to posts will appear when answered by THOUGHT Support team.
NOTE:You must register separately with forum in order to post your questions, please click on register icon below.
Home   Frequently Asked Questions   Search   Edit your profile   Registration is free!  
Email This Page to Someone!
Show a Printable Version
CocoBase Enterprise O/R Forums > CocoBase Questions
db2 native driver exception
< Previous Thread     Next Thread >
Author
Thread    Post New Thread     Post A Reply
neil_poska
Member

Registered: Mar 2006
Posts: 6

I am getting an exception when Cocobase tried to connect to our db2 datasource using the native driver. I do not get an exception using the toolbox driver.

I do not have the stack trace because of some AS400 nuttiness, but here is what I remember: the exception was in the Cocobase connect() method, and was a NullPointerException at a Hashtable.put(). Since this Hashtable method will throw a NPE if the key or value is null, I think I might be missing some piece of the configuration.

The question is: what key/value elements are you expecting when you call that put() method in connect()?

P.S.-> If I can regenerate the stack trace, I will add it later, but it may be several days, I don't have that kind of time right now.

03-08-2006 02:04 PM
Click Here to See the Profile for neil_poska    Find more posts by neil_poska        Edit/Delete Message    Reply w/Quote    IP: Logged
admin
Administrator

Registered: Apr 2001
Posts: 19

If you can send us the jdbc URL you're using to support@thoughtinc.com we can verify if there are any issues with it.

One 'trick' you can do with CocoBase is to enable debug before you connect. For connecting with CBFacade, just call cbf.setDebugLevel(5) before connecting. If you're using the raw CocoBase Runtime CocoPowder use myBase.setDebug(true); instead. In either case the debug messages should help you detect the problem.

And please send us the URL if you wish so we can review it.

THOUGHT Support

03-08-2006 02:16 PM
Click Here to See the Profile for admin    Find more posts by admin        Edit/Delete Message    Reply w/Quote    IP: Logged
neil_poska
Member

Registered: Mar 2006
Posts: 6

Here is the URL property in our config file:

iseries.primaryDatabaseURL=jdbc:db2://HOSTNAME;naming=SQL;libraries=*LIBL;errors=full;date format=iso;time format=iso;block size=512

We basically took the existing as400 url and replaced the jdbc subgroup from as400 to db2.

Other datasource properties are set in this config file as well.

Thanks for the debug information. I will try that next chance I get.

But you don't have access to the cocobase code to tell me what key/value is expected at that Hashtable?

03-08-2006 02:30 PM
Click Here to See the Profile for neil_poska    Find more posts by neil_poska        Edit/Delete Message    Reply w/Quote    IP: Logged
admin
Administrator

Registered: Apr 2001
Posts: 19

This URL looks valid, so without knowing what exception you're getting it's unclear where your error is coming from.

When you use a standard URL such as this with no :cocoprop or :cocorep entries, we simply call the jdbc driver connect facilities and pass the values in, in a fully standard way. Any 'null' values might be related to null issues in the driver itself and not CocoBase, but without the full stacktrace derived from a debug mode connect it is impossible to tell exactly what's happening.

Does that make sense?

THOUGHT Support

03-08-2006 02:42 PM
Click Here to See the Profile for admin    Find more posts by admin        Edit/Delete Message    Reply w/Quote    IP: Logged
neil_poska
Member

Registered: Mar 2006
Posts: 6

That absoultely makes sense.

I was just hoping that there would be just one connect method, and in that method, there would be one Hashtable access. And then you could tell me something like "after we connect, we add an element to the internal cache hashtable that maps database URL to driver shortName" or something like that, and I could check and make sure we set the shortName property of the datasource.

I'm taking from your answer that it isn't something that simple? :)

03-08-2006 02:57 PM
Click Here to See the Profile for neil_poska    Find more posts by neil_poska        Edit/Delete Message    Reply w/Quote    IP: Logged
admin
Administrator

Registered: Apr 2001
Posts: 19

It sounds like you are you referring to a DataSource. We do support DataSource connections, which supports a 'short name' connection style. But when you are connecting to a raw jdbc driver, then as a wrapper to CocoBase you have to supply all of that information to the tool. You can do this by reading your connection properties from some location such as a properties file so you don't have to type it in, but you must include a proper jdbc connection for each connection to the runtime layer.

Does that make sense?

THOUGHT Support

03-08-2006 03:14 PM
Click Here to See the Profile for admin    Find more posts by admin        Edit/Delete Message    Reply w/Quote    IP: Logged
neil_poska
Member

Registered: Mar 2006
Posts: 6

exactly! And I believe that we are missing at least one important piece of information when we populate those properties, and you are using that missing property in your Hashtable put() method resulting in an NPE. We now are on exactly the same page.

It looks like the DB2StdConnectionPoolDataSource has about 50 setters. Which are the mandatory ones? Do you have any example code?

03-08-2006 03:26 PM
Click Here to See the Profile for neil_poska    Find more posts by neil_poska        Edit/Delete Message    Reply w/Quote    IP: Logged
admin
Administrator

Registered: Apr 2001
Posts: 19

That's Version/Database specific, and not CocoBase specific. If you can find the correct setting details for your particular environment, then CocoBase can access the DataSource through a URL such as:

jdbc:cocoprop=jndiurl=jdbc/MyDataSource

Does this make sense?

THOUGHT Support

03-08-2006 03:37 PM
Click Here to See the Profile for admin    Find more posts by admin        Edit/Delete Message    Reply w/Quote    IP: Logged
All times are PST (US)    Post New Thread     Post A Reply
Forum Jump:
< Previous Thread     Next Thread >

Forum Rules:
Who Can Read The Forum? Any registered user or guest.
Who Can Post New Topics? Any registered user.
Who Can Post Replies? Any registered user.
Changes: Messages can be edited by their author. Messages can be deleted by their author.
Posts: HTML code is OFF. Smilies are OFF. vB code is OFF. [IMG] code is OFF.

Admin Options:
Open / Close Thread
Move Thread
Delete Thread
Edit Thread

< Contact Us - THOUGHT Inc. >

Copyright © Jelsoft Enterprises Limited 2000.
Copyright 2001 All Rights Reserved, THOUGHT Inc.