0 Replies Latest reply on Apr 10, 2010 12:16 AM by dvenkatesan

    Hypersonic DB - Jboss AS 6.0.M1- Datasource/Tables unaccessible from JSP pages

    dvenkatesan

      Hello,

       

      I want to acces Hypersonic database localDB (table name "Customer") from my JSP page.

       

      I am missing some configuration information while seting up a database in Hypersonic/JBoss AS 6.0.

       

      Due to this I am unable to access the tables from my JSP page.

       

      Can someone help me to fix this and tell me where should I set things right?

       

      Thanks for your kind attention.....

       

      Regards,

      Venkatesan  D. Pillai

       

      PS: I paste herewith the JBOSS console error, hsqldb-ds.xml for your info. pls.

      ==============

      0) My JSP program snippet

      ###################################

           .....

        <%
          Connection conn = null;
          ResultSet result = null;
          Statement stmt = null;

       

         System.out.println("I AM HERE ..........1111");

       

          try {
            Class c = Class.forName("org.hsqldb.jdbcDriver");
         System.out.println("I AM HERE ..........2222");
          }
          catch (Exception e) {
            System.out.println("Error occurred " + e);
           }
           try {
             conn = DriverManager.getConnection("jdbc:hsqldb:/home/venkat/downloads/jboss-6.0.0.M1/server/default/data/hypersonic/localDB", "sa","");
         System.out.println("I AM HERE ..........33333");
           }
           catch (SQLException e) {
              System.out.println("Error occurred " + e);
           }
           try {
              stmt = conn.createStatement();
         System.out.println("I AM HERE ..........44444");
              result = stmt.executeQuery("SELECT * FROM PUBLIC.Customer");
         System.out.println("I AM HERE ..........55555");
      if (result.next()) {
      %>
            <table width="100%" border="1">

      .......................

       

      1) JBoss AS Console error

      ##########################

      ................

       

      05:30:07,677 INFO  [STDOUT] [Server@1724ca6]: Startup sequence initiated from main() method
      05:30:07,677 INFO  [STDOUT] [Server@1724ca6]: Loaded properties from [/home/venkat/Downloads/jboss-6.0.0.M1/bin/server.properties]
      05:30:07,688 INFO  [STDOUT] [Server@1724ca6]: Initiating startup sequence...
      05:30:07,711 INFO  [STDOUT] [Server@1724ca6]: Server socket opened successfully in 4 ms.
      05:30:08,285 INFO  [STDOUT] [Server@1724ca6]: Database [index=0, id=1, db=file:/home/venkat/Downloads/jboss-6.0.0.M1/server/default/data/hypersonic/default, alias=] opened sucessfully in 566 ms.
      05:30:08,285 INFO  [STDOUT] [Server@1724ca6]: Startup sequence completed in 580 ms.
      05:30:08,443 INFO  [STDOUT] [Server@1724ca6]: 2010-04-10 05:30:08.442 HSQLDB server 1.8.0 is online
      05:30:08,443 INFO  [STDOUT] [Server@1724ca6]: To close normally, connect and execute SHUTDOWN SQL
      05:30:08,443 INFO  [STDOUT] [Server@1724ca6]: From command line, use [Ctrl]+[C] to abort abruptly

       

      ...................................

       

      05:31:49,593 INFO  [STDOUT] I AM HERE ..........1111
      05:31:49,594 INFO  [STDOUT] I AM HERE ..........2222
      05:31:49,792 INFO  [STDOUT] I AM HERE ..........33333
      05:31:49,792 INFO  [STDOUT] I AM HERE ..........44444
      05:31:49,793 ERROR [STDERR] java.sql.SQLException: Table not found in statement [SELECT * FROM PUBLIC.Customer]
      05:31:49,794 ERROR [STDERR]     at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
      05:31:49,794 ERROR [STDERR]     at org.hsqldb.jdbc.jdbcStatement.fetchResult(Unknown Source)
      05:31:49,794 ERROR [STDERR]     at org.hsqldb.jdbc.jdbcStatement.executeQuery(Unknown Source)
      05:31:49,794 ERROR [STDERR]     at org.apache.jsp.jspdb_jsp._jspService(jspdb_jsp.java:88)

      ........................

       

      2) HSQL-DB config. information (snippet)

      ###############################

       

       

      <datasources>
         <local-tx-datasource>

       

            <jndi-name>DefaultDS</jndi-name>
            <connection-url>jdbc:hsqldb:hsql://localhost:1701</connection-url>
            <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB</connection-url>
            <driver-class>org.hsqldb.jdbcDriver</driver-class>

            <user-name>sa</user-name>

            <password></password>

            <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>

            <metadata>
               <type-mapping>Hypersonic SQL</type-mapping>
            </metadata>

            <depends>jboss:service=Hypersonic,database=localDB</depends>

           
         </local-tx-datasource>

       

      <!-- Uncomment if you want hsqldb accessed over tcp (server mode)
         <mbean code="org.jboss.jdbc.HypersonicDatabase"
           name="jboss:service=Hypersonic">
           <attribute name="Port">       
               <value-factory bean="ServiceBindingManager" method="getIntBinding"
                 parameter="jboss:service=Hypersonic"/>
           </attribute>
           <attribute name="BindAddress">       
              <value-factory bean="ServiceBindingManager" method="getStringBinding"
                 parameter="jboss:service=Hypersonic"/>
           </attribute> 

      ..................

      -->

       

         <mbean code="org.jboss.jdbc.HypersonicDatabase"

           name="jboss:service=Hypersonic">
           <attribute name="Port">1701</attribute>                       ##### i did modify this line as I have configured the ServiceBindingManager database ..is this OK?
           <attribute name="BindAddress">localhost</attribute>    ##### i did modify this line as I have configured the ServiceBindingManager database ..is this OK?

           <attribute name="Silent">true</attribute>
           <attribute name="Database">default</attribute>
           <attribute name="Trace">false</attribute>
           <attribute name="No_system_exit">true</attribute>
         </mbean>

       

         <!-- For hsqldb accessed from jboss only, in-process (standalone) mode -->
         <mbean code="org.jboss.jdbc.HypersonicDatabase"
           name="jboss:service=Hypersonic,database=localDB">
           <attribute name="Database">localDB</attribute>
           <attribute name="InProcessMode">true</attribute>
         </mbean>
        
      </datasources>

       

      3) Some issues in hsqldb-ds.xml configuration

      ########################################

         <mbean code="org.jboss.jdbc.HypersonicDatabase"

           name="jboss:service=Hypersonic">

         <attribute name="Port">       
                <value-factory bean="ServiceBindingManager" method="getIntBinding"
                  parameter="jboss:service=Hypersonic"/>
            </attribute>
            <attribute name="BindAddress">       
               <value-factory bean="ServiceBindingManager" method="getStringBinding"
                  parameter="jboss:service=Hypersonic"/>
            </attribute>

       

      "Port, BindAddress" attributes create error in JBossAS console if I leave it as is with VALUE-FACTORY tag. So I replace them with 1701, localhost.

       

      Is this shortccut acceptable?

       

      ==================

      thanks for your help.