Skip to content
Snippets Groups Projects
Verified Commit 2d31f50b authored by Jan Kožusznik's avatar Jan Kožusznik
Browse files

Run H2 in server mode.

parent 8150ad7e
Branches
No related merge requests found
package lab;
import java.sql.SQLException;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
......@@ -13,7 +15,8 @@ import javafx.stage.WindowEvent;
*/
public class App extends Application {
public static void main(String[] args) {
public static void main(String[] args) throws SQLException {
org.h2.tools.Server.createWebServer("-webAllowOthers","-webPort", "8082").start();
launch(args);
}
......
......@@ -121,7 +121,7 @@ public class ScoreDAO {
private Connection getConnection() {
try {
return DriverManager.getConnection("jdbc:h2:./scoreDBh2");
return DriverManager.getConnection("jdbc:h2:./scoreDBh2;AUTO_SERVER=TRUE", "sa","");
} catch (SQLException e) {
e.printStackTrace();
return null;
......
......@@ -2,6 +2,7 @@ module lab01 {
requires transitive javafx.controls;
requires javafx.fxml;
requires java.sql;
requires com.h2database;
opens lab to javafx.fxml;
exports lab;
}
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment