Stevan
Stevan

Reputation: 31

Run Hypersonic db on Tomee in server mode

I am facing next issue. In my company we are moving Hypersonic db from Jboss to TomEE server (apache-tomee-plus-7.0.1). All necessary libraries, according to Hypersonic documentation are in lib directory of server (by default).

I want, when server is starting to start running Hypersonic database in server mode (on specific port) from configuration so that a webapp that is deployed on the same server can connect to it.

Here is our resource config in tomee.xml:

<Resource id="HSQLDB Database" type="DataSource">
    jdbcDriver = org.hsqldb.jdbcDriver
    jdbcUrl = jdbc:hsqldb:hsql://127.0.0.1:9001
    userName = sa
    password =
</Resource>

But when server is starting, we get next error:

org.apache.openejb.assembler.classic.Assembler.createRecipe Creating Resource(id=HSQLDB Database)
16-Sep-2016 13:14:05.145 SEVERE [main] org.apache.tomcat.jdbc.pool.ConnectionPool.init Unable to create initial    connections of pool.
java.sql.SQLTransientConnectionException: java.net.ConnectException: Connection refused: connect

Can someone tell me what are we doing wrong and how do we successfully deploy Hypersonic db on Tomee in server mode?

Upvotes: 1

Views: 176

Answers (1)

Nikolas
Nikolas

Reputation: 44368

I see you have not specified the name of database and alias to be connected to. Both of the following URLs' should work well. HSQL database uses defaultly the port 9001. If there haven't been set differently, all the followings URLs should work well:

jdbc:hsqldb:hsql://localhost:9001/myDatabase
jdbc:hsqldb:hsql://127.0.0.1:9001/myDatabase
jdbc:hsqldb:hsql://localhost/myDatabase
jdbc:hsqldb:hsql://127.0.0.1/myDatabase

Before you connect to database with Java, you've to start your server up in a terminal:

java -cp C:/----/hsqldb-2.3.4/lib/hsqldb.jar org.hsqldb.server.Server --database.0 file:myDatabase --dbname.0 myDatabase

Don't forget to specify the full path to hsqldb.jar.

Upvotes: 2

Related Questions