How to connect to specific Schema in H2

h2, java

Solution

There is such feature supported. See this:

http://www.h2database.com/html/grammar.html#set_schema

You can specify the schema in the connection string:

jdbc:h2:test;SCHEMA=SCHEMA_NAME

You can also change the current schema with:

SET SCHEMA SCHEMA_NAME;

Hope this helps.

Problem

So I have created a few schema in H2. How can I connect to a specific schema in H2 For example when I need to connect to a specific schema in SQL Server I have below JDBC URL ``` jdbc:sqlserver://HOSTNAME:PORT;SelectMethod=cursor;instanceName=MYSCHEMA;databaseName=DBNAME ``` Is this feature available in H2. If not is there a workaround. I do not want to always access a particular table in my schema instance be accessed like `MYSCHEMA.TABLE_NAME` Otherwise I suppose only way out will be to create all table into the default schema that is public

Original source