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>
--
Steven Noels                            http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
Read my weblog at            http://blogs.cocoondev.org/stevenn/
stevenn at outerthought.org                stevenn at apache.org



Reply via email to