4.4.4 Setting a plugin for database connection processing
To set database connection processing in a plugin, you need to edit the two files (web.xml and cosminexus.xml) to add resource adapter information. The following shows the storage location and editing contents of each file.
- Important note
-
To edit web.xml and cosminexus.xml, use the editor started by selecting Run as administrator.
- Organization of this subsection
(1) Editing web.xml
Add the resource definition to the web.xml file of the User Plugin. The web.xml file is stored in:
Navigation-Platform-for-Developers-installation-directory\pluginSDK\plugin\plugin-ID\WEB-INF\web.xml
The following shows a coding example when the resource reference name is jdbc/TP_Connector_for_HiRDB_Type4:
<resource-ref> <res-ref-name>jdbc/TP_Connector_for_HiRDB_Type4</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref>
Add the above lines to immediately before </web-app> at the end of the web.xml file.
(2) Editing cosminexus.xml
Edit the cosminexus.xml file of the User Plugin.
The following shows the cosminexus.xml file is stored in:
Navigation-Platform-for-Developers-installation-directory\pluginSDK\plugin\plugin-ID\dd\META-INF\cosminexus.xml
The following shows a coding example when the resource reference name is jdbc/TP_Connector_for_HiRDB_Type4 and the resource adapter display name is TP_Connector_for_HiRDB_Type4:
<resource-ref> <res-ref-name>jdbc/TP_Connector_for_HiRDB_Type4</res-ref-name> <linked-to>TP_Connector_for_HiRDB_Type4</linked-to> </resource-ref>
Add the above lines to immediately before </war> at the end of the cosminexus.xml file.