cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Graaf, Edgar de (fin)" <Edgar.de.Gr...@ordina.nl>
Subject RE: newbe database question
Date Mon, 29 Apr 2002 08:45:38 GMT
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:c.watson@zen.co.uk]
Verzonden: maandag 29 april 2002 10:38
Aan: cocoon-users@xml.apache.org
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:Edgar.de.Graaf@ordina.nl]
Sent: 29 April 2002 08:18
To: 'cocoon-users@xml.apache.org'
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: JavaMBH@aol.com [mailto:JavaMBH@aol.com]
Verzonden: zondag 28 april 2002 0:09
Aan: cocoon-users@xml.apache.org
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: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>

---------------------------------------------------------------------
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: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message