2 Replies Latest reply on Dec 1, 2008 12:14 PM by vickyk

    How to set HSQLDB datasource in JBoss

    ravickota

      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.