nawara
nawara

Reputation: 1167

Using HSQLDB in the embedded mode

I'm currently developing a java desktop application using netbeans + hibernate + hsqldb in embedded mode.

While creating a new database I got this exception: Cannot establish a connection to jdbc:hsqldb:hsql://localhost using org.hsqldb.jdbcDriver (java.net.ConnectException: Connection refused: connect)

enter image description here

Upvotes: 3

Views: 14289

Answers (1)

fredt
fredt

Reputation: 24382

The URL jdbc:hsqldb:hsql://localhost is for access to an HSQLDB server running on the local machine. If you want to use HSQLDB this way, your application must start this server before connecting to it. The client/server method of access is actually a good idea for developing the application, because you can access the server from outside your app at the same time.

For development, you can start the server outside your app from the command line. The server can keep running when you restart the app.

The URL for an embedded mode database with files is jdbc:hsqldb:file:<your file path> and is documented in the HSQLDB Guide.

http://hsqldb.org/doc/

Upvotes: 7

Related Questions