Hi Roger,
first of all the 'Storage' property describes the storage where the
files of the database should be stored into. Open a odb with unzip and
you'll see that in the folder database all files exists which hsqldb uses.
The URL is the url to the odb file. You could use the simple JDBC
approach with all it's limitations (alter table, and so on) and set the
URL and Storage property in your content.xml file. That should work.
The simplest way is to get the property 'Info' from the data source and
extend it by the zwo. Afterwards get the database document from the data
source (Interface) and store it. Now the 2 props should be in you odb file.
Best regards,
Ocke
Roger Keays wrote:
Hi Ocke,
the code you are searching for, if I get you right is
dba/dbaccess/source/core/dataaccess/datasource.cxx
I saw those two PropertyValues (URL and Storage) in the code but am
wondering if there is a simple way to override them. Can you hard-code
them into your .odb content.xml? I tried are few different places
(including the datasource registry entries) but wasn't successful.
Could they be updated with a macro? Or maybe a dialog where we can
edit the drivers properties as returned by getPropertyInfo()?
I'm trying to avoid having to set up a build environment if at all
possible ;)
Cheers,
Roger
PS What is the 'Storage' PropertyValue for?
if ( m_pImpl->isEmbeddedDatabase() )
{
sal_Int32 nCount = aDriverInfo.getLength();
aDriverInfo.realloc(nCount + 2 );
aDriverInfo[nCount].Name =
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL"));
aDriverInfo[nCount++].Value <<= m_pImpl->getURL();
aDriverInfo[nCount].Name =
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Storage"));
Reference< css::document::XDocumentSubStorageSupplier>
xDocSup( m_pImpl->getDocumentSubStorageSupplier() );
aDriverInfo[nCount++].Value <<=
xDocSup->getDocumentSubStorage(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("database")),ElementModes::READWRITE);
}
You could set some extra properties to let the driver know where to
find the database file.
I hope this helps.
Best regards,
Ocke
Roger Keays wrote:
Hi there,
I am looking for a neat way to separate database frontend & backend
while making it as simple as possible to distribute the product. i.e:
* the backend must be file based
* the backend is preferrably a single file
* the end user only needs to have OOo 2
* there is no loss of OOo features by the chosen database
I've investigated many different options but I think the best
solution would be to use OOo's native hysqldb as the backend, but
packaged as a separate .odb file. I like this idea because OOo comes
with the hysqldb drivers and hysqldb has very closely mapped JDBC
data types (a development preference).
You can, of course, already do this by using a JDBC backend with the
hysqldb driver but there are a few niggling caveats:
* you can't alter columns with the JDBC bridge (annoying for dev)
* hsqldb generates a number of files for a single database
* the user needs to issue an SQL SHUTDOWN before closing the db
Now... OOo also comes with a SDBC driver for hsqldb right? If I
could figure out how to reuse this I think at least the first two
problems would be solved. Following the instructions at
http://dba.openoffice.org/howto/UserDefinedDriverUI.html it's
possible to connect to an sdbc:embedded:hsqldb, but I can't see any
way to specify a filename which indicates where the database is
embedded.
Would this be possible without any changes to the OOo source?
Alternatively, how difficult would it be to write an additional
hysqldb SDBC driver (or patch the existing one) to allow the
filename to be specified?
Thanks in advance,
Roger
--
Ocke Janssen Tel: +49 40 23646 661, x66661
Dipl. Inf(FH) Fax: +49 40 23646 550
Sun Microsystems Inc.
Sachsenfeld 4 mailto:[EMAIL PROTECTED]
D-20097 Hamburg http://www.sun.com/staroffice
Example isn't another way to teach,
it is the only way to teach.
Albert Einstein
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]