javadatabasehsqldbhypersql

Can't connect to HyperSQL / HSQLDB database as new user


I have started HyperSQL like this:

java -cp hsqldb.jar org.hsqldb.server.Server --database.0 file:/data/db --dbname.0 some_db 

Then if I try to connect to it like:

DriverManager.getConnection("jdbc:hsqldb:hsql://localhost/some_db", "SA", "");

Everything works fine. Now when I add new user like:

CREATE USER new_user PASSWORD "some_password" ADMIN;

I can not connect to HyperSQL server using new user data (also after restarting):

   DriverManager.getConnection("jdbc:hsqldb:hsql://localhost/some_db", "new_user", "some_password");

Any suggestions?


Solution

  • The user name is case-sensitive only if it is double-quoted when created

    CREATE USER "new_user" PASSWORD "some_password" ADMIN;
    DriverManager.getConnection("jdbc:hsqldb:hsql://localhost/some_db", "new_user", "some_password");
    

    In your example, the actual user name is NEW_USER and you can connect as this user if you use uppercase in connection sting.