You have to deploy a bundle fragment to Adobe CQ that contains the database driver file. In this development article, the name of the database driver file is mysql-connector-java-5.1.22-bin. To create an OSGi bundle fragment that contains this database driver file, perform these tasks:
1. Start Eclipse (Indigo). The steps below have been tested on Eclipse Java EE IDE for Web Developers version Indigo Service Release 1.
2. Select File, New, Other.
3. Under the Plug-in Development folder, choose Plug-in from Existing JAR Archives. Name your project jdbcBundle.
4. In the JAR selection dialog, click the Add external button, and browse to the database driver file.
5. Click Next.
6. In the Plug-in Project properties dialog, ensure that you check the checkbox for Analyze library contents and add dependencies.
7. Make sure that the Target Platform is the standard OSGi framework.
8. Ensure the checkboxes for Unzip the JAR archives into the project and Update references to the JAR files are both checked.
9. Click Next, and then Finish.
10. Click the Runtime tab.
11. Make sure that the Exported Packages list is populated.
12. Make sure packages have been added under the Export-Package header in MANIFEST.MF. Remove the version information in the MANIFEST.MF file. Version numbers can cause conflicts when you upload the OSGi bundle to Adobe CQ.
13. Also make sure that the Import-Package header in MANIFEST.MF is also populated.
14. Save the project.
15. Build the OSGi bundle by right-clicking the project in the left pane, choose Export, Plug-in Development, Deployable plug-ins and fragments, and click Next.
16. Select a location for the export (C:\TEMP) and click Finish. (Ignore any error messages).
17. In C:\TEMP\plugins, you should now find the OSGi bundle.
18. Login to Adobe CQ’s Apache Felix Web Console at http://server:port/system/console/bundles (default admin user = admin with password= admin).
19. Sort the bundle list by Id and note the Id of the last bundle.
20. Click the Install/Update button.
21. Check the Start Bundle checkbox.
22. Browse to the bundle JAR file you just built. (C:\TEMP\plugins).
23. Click Install.
24. Click the Refresh Packages button.
25. Check the bundle with the highest Id.
26. Your new bundle should now be listed with the status Active.
27. If the status is not Active, check the CQ error.log for exceptions. If you get “org.osgi.framework.BundleException: Unresolved constraint” errors, check the MANIFEST.MF for strict version requirements which might follow: javax.xml.namespace; version=”3.1.0”
28. If the version requirement causes problems, remove it so that the entry looks like this: javax.xml.namespace.
29. If the entry is not required, remove it entirely.
30. Rebuild the bundle.
31. Delete the previous bundle and deploy the new one.