Christopher,

It wasn't original my question. I try to help someone else a bit. But thanks
anyway! In the future I might try it out...

Regards,

Edgar

-----Oorspronkelijk bericht-----
Van: Christopher Watson [mailto:[EMAIL PROTECTED]]
Verzonden: maandag 29 april 2002 10:38
Aan: [EMAIL PROTECTED]
Onderwerp: RE: newbe database question


Edgar

The documentation is out of date. Someone helped me with this earlier.
It needs some different Avalon type stuff
Try this example xsp page which gets the URL from the metadata (or the
Exception) as a check
For XSP at least, it NEEDS to be in a try block or it won't compile.

<?xml version="1.0"?>
<xsp:page language="java"
          xmlns:xsp="http://apache.org/xsp";
>
 <page>
<xsp:logic>
String fish="flounder";
try {
        ComponentSelector mySelector = (ComponentSelector)
manager.lookup(DataSourceComponent.ROLE + "Selector");
// edit following line as necessary
        DataSourceComponent myDatasource =
(DataSourceComponent)mySelector.select("myCocoonXconfEntry");
      java.sql.Connection myConnection = myDatasource.getConnection();
      java.sql.DatabaseMetaData dbmd = myConnection.getMetaData();
      fish = dbmd.getURL();
} catch (Exception esqlFail) {
        fish="" + esqlFail;
}
<dbURL><xsp:expr>fish</xsp:expr></dbURL>
</xsp:logic>
</page>
</xsp:page>

Which is adapted from looking at the file generated from an esql xsp.

I think the point in the docs about leaving the connection open still
stands,
I imagine the pooling delas with this
though perhaps someone more knowing could comment?

Christopher Watson


-----Original Message-----
From: Graaf, Edgar de (fin) [mailto:[EMAIL PROTECTED]]
Sent: 29 April 2002 08:18
To: '[EMAIL PROTECTED]'
Subject: RE: newbe database question


I can't find roles in the cocoon jar either. But it is in j2ee.jar (maybe
you have to get it from Sun first). Maybe it is not the one you search for,
but then again I have never tried to make a database connection like this.
(by the way: com.sun.enterprise.deployment.Roles)
www.cocooncenter.de may offer some help.....

http://www.cocooncenter.de/cc/documents/resources/db-app/index.html

Regards,

Edgar
-----Oorspronkelijk bericht-----
Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Verzonden: zondag 28 april 2002 0:09
Aan: [EMAIL PROTECTED]
Onderwerp: newbe database question


I just started developing with cocoon and I have a basic question (I think).

I'm trying to use the datasource pooled connection like what is detailed in
the cocoon user guide but I'm having trouble location the
org.apache.cocoon.Roles class. I have the web.xml files and the cocoon.xconf
files configured correctly because I can see the connections being created
when I start cocoon. But my import statement fails when I try to compile my
class that implements Avalon Composable ifc because it can't find the
Roles.class file in any of the jars.

Can someone please let me know where I can find it.

Thanks in advance.

matt


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to