Hi  Evgenij ,

Thanks for your quick response. Really appreciate it.

I am using h2db an internal DB using the following command
*jdbc:h2:%base%data\nim-sm-customizations;AUTO_SERVER=TRUE *and it will
create the  nim-sm-customizations.mv file dynamically. This will happen
with every deployment of our web application and the db file and data will
be created afresh.  So here I am not using/reading/writing from any old
database which was created with older versions of h2DB jar.


1. First I will create the  nim-sm-customizations.mv file under data folder
2. I will run some scripts which will insert the default data that is
required to work with the application.



My example scripts will be like below:


drop table if exists nim_entity_types;
create table nim_entity_types(
id int auto_increment,
entity_type varchar(40),
description varchar(255),
last_modified_dt datetime default sysdate,
primary key(entity_type)
);

insert into nim_entity_types (id, entity_type, description) values
(1,'incident','CA NIM incident');
insert into nim_entity_types (id, entity_type, description) values
(2,'request','CA NIM request');
insert into nim_entity_types (id, entity_type, description) values
(3,'attachment','CA NIM attachment');
insert into nim_entity_types (id, entity_type, description) values
(4,'comment','CA NIM comment');
insert into nim_entity_types (id, entity_type, description) values
(5,'change','CA NIM change');
insert into nim_entity_types (id, entity_type, description) values
(6,'problem','CA NIM problem');
insert into nim_entity_types (id, entity_type, description) values
(7,'ticket','CA NIM ticket');
insert into nim_entity_types (id, entity_type, description) values
(8,'user','CA NIM user');
insert into nim_entity_types (id, entity_type, description) values
(9,'group','CA NIM group');
insert into nim_entity_types (id, entity_type, description) values
(10,'Relationship-ci','CA NIM Relationship for CI');
insert into nim_entity_types (id, entity_type, description) values
(11,'Relationship-ticket','CA NIM Relationship for Ticket');

After executing these scripts on server start up it will insert some data
into the h2DB file (which is created afresh) which is a required data for
accessing our application GUI.


*So could you please provide any pointers on the same and let me know if
there are any changes needed in the scripts?*



Thanks,
Balamurali

On Mon, May 17, 2021 at 4:03 PM Evgenij Ryazanov <[email protected]> wrote:

> Hello.
>
> 1. H2 is a small database engine and doesn't have an automatic upgrade
> procedure for database files. Unfortunately, latest releases also didn't
> mark their files as incompatible with older versions, so if you tried to
> open a database file created by one version in another it may lead to
> database corruption. In some cases these files can still be opened by the
> old version, but if you can open them, you should export the file to SQL
> immediately and create a new database with that SQL. The next version of H2
> will mark its files as incompatible with older versions explicitly to avoid
> such issues.
>
> The normal upgrade procedure for H2 is SCRIPT TO 'filename.sql' with the
> OLD version, creation of a new database file with the NEW version and
> execution of RUNSCRIPT FROM 'filename.sql' in it.
> https://h2database.com/html/tutorial.html#upgrade_backup_restore
>
> If you use the same database file in multiple applications, make sure they
> all have the same version of H2.
>
> 2. Unfortunately, 1.4.200 has some storage problems, it is less reliable
> than 1.4.199 in that area and may potentially corrupt database file by
> itself in some cases.
>
> If you have a backup copy, just use it. If it was created by another
> version, use SCRIPT / RUNSCRIPT to copy data to the new database.
>
> If you don't have it, you can try to use the recover tool:
> https://h2database.com/html/advanced.html#using_recover_tool
> If database file was somehow used by different versions of H2, you may
> want to try the all (but make a copy of existing corrupted file and use a
> new copy for each experiment for more safety).
>
> Your application normally should invoke the online backup command from
> time to time:
> https://h2database.com/html/commands.html#backup
>
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/h2-database/5deccc9c-1214-424e-a47a-1d31a0d71df8n%40googlegroups.com
> <https://groups.google.com/d/msgid/h2-database/5deccc9c-1214-424e-a47a-1d31a0d71df8n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/h2-database/CAG6_yCABc2iM2yPQnN8vcqPeDWDqtsbvK6fvjaF1nM02QeOUeA%40mail.gmail.com.

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to