5 Replies Latest reply on Dec 18, 2006 11:38 PM by César Arrieta

    HSQLDB connection problem

    César Arrieta Newbie

      Hi..im trying to make a connection to hsqldb using jdbc..i started the server running hsqldb and it works fine, but when i try to make a connection to hsqldb, jboss cant load the class.forname("org.hsqldb.jdbcDriver")..it says NullPointer exception...

        • 1. Re: HSQLDB connection problem
          Weston M. Price Master

          I am not sure what you are saying. Do you want to use HSQLDB outside of JBoss, are you having a problem looking up your datasource, what?

          Please read:

          http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossHelp

          Also, you should take a look at all the sticky threads at the beginning of this forum. This provides more information on how to ask for help.

          • 2. Re: HSQLDB connection problem
            César Arrieta Newbie

            Hi..the problem is that im doing a DataBaseManagerImpl.java that connects to the hypersonic database, i made a web interface too, the App.ear is in server/default/deploy and works fine until I try to use this following method in the DatabaseManagerImpl.java:

            private Connection getConnection (){

            Connection conexion=null;
            String URLConexion = "jdbc:hsqldb:hsql://localhost:1701";
            try{
            Class.forName("org.hsqldb.jdbcDriver");
            }catch(Exception e){System.out.println("Error loading HSQLDB JDBC");}
            try{
            //Properties pr = new Properties();
            //conexion = DriverManager.getConnection(URLConexion,pr);
            conexion = DriverManager.getConnection(URLConexion);
            }catch(SQLException e)
            {
            };
            return conexion;
            }

            When I try to use a method that use getConnection() JBoss throws an Error that says Error loading HSQLDB JDBC..but the hsqldb libs are already in the jboss3.5.2/server/default/lib..they are hsqldb.jar and hasqldb-plugin.jar...could you help me??..could it be that hsqldb has another jdbc libs?? thanks

            • 3. Re: HSQLDB connection problem
              Weston M. Price Master

              Ok, a few things:

              1) What you are trying to do is outside of JCA and really isn't applicable to this forum.

              2) Hypersonic already provides a DataBase Service interface and can be enabled and used via JMX.

              3) To do what you want, you would have to explicitly enable Hypersonic to accept TCP connections. By default, it is only used via in memory and does not allow for TCP based interactions. Check your hsqldb-ds.xml file in your deploy directory for examples of how to do this.

              • 4. Re: HSQLDB connection problem
                César Arrieta Newbie

                Hi..thanks..I already used the Database Service Interface via JMX and enabled TCP connections by making some changes in the hsqldb-ds.xml..my problem occurs when i try to load the org.hsqldb.jdbcDriver, is like it didnt find the hsqldb libs in the jboss/server/default/lib...I dont know why it works with JBoss server and not with my App.ear..do you know if there is a way to explicitly say to my App.ear how to find the hsqldb libs?? I think that could be the solution to my problem...thanks again

                • 5. Re: HSQLDB connection problem
                  César Arrieta Newbie

                  Hi..i found the error i was trying to make a connection in oder way...the way of my getconnection now is:

                  private Connection getConnection (){
                  try {
                  InitialContext ctxt = new InitialContext();
                  DataSource ds = (DataSource) ctxt.lookup("java:DefaultDS");
                  conexion = ds.getConnection();
                  }
                  catch (Exception except) {
                  System.out.println("Error al obtener conexion");
                  }
                  return conexion;
                  }

                  that was all..thanks