When I create an ALIAS for registering the java function in the H2 database, it gives error of class not found. I am running the h2 database on a tcp connection.
sample,
public class TimeFrame {
public static void main(String... args) throws Exception {
Class.forName("org.h2.Driver");
Connection conn = DriverManager.getConnection("jdbc:h2:tcp://MYIP:9092/~/test", "sa", "");
Statement stat = conn.createStatement();
//Setup Table
stat.execute("DROP TABLE IF EXISTS timeframe");
stat.execute("CREATE TABLE timeframe (last_updated TIMESTAMP, ip int");
stat.execute("CREATE ALIAS IF NOT EXISTS SLIDEWINDOW FOR \"h2TimeFrame.TimeFrame.slidewindow\" ");
}
}
This is all in pacakge name: h2TimeFrame. To test,
take the sample class "Function" from the org.h2.samples package. how would you run this class on the server with TCP connection. Changing
Connection conn = DriverManager.getConnection("jdbc:h2:~/test", "sa", "");
to
Connection conn = DriverManager.getConnection("jdbc:h2:tcp://IPADDRESS:9092/~/test", "sa", "");