Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

HSQLdb server creation problem

843859Jul 27 2007 — edited Jul 31 2007
I have rattled my brain on this now for a few days. i have searched hi and low, and cant find an example on creating a server for the Data base HSQLdb,

there is the code that i am using, the problem is it always returns as the discriptor "shutdown" and i dont know what i am doing wrong,

thus NO client can connect to it,
  public void setUp ()
    {
         try
        {
            Class.forName ("org.hsqldb.jdbcDriver");
           // Connection c = DriverManager.getConnection (urlr, user, password);
        }
        catch (Exception e)
        {
            e.printStackTrace ();
        }
        String db_name = "mydb";
        String serverProps;
        String url = "jdbc:hsqldb:file:mydb";
        String user     = "sa";
        String password = "";
        
        System.out.println ("network mode");
        
        server = new Server ();
       
        server.setRestartOnShutdown (true);
        server.setDatabaseName (0, db_name);
        server.setDatabasePath (0, url);
        server.setLogWriter (null);
        server.setErrWriter (null);
         server.start ();
        //server.setPort (5000);
        //server.start();
          System.out.println (server.getStateDescriptor ());
         System.out.println (server.getAddress ());
        String urlr = "jdbc:hsqldb:hsql://localhost:mydb";
        
        try
        {
            Class.forName ("org.hsqldb.jdbcDriver");
            Connection c = DriverManager.getConnection (urlr, user, password);
        }
        catch (Exception e)
        {
            e.printStackTrace ();
        }
    }
can any one please help me out?? with a link to a code on setting up a server? or any thing, i just find lots of code to make the clients (that i can do) but his server thing is just not working.

Thanks

David
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 28 2007
Added on Jul 27 2007
7 comments
309 views