File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JBoss/WildFly and the fly likes How to access HSQLDB in server mode Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "How to access HSQLDB in server mode" Watch "How to access HSQLDB in server mode" New topic
Author

How to access HSQLDB in server mode

Schandha Ravi
Ranch Hand

Joined: Oct 20, 2007
Posts: 167
Hi, I wanted to use my application to connect to HSQLDB database running as a separate process via TCP. I'm not sure what changes needs to be made for this. Below are the steps I followed, but ended up with socket creation failure.

I started HSQLDB in server mode, running at 127.0.0.1 and port 9001.

I made the hsqldb-ds.xml reflect like below

code:
--------------------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?> <local-tx-datasource> <jndi-name>DefaultDS</jndi-name> <connection-url>jdbc:hsqldb:hsql://127.0.0.1:9001</connection-url> <driver-class>org.hsqldb.jdbcDriver</driver-class> <user-name>sa</user-name> <min-pool-size>5</min-pool-size> <max-pool-size>20</max-pool-size> <idle-timeout-minutes>0</idle-timeout-minutes> <track-statements/> <security-domain>HsqlDbRealm</security-domain> <prepared-statement-cache-size>32</prepared-statement-cache-size> <type-mapping>Hypersonic SQL</type-mapping> </local-tx-datasource> 9001 127.0.0.1 true default false true

--------------------------------------------------------------------------------



I dropped this xml file in deploy folder of jboss default location (C:\sun\jboss\server\default\deploy) and started my JBoss

I'm recieving the below error


code:
--------------------------------------------------------------------------------

23:32:40,079 ERROR [STDERR] [Server@13d5f21]: [Thread[HSQLDB Server @13d5f21,5,jboss]]: run()/openServerSocket(): 23:32:40,089 ERROR [STDERR] java.net.BindException: Address already in use: JVM_Bind at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359) at java.net.ServerSocket.bind(ServerSocket.java:319) at java.net.ServerSocket.(ServerSocket.java:185) at org.hsqldb.HsqlSocketFactory.createServerSocket(Unknown Source) at org.hsqldb.Server.openServerSocket(Unknown Source) at org.hsqldb.Server.run(Unknown Source) at org.hsqldb.Server.access$000(Unknown Source) at org.hsqldb.Server$ServerThread.run(Unknown Source)

--------------------------------------------------------------------------------



Apparently from the error message, I could see socket connection is not established to DB server. However, I was able to connect to HSQLDB DatabaseManager externally. But having problem with JBoss.

I went and connected using DatabaseManager and I could see some new tables,
HILOSEQUENCES, JMS_MESSAGES, JMS_ROLES, JMS_SUBSCRIPTIONS, JMS_TRANSACTIONS, JMS_USERS being created.

One more thing to mention here is I could not see any statement mentioning that DefaultDS is bound in server.log.


Thanks & Regards, SK
SCJP 5.0, DB2 - 800, DB2 - 803, SCDJWS (On the way)
 
Consider Paul's rocket mass heater.
 
subject: How to access HSQLDB in server mode
 
Similar Threads
Probles in setting datasource
CDATA problem???
Invalid character ':' in value part of property (JBoss-ds.xml)
how to get multiple data sources in jboss
JBM-Tables not created.