Reputation: 1739
In the H2 console I clicked the 'Remove' button on the configurations. After several reinstall's these options are not restored so now my only option is a generic JNDI datasource which I don't want.
How do I restore them?
I am using a Mac.
Upvotes: 2
Views: 2034
Reputation: 12397
Go to the home directory and find this file:
$ cd ~
$ ls -alh | grep "h2"
-rw-r--r-- 1 chaklader staff 1.9K Nov 1 18:02 .h2.server.properties
Open this file .h2.server.properties
in your VSCode or any other editor. Copy this whole file or only the 2 rows that provides the H2 info:
#H2 Server Properties
#Mon Nov 01 18:53:17 BDT 2021
webSSL=false
webAllowOthers=false
webPort=8082
10=Generic DB2|com.ibm.db2.jcc.DB2Driver|jdbc\:db2\://localhost/test|
11=Generic Oracle|oracle.jdbc.driver.OracleDriver|jdbc\:oracle\:thin\:@localhost\:1521\:XE|sa
12=Generic MS SQL Server 2000|com.microsoft.jdbc.sqlserver.SQLServerDriver|jdbc\:microsoft\:sqlserver\://localhost\:1433;DatabaseName\=sqlexpress|sa
13=Generic MS SQL Server 2005|com.microsoft.sqlserver.jdbc.SQLServerDriver|jdbc\:sqlserver\://localhost;DatabaseName\=test|sa
14=Generic PostgreSQL|org.postgresql.Driver|jdbc\:postgresql\:test|
15=Generic MySQL|com.mysql.jdbc.Driver|jdbc\:mysql\://localhost\:3306/test|
16=Generic HSQLDB|org.hsqldb.jdbcDriver|jdbc\:hsqldb\:test;hsqldb.default_table_type\=cached|sa
17=Generic Derby (Server)|org.apache.derby.jdbc.ClientDriver|jdbc\:derby\://localhost\:1527/test;create\=true|sa
18=Generic Derby (Embedded)|org.apache.derby.jdbc.EmbeddedDriver|jdbc\:derby\:test;create\=true|sa
19=Generic H2 (Embedded)|org.h2.Driver|jdbc\:h2\:~/test|sa
0=Generic JNDI Data Source|javax.naming.InitialContext|java\:comp/env/jdbc/Test|sa
1=Generic Teradata|com.teradata.jdbc.TeraDriver|jdbc\:teradata\://whomooz/|
2=Generic Snowflake|com.snowflake.client.jdbc.SnowflakeDriver|jdbc\:snowflake\://accountName.snowflakecomputing.com|
3=Generic Redshift|com.amazon.redshift.jdbc42.Driver|jdbc\:redshift\://endpoint\:5439/database|
4=Generic Impala|org.cloudera.impala.jdbc41.Driver|jdbc\:impala\://clustername\:21050/default|
5=Generic Hive 2|org.apache.hive.jdbc.HiveDriver|jdbc\:hive2\://clustername\:10000/default|
6=Generic Hive|org.apache.hadoop.hive.jdbc.HiveDriver|jdbc\:hive\://clustername\:10000/default|
7=Generic Azure SQL|com.microsoft.sqlserver.jdbc.SQLServerDriver|jdbc\:sqlserver\://name.database.windows.net\:1433|
8=Generic Firebird Server|org.firebirdsql.jdbc.FBDriver|jdbc\:firebirdsql\:localhost\:c\:/temp/firebird/test|sysdba
9=Generic SQLite|org.sqlite.JDBC|jdbc\:sqlite\:test|sa
20=Generic H2 (Server)|org.h2.Driver|jdbc\:h2\:mem\:testdb|sa
Restart the H2 database and in the console you will need to provide the correct URL if you have any custom properties:
spring.jpa.show-sql=true
spring.h2.console.enabled=true
spring.datasource.url=jdbc:h2:mem:testdb
Try with the Generic H2 (Server)
and you should be login now.
Upvotes: 1
Reputation: 51
The configuration file h2.server.properties is located in {userHome} / delete it and re-execute your project, the plugin recreates the file again with the configuration restored.
Upvotes: 0
Reputation: 1739
There is a file in your home called .h2.server.properties.
This stores the config and can be removed and then reinstalled to repopulate this.
Upvotes: 2