cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Cocoon Wiki] Update of "Access" by JosephPecore
Date Mon, 20 Jun 2005 13:35:19 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Cocoon Wiki" for change notification.

The following page has been changed by JosephPecore:
http://wiki.apache.org/cocoon/Access

New page:
= Connection to Microsoft Access (via odbc) =
This document explains the specific aspects of connecting Cocoon to a Microsoft Access Database
via odbc. 
This should work with any odbc compliant data source.

For a general explanation on database connections please refer to the [http://cocoon.apache.org/2.1/developing/datasources.html
official Cocoon documentation ].

== Installing the JDBC drivers ==

 *  odbc is part of JDK, so you don't need to install anything.

== Setting the web.xml configuration ==

In the $COCOON_LIB/WEB-INF/ directory you will find the web.xml file. Open it and look for
this rows {{{
<init-param>
  <param-name>load-class</param-name> 
    <param-value>
         }}}
here you have to add the following line:
{{{
<!-- For ODBC: -->
         sun.jdbc.odbc.JdbcOdbcDriver

}}}

== Setting the cocoon.xconf configuration ==

Search for:
{{{<datasources>}}}
add into this element these lines:
{{{
  <jdbc name="YourPoolName">
    <pool-controller min="5" max="10"/>
    <dburl>jdbc:odbc:YourODBCSourceName</dburl>
    <user>YourUsername</user>
    <password>YourPassword</password>
  </jdbc>
}}}


== Setting the sitemap.xmap configuration ==

When you want to use the connection with the SQLTransformer you just call the JDBC name inside
the pipeline in this way:
{{{
<map:match pattern="sqlquery">
  <map:generate src="sql/sqlquery.xml"/>
  <map:transform type="sql">
    <map:parameter name="use-connection" value="YourPoolName"/>
  </map:transform>
  <map:transform type="xslt" src="../stylesheets/transformation.xslt"/>
  <map:serialize />
</map:match>
}}}
Obviously you have to adapt this sample to fill your need.[[BR]]
SpecificDatabaseConnection

== Setting up ODBC Source
Windows:
a. Start > Settings > Control Panel > Administrative Tools > Data sources (ODBC)
b. Select the tab labeled ‘System DSN’   (I tried User DSN, but it did not work!)
c. Click ‘Add’
d. Select the type of data source you want to create, e.g. Microsoft Access Driver
e. Supply a name for the data source (This needs to match the YourODBCSourceName cocoon.xconf!
f. The ‘description’ is optional
g. Click the ‘Select’ button under ‘Database’ to bring-up a file browse dialog
h. Use the dialog to select the database file 

== Comments from the readers ==

Mime
View raw message