Setting up Db2 v9 as a Coldfusion Datasource
In the last few weeks I've had the opportunity to get to know Coldfusion just a little bit better. One of the first challenges I faced is getting CF talking to Db2, so I could take advantage of the CF Extensions for Flexbuilder and that funky Wizard. To be precise I used ColdFusion MX 7.02 and DB2 Community Express Edition v9.1
This doesn't just apply to Flex, but maybe others might find this useful. Keep in mind I have only tested this in Windows:
- Install the db2 client or get access to a machine that does. I installed db2 in the default folder on my dev machine to get this working.
- Copy C:\Program Files\IBM\SQLLIB\java\db2java.zip to C:\CFusionMX7\lib. Important: Make sure db2jdbc.dll is in the path somewhere or copy it to same folder!
- Restart Coldfusion MX. Login to CF Admin. Go to Datasources.
- Add new Datasource:
- driver type Other
- CF DataSource Name: [sourcename]
- JDBC url: jdbc:db2:[dbname]
- Driver Class: COM.ibm.db2.jdbc.app.DB2Driver
- Driver Name: DB2Driver
- username: [name]
- password: [password]
- [Submit]
I also did spend a good chunk of time trying to get the built in driver to talk to db2... I personally had no luck whatsoever, and I have read in other places that the drivers generally are only backwards compatible... the driver that ships with CF is definitely not v9, I think it might be v7... not sure though. I did test the backward compatibility claim by using the v9.1 jdbc driver against a db2 v8.x datasource and it worked fine.
1 comment:
The db2jdbc.dll can be found in c:\Program Files\IBM\SQLLIB\BIN, fyi.
Post a Comment