Flyway start with version 1 if using H2 in memory DB - h2

Using Flyway 4.0.1 H2 1.3 baselineOnMigrate=true. When i use H2:mem, flyway start with version 1 in his metadata table. It should start with empty version. When i use disk DB this is not heppening. Any idea?

It is because DB is accessed from diferent classloaders. Every classloader has its own DB. I need to use TCP connection. Details on: Local H2 Server-Client connection with DB running in memory

Related

Unsupported connection setting "MVCC" [90113-200] H2 database

Does anyone know what could be the problem with the connection to the H2 database?
I didn't change anything in my project in terms of database config, and everything worked fine until yesterday.
Now, I cannot run my project locally because the connection craches.
These are the logs from the H2 console:
H2 1.4.197 was the last version of H2 with MVCC setting.
H2 1.4.198 Beta and H2 1.4.199 silently ignore this setting.
H2 1.4.200 and newer versions throw an exception on attempts to use it.
You need to remove ;MVCC=something from JDBC URL. Please also note that H2 1.4.200 is an old unsupported version of H2 database.

Connect to existing hsqldb instance in IDE

I am learning Spring Boot using open-source projects and have stumbled upon their demo project — PetClinic. It has two possible databases configured: MySQL & HSQLDB, it uses the latter by default.
So I was able to launch the project look at it on localhost and can see that the DB (HSQLDB) is being populated but I was unable to set up a connection through the Intellij IDEA because the project does not specify the path that allows to see the contents of this in-memory DB.
Can anyone please tell me, what am I missing in the process of establishing the connection to HSQLDB here?
Thanks!
You can't connect to an in-memory instance of HSQLDB from another process.
The main drawback [of in-memory mode] is that it is not possible by default to connect to
the database from outside your application. As a result you cannot
check the contents of the database with external tools such as
Database Manager while your application is running.
If you want to do this, you need to run HSQL as a server. More details about how to run it in server mode can be found here.

Spring Boot: Executing the Newer version of SQL file each time we rebuild the application

I have a spring-boot application with PostgreSQL. Some of the tables are created using models and other tables have to be created prior to the start of the application or while starting the application. That can be done by running an SQL file while startup.
But DB tend to change over time, we may have to alter some of the tables, add some new tables without disturbing the existing data in the tables, etc.
Is there a way to add new SQL files, and run only the SQL files which was not run in spring-boot application each time when we rebuild and rerun? And don't run any of the SQL files while start-up if everything were already executed?
For your scenario liquibase is the best solution. You can merge liquibase on your spring boot application.
Ex: https://javadeveloperzone.com/spring-boot/spring-boot-liquibase-example/
You can use flyway. It allows you to have versioned sql scripts:
flywaydb.org
flywaydb spring boot plugin
Examples:
Spring Boot Database Migrations with Flyway
Incrementally changing your db with java and flyway

How to change a Jackrabbit persistence manager on the fly?

I used internal persistence manager based on derby DB, and filesystem repository.
Now it around 1.5 million files and 3 TB in repo, and around 6 million records in derby DB.
I think is too much for that DB, because I have extremely slowing down on performance last time.
so I want to change persistence manager to something like MySQL or Oracle.
What is the best way to export data from a Apache Jackrabbit derby DB and import to MySQL?
How can I do this in the easiest and fastest way?
How to migrate to a version of Jackrabbit or a new persistence manager is described at the Backup and Migration page.
In my experience, MySQL or Oracle are not actually faster, is Derby is embedded (in-process). MySQL and Oracle are remote, so for each request there is a network roundtrip.
Instead, what you could do is use a higher bundle cache size and/or a higher database cache size.

Configure JDBC oracle specific property v$session.program using Jboss and JPA (hibernate)

I'd like to set the v$session.program Oracle property in order to have information available in the session table. I'm using JPA with a jndi XA datasource created with an oracle-xa-ds.xml deployed in the deploy folder of Jboss, and therefore I haven't access to the constructor of the Connection.
I have access to the Connection object, in JPA 2 using unwrap, in JPA 1 by casting JPA to Hibernate classes, but there are no properties setter (only Client Info properties that are the way to proceed starting JDBC 4.0).
So my question is, using JPA (with Hibernate) using Jboss 4.2 :
Is it possible to configure the v$session.program in the persistence.xml ?
Is it possible to configure the v$session.program in the oracle-ds.xml ?
Is their any other approach to the solution ?
Thank you for any valuable comments and answers !
I had the same Problem today, after much fiddeling and reading documentation finally I had the Eureka moment:
Add following parameter:
<xa-datasource-property name="connectionProperties">v$session.program=YourUniqueName</xa-datasource-property>
Thats all.
I'm pretty sure this must be documented somewhere but here is what we can find in the JBoss wiki:
How To Specify "PROGRAM" Oracle Connection Property
JBoss Version: JBoss 4.0.3 SP1, Oracle DB Version: 10g
To be able to distinguish the JDBC
connections on the Oracle server side,
which are created by different JBoss
instances, Oracle's PROGRAM connection
property might be set within the
Oracle specific JDBC datasource config
file by using the following tags:
<connection-property name="v$session.program">ADistinguishedNameForPROGRAMProperty</connection-property>
i.e.
...
<connection-url>AConnectionURL</connection-url>
<connection-property name="v$session.program">ADistinguishedNameForPROGRAMProperty</connection-property>
<driver-class>oracle.jdbc.OracleDriver</driver-class>
...
That way the DBAs can have proper
granularity in:
AWRs
v$session view
Other tools which are checking/evaluating PROGRAM connection
property

Resources