How To Make Spring boot Application Read from Existing sqlite file? - spring-boot

I have Existing File Called sample.db
and I need My Springboot application Read it not make anothe file with same name with each run time
This is My Application.properties File
SQL Dialect Configuration Class
And if I work with New File Generated Can not save or get any data from the new file ?

Related

how to create an xml spring configuration file

Using SpringToolsSuite4 I can create a maven project but I don't know where to click to create an xml configuration file for my beans. I'm too scared to copy https://java2blog.com/spring-xml-configuration/ this guys code because I don't know how to read what their config file.

How to generate .data file with Spring Boot and HSQLDB

I Use a Spring Boot 2 with file based HSQLDB. This are my properties
spring.datasource.driver-class-name=org.hsqldb.jdbc.JDBCDriver
spring.datasource.url=jdbc:hsqldb:file:${user.dir}/src/main/resources/userdb
spring.jpa.database-platform=org.hibernate.dialect.HSQLDialect
spring.datasource.username=sa
spring.datasource.password=
spring.jpa.hibernate.ddl-auto=update
After application start I use that DB and add some Elements into it. Everything works, after that I expect under the path src/main/resources/ following files.
userdb.log (exists)
userdb.properties (exists)
userdb.script (exists)
userdb.data (where is this?)
But userdb.data is not there, after application restart all data are gone. Userdb.script contains all INSERT commands of data I added but there is no .data file. How to configure Spring Boot to create a userdb.data file and use this with content after restart.
In short, I want a persistent HSQLDB.
The database you've already got is persistent and is fine for small (a few megabytes) data.
The .data file is created when you execute CREATE CACHED TABLE statements or when you specify the default table type to be CACHED.
spring.datasource.url=jdbc:hsqldb:file:${user.dir}/src/main/resources/userdb;hsqldb.default_table_type=cached
See the Guide: http://hsqldb.org/doc/2.0/guide/dbproperties-chapt.html#dpc_db_operations

spring data jpa append the create statements each time I run the project as spring app,

I have a problem with the spring jpa schema generation. I set the following properties in the application.properties file:
spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create
spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=create.sql
spring.jpa.properties.javax.persistence.schema-generation.scripts.create-source=metadata
Then each time I run the project or I build it as maven build it appends all the create statements to the create.sql file. I tried to put the create.sql in the target path then each time it removes it and then create a new one but I get an error that it can not read the create.sql. Any idea how to stop appending the create statements each time at the end of the file?
This question is a duplicate of Spring JPA DDL file generation - how to delete or clean file before generating - I have described a solution there that works for Hibernate versions >= 5.5.3:
spring.jpa.properties.hibernate.hbm2ddl.schema-generation.script.append=false

How to read file generated dynamically in spring boot

I have Spring boot application, in which I am generating file dynamically and want flyway plugin to read file at the same time.
I am able to generate file but not able to find the file at the same run by flyway plugin. If I refresh app it shows that file and able to read at next run.
I want that generates and at same time able to read.
spring.devtools.restart.additional-paths=
tried this but it restarts application and write into same file only. because of that records are duplicated and also it not refresh resource dir so not able to read.
I tried many other ways but couldn't work for me. Is there any solution.

Get all config files with spring cloud config

I am relatively new to spring cloud config and I am able to pull the config file with the application name. There is a need for me to pull all the config files from Git via Spring Cloud Config without having to know or pass the application name in the context.
Currently I have used "spring.cloud.config.server.git.searchPaths= *" in my bootstrap file to search my entire git project and using "/{application}-{profile}.properties" to pull the properties files matching the application file. Would want to pull all properties files without passing this application name, is this possible?
I would require this logic to know how many properties files are checked in and how many are duplicates and this logic will be handled by my custom REST service that I am planning to write.

Resources