cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Oliver <res1c...@verizon.net>
Subject Re: Database.js
Date Thu, 21 Aug 2003 01:14:57 GMT
I just checked in a fix for this. The problem was that it wasn't using FOM.

Steven Noels wrote:

> Hi peeps,
>
> I'm messing around with the GetTogether registration page, which gives 
> me a chance to test all this new wonderful Woody & flow stuff, but I'm 
> stuck on the usage of Database.js. I'm not planning to use any O/R 
> mapping, since I'll have two tables at most.
>
> In PetStoreImpl.js, there's a code fragment that reads:
>
> PetStore.prototype.getConnection = function(id) {
>     if (true) {
>         // temporary hack to avoid requiring datasource config in 
> cocoon.xconf
>         java.lang.Class.forName("org.hsqldb.jdbcDriver");
>         var jdbc = 
> java.sql.DriverManager.getConnection("jdbc:hsqldb:.", "sa", "")
>         var conn = new Database(jdbc);
>         if (this.hsql == null) {
>             // keep hsql in-memory database alive
>             this.hsql = 
> java.sql.DriverManager.getConnection("jdbc:hsqldb:.", "sa", "");
>         }
>         return conn;
>     } else {
>         // lookup datasource in cocoon.xconf
>         return Database.getConnection(id);
>     }
> }
>
> but since I want to use my cocoon.xconf datasources config, I'm trying 
> to set up a connection using:
>
> cocoon.load("resource://org/apache/cocoon/components/flow/javascript/Database.js"); 
>
>
> Registration.prototype.getConnection = function(id) {
>     return Database.getConnection(id);
> }
>
> and:
>
> var conn = this.getConnection(id);
>
> somewhere.
>
> I'm greeted however with the interesting message: The undefined value 
> has no properties. Has anyone already played with this? I'm looking 
> for a snippet of sample code, without the weight that Petstore 
> carries, to open a connection to a cocoon.xconf-defined pool.
>
> Thanks,
>
> </Steven>




Mime
View raw message