Since most folks come to this site from Googling errors, here's a new one for you - complete with a solution! When I tried to connect from OS X to a DB2 database today, I received the following error:
java.sql.SQLException: java.lang.UnsatisfiedLinkError: no db2jdbc in java.library.path
at COM.ibm.db2.jdbc.app.DB2Driver.<init>(Unknown Source)
The reason this happens is because there are two JDBC Drivers for DB2 - the first is a native type-2 driver (signified by app in the classname) and the 2nd is a type-4 driver (signified by net in the classname). This page describes the difference between the DB2 JDBC Drivers.
To solve this issue, I changed my JDBC classname to be COM.ibm.db2.jdbc.net.DB2Driver and the error went away. Of course, the type-2 driver is faster, but since there is no client for DB2 that I can install on OS X, I'll still with .net. on the Mac, and .app. with the DB2 client on Windows. Of course, I prefer no client install - it just seems cleaner and easier to me.
The Next Day: I also discovered that it's very important that your db2java.jar file is really the db2java.zip file from the server. If the versions don't match (i.e. trying to connect to a 7.2 db with an 8.1 driver), it actually kills the JDBC Listener! What a pile of...
After reading this post on the Server Side, I'd hate to be the guy who invented Verge. He's getting pounded like a rabbit during mating season!
Personally, I don't think there's anything wrong with another web framework. Competition is good. The funny thing is that I've never had a need to migrate away from Struts. I do admit that the IoC (Inversion of Control) in WebWork looks cool, but I don't have a need. After reading most of Rod Johnson's J2EE Design and Development, I do understand IoC (I didn't have a clue before), but I still don't see how I need it. I've never run into a problem with Struts that I couldn't solve. Maybe it helps that I've written my own app to make Struts development simpler.
Even though I do like Struts, and I do find it easy to develop with, I also plan on stuffing my head in a couple of books and learning all about Spring, Tapestry and WebWork. Why? Mainly because I'm a fool and I can't be happy just sitting on the couch and watching TV (which would probably help my blood pressure and make my family happier). I'm a fool because I'd rather learn than relax. Back to the point - why do I want to learn these "big 3?" To be honest, it's primarily because some big names (and folks I'd consider friends) are saying they're cool and they'll make my job easier. If only I wasn't so easily influenced...
What I hate about all of this is that as soon as I decide to integrate Spring into AppFuse, it becomes more complicated. Yes, an XML BeanFactory file is more complicated than Interface i = new InterfaceImpl()
, especially for newbies.
Furthermore, I'm willing to bet that I'll end up writing workarounds for issues I encounter in Tapestry and WebWork. I'll even put my money where my mouth is - if your framework doesn't require me to write any workarounds, I'll donate $100 to the project. Heck, if it really is that cool - I'll donate money regardless of workarounds.
The worst part is that there's really no reason to convert my Struts webapp to these newer, cooler frameworks. About the only good reason is so I can say "I know the XXX Framework." I doubt XXX Framework will make anything easier, but it certainly might make my webapp a whole lot cooler.
I did some trial-and-error this morning, and with the help of a lot of handy-dandy unit tests, I got [Appuse working on DB2|AppFuseOnDB2]. I learned that I need to figure out how to create a database with page size = 8 by default - anyone got a SQL script to create DB2 databases (with reasonably sized table spaces) lying around?
Next up: Getting AppFuse running on WebSphere 5.1, this should be fun. Especially considering that they only seem to support .ear files, not .war files. I've only glanced at the thing for 5 minutes - any advice/links would be awesome.