Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

H2-Datenbank: readonly-User anlegen, optional mit AUTO_SERVER starten #43

Merged
merged 1 commit into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/de/jost_net/JVerein/server/DBSupportH2Impl.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.HashMap;

import de.jost_net.JVerein.JVereinPlugin;
import de.jost_net.JVerein.rmi.JVereinDBService;
import de.willuhn.jameica.system.Application;
import de.willuhn.logging.Logger;
import de.willuhn.util.ApplicationException;
Expand Down Expand Up @@ -137,6 +138,9 @@ public String getJdbcUrl()
String url = "jdbc:h2:" + Application.getPluginLoader()
.getPlugin(JVereinPlugin.class).getResources().getWorkPath()
+ "/h2db/jverein";
if (JVereinDBService.SETTINGS.getBoolean("database.driver.h2.auto_server", false)) {
url += ";AUTO_SERVER=TRUE";
}

// if (JVereinDBService.SETTINGS.getBoolean("database.driver.h2.encryption",
// true))
Expand Down
37 changes: 37 additions & 0 deletions src/de/jost_net/JVerein/server/DDLTool/Updates/Update0418.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**********************************************************************
* This program is free software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program. If not,
* see <http://www.gnu.org/licenses/>.
*
**********************************************************************/
package de.jost_net.JVerein.server.DDLTool.Updates;

import de.jost_net.JVerein.server.DDLTool.AbstractDDLUpdate;
import de.willuhn.util.ApplicationException;
import de.willuhn.util.ProgressMonitor;

import java.sql.Connection;

public class Update0418 extends AbstractDDLUpdate
{
public Update0418(String driver, ProgressMonitor monitor, Connection conn)
{
super(driver, monitor, conn);
}

@Override
public void run() throws ApplicationException
{
if (getDriver()==DRIVER.H2) {
execute("CREATE USER readonly PASSWORD 'jverein'; GRANT SELECT ON SCHEMA PUBLIC TO readonly", false);
}
setNewVersion(nr);
}
}