I am creating a JavaFX program with an embedded H2 database that will be used to handle user logins and passwords. Using Intellij Ultimate, I have a database that I can run
You really should provide a complete stack trace and not just the error message in such questions.
And message that you see is not a compilation error.
Usually such message means that your database is corrupted. If you don't need any data from it, you can simply delete all its files and re-create it from the scratch.
If you can open the database from some tool, but cannot open it from your application, check the versions of H2 that are used in both places and align them. You can export the database in version that works to an SQL script with SCRIPT TO 'filename.sql'
command and use that script to populate the data into new database to make sure that it isn't damaged (with the version that you prefer).
https://github.com/h2database/h2database/issues/2078 you should use the same driver, so reading it with 1.4.200 (current spring data version) is not possible after modification with 1.4.196 (used by IDEA). So mine crash scenario was open db in IDEA with driver 1.4.196 while spring application code used 1.4.200. So it will not start again. You can declare 1.4.196 version in pom.xml for your app but it looks like that you will be bounded to this version and I don't know how you can completely repair your db.
As already noted by @Yura , you need to ensure that all your code base and all your tools use the same version of the driver, be it 1.4.196 or 1.4.200.
Next, if there was nothing valuable in your db, you can safely drop the db file, and it will be re-created again.
If you had some valuable data and you have no backup, then getting the db repaired may become a quest, not necessarily successful...
And if you have a backup, then a procedure of "backup-to-sql-using-196" and "restore-from-sql-using-200" is most likely to do the job for you, see http://www.h2database.com/html/tutorial.html#upgrade_backup_restore ...
First of all you have to keep a copy of your database somewhere safe.
Copy a fresh copy to your project to avoid any corruption, make sure you don't try to open it using inteliJ.
Go to datasources and drivers ->Drivers -> H2 ->Driver files, change it to 1.4.196. Create a new datasource of type h2 and fill in the fields
user: "sa"
password:"" (empty)
url is in this form (path to your database file)
jdbc:h2:file:D:\Downloads\loans\loans\Database
then click on test connection and it should show a green message. Apply and close.
Right click on your database in the database view in the editor, then "Open query console". Run this line (link where you want to dump your database)
SCRIPT TO 'D:\Downloads\loans\loans\db-dump.sql'
Create a new database file (Test.mv.database), follow the previous steps and change the driver version back to 1.4.200. Create a new datasource with the same steps this time linking to your new database
jdbc:h2:file:D:\Downloads\loans\loans\Test
Test the connection, Apply and close.
Open the query console and copy paste the script from db-dump.sql and run it. Right click on the database in the database view and click "Refresh". You should see the data. Right click again and click "Disconnect".
Make sure your application.properties file is pointing to the correct database(Test) and run your application.
Firstly launch your h2 db and than start your application.