Hi I am using an H2 database for a tutorial I am following online.
I downloaded the H2 database jar file and put it in a lib file like so:
I also created a library in my project structure like so:
Main code to test:
public class Main {
public static void main(String[] args) throws SQLException {
// write your code here
Server.main();
System.out.println("DB Launched");
}
}
Then I created a db folder - and when I ran my application I entered the path to the DB folder in my project solution for the 'JDBC url'. I followed all of the instructions for the course.
Then when I connected I got the following error (in the web application):
Cannot invoke "java.sql.Connection.getMetaData()" because "<parameter2>" is null
java.lang.NullPointerException: Cannot invoke "java.sql.Connection.getMetaData()" because "<parameter2>" is null
at org.h2.bnf.context.DbContents.readContents(DbContents.java:154)
at org.h2.server.web.WebApp.tables(WebApp.java:698)
at org.h2.server.web.WebApp.process(WebApp.java:225)
at org.h2.server.web.WebApp.processRequest(WebApp.java:170)
at org.h2.server.web.WebThread.process(WebThread.java:134)
at org.h2.server.web.WebThread.run(WebThread.java:90)
at java.base/java.lang.Thread.run(Thread.java:832)
I followed all instructions... I do not know why I am getting this error - I don't know what I'm doing wrong.
Thank you,
tomkt,
question from:https://stackoverflow.com/questions/65876757/cannot-invoke-java-sql-connection-getmetadata-because-parameter2-is-null