Anyone have ANY clues as to what my be happening?
R
Charles Anthony wrote:
-----Original Message-----
From: Thomas Mahler [mailto:[EMAIL PROTECTED]
Sent: 12 April 2004 07:06
To: OJB Users List
Subject: Re: HSQLDB Issue
[...]
The other issue is that I can't seem to find a way to getOJB to find
the hsqldb script and data files directly within the exploded war directory. What's the trick there? I want to be able todeliver a war
file to users, have it explode, then the app is just up andrunning with
no configuration necessary... what's the trick?This is not an OJB issue, it's caused by HSQLDB.
I've been looking for this feature for ages! This would make usage of hsqldb extremely simple in web apps!
The bad news is that I don't think that it is possible with current versions of HSQLDB.
You have to use the complete filesystem path in the OJB connection descriptor.
I am sure I'm missing something, but couldn't you just use the classloader
to find the location of the database ?
Assuming the database was called "mydb", I believe the following should work out the jdbc URL of the HSQL DB :
ClassLoader cl = Thread.currentThread().getContextClassLoader(); URL url = cl.getResource("mydb.properties"); /* URL probably is file://pathtothefile */ if(url!=null){ /* Get rid of the leading '/' - probably not required on non-windows os's */ String path = url.getPath().substring(1);
/* Remove the .properties from the end */ path = path.substring(0, path.lastIndexOf('.'));
String databaseUrl = "jdbc:hsqldb:" + path;
}
You could then dynamically modify the Connection descriptor in the metadata.
I, myself, think it's a bit dodgy to assume that the WAR file is definitely exploded. I would suggest that you use the classloader (and a bit more jiggery-pokery) to copy the database from the WAR to a temporary directory - a bit more complex, but probably safer (but then, what happens when the OS/restarts ? the db disappears.)
Cheers,
Charles.
:-( Maybe we should approach the hsqldb guys to add this feature?
cheers, Thomas
[ERROR] SequenceManagerHighLowImpl - -Can't lookup newHighLowSequence
for field browserID using sequence name SEQ_CDPCNO_BROWSERS <org.apache.ojb.broker.PersistenceBrokerException: Can't lookup a connection: Can't get connection from DBCP-DataSource: java.util.NoSuchElementException>java.sql.SQLException: java.util.NoSuchElementExceptionorg.apache.commons.dbcp.PoolingDataSource.getConnection(Poolin
at
gDataSource.java:112)
atorg.apache.ojb.broker.accesslayer.ConnectionFactoryDBCPImpl.ge
tConnectionFromPool(ConnectionFactoryDBCPImpl.java:56)
atorg.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImp
l.lookupConnection(ConnectionFactoryAbstractImpl.java:101)
atorg.apache.ojb.broker.accesslayer.ConnectionManagerImpl.getCon
nection(ConnectionManagerImpl.java:144)
atorg.apache.ojb.broker.accesslayer.ConnectionManagerImpl.localB
egin(ConnectionManagerImpl.java:186)
them from
The sql for the tables is, maybe I got the wrong ones? (Got
the OJB samples)KEY(TABLENAME,FIELDNAME))
CREATE TABLE OJB_HL_SEQ(TABLENAME VARCHAR(175) NOT NULL,FIELDNAME VARCHAR(70) NOT NULL,MAX_KEY INTEGER,GRAB_SIZE INTEGER,VERSION INTEGER,CONSTRAINT SYS_PK_OJB_HL_SEQ PRIMARY
CREATE TABLE OJB_LOCKENTRY(OID_ VARCHAR(250) NOT NULL,TX_IDVARCHAR(50)
NOT NULL,TIMESTAMP_ TIMESTAMP,ISOLATIONLEVEL INTEGER,LOCKTYPE INTEGER,CONSTRAINT SYS_PK_OJB_LOCKENTRY PRIMARY KEY(OID_,TX_ID))KEY,SIZE_ INTEGER)
CREATE TABLE OJB_NRM(NAME VARCHAR(250) NOT NULL PRIMARY KEY,OID_ LONGVARBINARY)
CREATE TABLE OJB_DLIST(ID INTEGER NOT NULL PRIMARY
CREATE TABLE OJB_DLIST_ENTRIES(ID INTEGER NOT NULL PRIMARYKEY,DLIST_ID
INTEGER,POSITION_ INTEGER,OID_ LONGVARBINARY)KEY,DLIST_ID
CREATE TABLE OJB_DSET(ID INTEGER NOT NULL PRIMARY KEY,SIZE_ INTEGER)
CREATE TABLE OJB_DSET_ENTRIES(ID INTEGER NOT NULL PRIMARY
INTEGER,POSITION_ INTEGER,OID_ LONGVARBINARY)KEY,DMAP_ID
CREATE TABLE OJB_DMAP(ID INTEGER NOT NULL PRIMARY KEY,SIZE_ INTEGER)
CREATE TABLE OJB_DMAP_ENTRIES(ID INTEGER NOT NULL PRIMARY
INTEGER,KEY_OID LONGVARBINARY,VALUE_OID LONGVARBINARY)---------------------------------------------------------------------
TIA R
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
___________________________________________________________
HPD Software Ltd. - Helping Business Finance Business
Email terms and conditions: www.hpdsoftware.com/disclaimer
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
