Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO/Hibernate] How to access hsqldb database?
[CDO/Hibernate] How to access hsqldb database? [message #823195] Sat, 17 March 2012 23:33 Go to next message
Daniel Bali is currently offline Daniel BaliFriend
Messages: 15
Registered: February 2012
Junior Member
Hello!

I followed the CDO/Hibernate Store tutorial, and downloaded 3 example projects from the repository.
(org.eclipse.emf.cdo.examples.company,
org.eclipse.emf.cdo.examples.hibernate.client,
org.eclipse.emf.cdo.examples.hibernate.server)

How can I find the url where the hsqldb database is stored?
In the cdo-server.xml there is a line:
<property name="hibernate.connection.url" value="jdbc:hsqldb:mem:cdohibernate"/>


But if I try to connect to the database with the following code, and read the table names using DatabaseMetaData, I only get the system tables, and no evidence that anything was written to the database.

Class.forName("org.hsqldb.jdbcDriver");
Connection conn = DriverManager.getConnection("jdbc:hsqldb:mem:cdohibernate", "sa", "");
DatabaseMetaData meta = conn.getMetaData();
ResultSet res = meta.getTables(null, null, null, null);
// read data from result set


Am I connecting to the wrong url?
If so, what is the correct url?

Thanks in advance!
Daniel
Re: [CDO/Hibernate] How to access hsqldb database? [message #823502 is a reply to message #823195] Sun, 18 March 2012 11:59 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Daniel,
I don't know hsqldb that well myself, the database is an in-memory database (as the url indicates), so I guess you have
to connect while being in the same jvm instance at runtime as the cdo server. If you connect in a separate jvm then you
will probably only see the system tables.

gr. Martin

On 03/18/2012 12:33 AM, Daniel Bali wrote:

> Hello!
>
> I followed the CDO/Hibernate Store tutorial, and downloaded 3 example projects from the repository.
> (org.eclipse.emf.cdo.examples.company,
> org.eclipse.emf.cdo.examples.hibernate.client,
> org.eclipse.emf.cdo.examples.hibernate.server)
>
> How can I find the url where the hsqldb database is stored?
> In the cdo-server.xml there is a line:
> <property name="hibernate.connection.url" value="jdbc:hsqldb:mem:cdohibernate"/>
>
> But if I try to connect to the database with the following code, and read the table names using DatabaseMetaData, I only
> get the system tables, and no evidence that anything was written to the database.
>
>
> Class.forName("org.hsqldb.jdbcDriver");
> Connection conn = DriverManager.getConnection("jdbc:hsqldb:mem:cdohibernate", "sa", "");
> DatabaseMetaData meta = conn.getMetaData();
> ResultSet res = meta.getTables(null, null, null, null);
> // read data from result set
>
>
> Am I connecting to the wrong url?
> If so, what is the correct url?
>
> Thanks in advance!
> Daniel


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: [CDO/Hibernate] How to access hsqldb database? [message #823503 is a reply to message #823195] Sun, 18 March 2012 12:03 Go to previous message
Daniel Bali is currently offline Daniel BaliFriend
Messages: 15
Registered: February 2012
Junior Member
My problem is partially solved now!
I was able to reach the database using the following url:
jdbc:hsqldb:file://D:/test


What I still don't understand is why didn't this work with the original url in the cdo-server.xml

Edit:
Thank you Martin! I just saw your reply after posting. I'm not sure I can connect from the same jvm since the original runs the server. Anyway, I can still work with the "file" solution for now.

Thanks!

[Updated on: Sun, 18 March 2012 12:04]

Report message to a moderator

Previous Topic:Synchronous Collaborative Modeling Tools
Next Topic:Handling future model changes
Goto Forum:
  


Current Time: Fri Apr 26 17:53:35 GMT 2024

Powered by FUDForum. Page generated in 0.03081 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top