diff --git a/README_SETUP.md b/README_SETUP.md index 4eef031fd8c29d5150c4bbfe359ce91069dced53..a48faf2b5602af4e0ee0aefce4820b52d566391e 100644 --- a/README_SETUP.md +++ b/README_SETUP.md @@ -69,10 +69,10 @@ server: - You can check the content of the certificate with `openssl x509 -in cert.pem -text` 3. Copy `conf/core/server.conf` to `conf/ext/server.conf` and change it appropriately: - * Setup for SQL back end: Assuming that the SQL back end is installed - (see the `README_SETUP.md` of the `caosdb-sqlbackend` repository), - specify the fields `SQL_USER_NAME`, `SQL_USER_PASSWORD`, - `SQL_DATABASE_NAME`, and `SQL_HOST`. + * Setup for MySQL back-end: Assuming that the mysql back-end is installed + (see the `README_SETUP.md` of the `caosdb-mysqlbackend` repository), + specify the fields `MYSQL_USER_NAME`, `MYSQL_USER_PASSWORD`, + `MYSQL_DATABASE_NAME`, and `MYSQL_HOST`. * Choose the ports under which CaosDB will be accessible. * Setup the SSL certificate: Assuming that there is an appropriate `Java Key Store` file (see above), change the fields `CERTIFICATES_KEY_PASSWORD`, diff --git a/conf/core/server.conf b/conf/core/server.conf index a805c73a2e37fab0734a740aa010574ef1117781..686cf1005dea38ba5c01b32b5fe96bfe610e7a01 100644 --- a/conf/core/server.conf +++ b/conf/core/server.conf @@ -11,13 +11,13 @@ USER_SOURCES_INI_FILE=./conf/ext/usersources.ini NEW_USER_DEFAULT_ACTIVITY=INACTIVE AUTH_OPTIONAL=FALSE -SQL_HOST=localhost -SQL_PORT=3306 -SQL_DATABASE_NAME=caosdb -SQL_USER_NAME=caosdb -SQL_USER_PASSWORD=caosdb +MYSQL_HOST=localhost +MYSQL_PORT=3306 +MYSQL_DATABASE_NAME=caosdb +MYSQL_USER_NAME=caosdb +MYSQL_USER_PASSWORD=caosdb -SQL_SCHEMA_VERSION=v2.1.1 +MYSQL_SCHEMA_VERSION=v2.1.1 CONTEXT_ROOT= diff --git a/src/main/java/caosdb/server/ServerProperties.java b/src/main/java/caosdb/server/ServerProperties.java index 37541e3ba7b8d5f4fbf0e7d346844b3d6de7b216..10ede003057096b7dd8555bcdb39ba9f195205af 100644 --- a/src/main/java/caosdb/server/ServerProperties.java +++ b/src/main/java/caosdb/server/ServerProperties.java @@ -46,12 +46,12 @@ public class ServerProperties extends Properties { public static final String KEY_CHOWN_SCRIPT = "CHOWN_SCRIPT"; public static final String KEY_AUTH_OPTIONAL = "AUTH_OPTIONAL"; - public static final String KEY_SQL_HOST = "SQL_HOST"; - public static final String KEY_SQL_PORT = "SQL_PORT"; - public static final String KEY_SQL_DATABASE_NAME = "SQL_DATABASE_NAME"; - public static final String KEY_SQL_USER_NAME = "SQL_USER_NAME"; - public static final String KEY_SQL_USER_PASSWORD = "SQL_USER_PASSWORD"; - public static final String KEY_SQL_SCHEMA_VERSION = "SQL_SCHEMA_VERSION"; + public static final String KEY_MYSQL_HOST = "MYSQL_HOST"; + public static final String KEY_MYSQL_PORT = "MYSQL_PORT"; + public static final String KEY_MYSQL_DATABASE_NAME = "MYSQL_DATABASE_NAME"; + public static final String KEY_MYSQL_USER_NAME = "MYSQL_USER_NAME"; + public static final String KEY_MYSQL_USER_PASSWORD = "MYSQL_USER_PASSWORD"; + public static final String KEY_MYSQL_SCHEMA_VERSION = "MYSQL_SCHEMA_VERSION"; public static final String KEY_BASE_PATH = "BASE_PATH"; public static final String KEY_FILE_POLICY = "FILE_POLICY"; diff --git a/src/main/java/caosdb/server/database/backend/implementation/MySQL/DatabaseConnectionPool.java b/src/main/java/caosdb/server/database/backend/implementation/MySQL/DatabaseConnectionPool.java index c8d9268401fbf32906ac732e86482721a127c7af..9700daf3a99b30e42baf8580f863998d7efe67a1 100644 --- a/src/main/java/caosdb/server/database/backend/implementation/MySQL/DatabaseConnectionPool.java +++ b/src/main/java/caosdb/server/database/backend/implementation/MySQL/DatabaseConnectionPool.java @@ -80,19 +80,19 @@ class DatabaseConnectionPool { final String url = "jdbc:mysql://" - + CaosDBServer.getServerProperty(ServerProperties.KEY_SQL_HOST) + + CaosDBServer.getServerProperty(ServerProperties.KEY_MYSQL_HOST) + ":" - + CaosDBServer.getServerProperty(ServerProperties.KEY_SQL_PORT) + + CaosDBServer.getServerProperty(ServerProperties.KEY_MYSQL_PORT) + "/" - + CaosDBServer.getServerProperty(ServerProperties.KEY_SQL_DATABASE_NAME) + + CaosDBServer.getServerProperty(ServerProperties.KEY_MYSQL_DATABASE_NAME) + "?noAccessToProcedureBodies=true&cacheCallableStmts=true&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&connectionCollation=utf8_unicode_ci&characterSetResults=utf8&serverTimezone=CET"; // + "?profileSQL=true&characterSetResults=utf8"; - final String user = CaosDBServer.getServerProperty(ServerProperties.KEY_SQL_USER_NAME); - final String pwd = CaosDBServer.getServerProperty(ServerProperties.KEY_SQL_USER_PASSWORD); + final String user = CaosDBServer.getServerProperty(ServerProperties.KEY_MYSQL_USER_NAME); + final String pwd = CaosDBServer.getServerProperty(ServerProperties.KEY_MYSQL_USER_PASSWORD); final ConnectionPool pool = new ConnectionPool("MySQL Pool", 2, 5, 0, 0, url, user, pwd); pool.removeShutdownHook(); CaosDBServer.addPostShutdownHook( - new Thread("SHUTDOWN_SQL_CONNECTION_POOL") { + new Thread("SHUTDOWN_MYSQL_CONNECTION_POOL") { @Override public void run() { try { @@ -185,7 +185,7 @@ class DatabaseConnectionPool { final ResultSet executeQuery = prepareStatement.executeQuery(); if (executeQuery.next()) { final String v_e = - CaosDBServer.getServerProperty(ServerProperties.KEY_SQL_SCHEMA_VERSION) + CaosDBServer.getServerProperty(ServerProperties.KEY_MYSQL_SCHEMA_VERSION) .toLowerCase(); final String v_a = executeQuery.getString(1).toLowerCase(); if (!Objects.equal(v_a, v_e)) { @@ -203,7 +203,7 @@ class DatabaseConnectionPool { // set auto_increment on table entities to the maximum entity_id of // table transaction_log; - // Why? SQL seems to reset the + // Why? MYSQL seems to reset the // auto_increment value each time the MySQL server is being // restarted to the maximum of ids in the entities table. But if // some of the ids had been used yet, we don't want to use them diff --git a/src/main/java/caosdb/server/utils/ServerMessages.java b/src/main/java/caosdb/server/utils/ServerMessages.java index 8f25fe6049a5f91e15ff2d2991e0b3fa01cb2069..124962182a114f05f7bfabee377841412594a828 100644 --- a/src/main/java/caosdb/server/utils/ServerMessages.java +++ b/src/main/java/caosdb/server/utils/ServerMessages.java @@ -144,7 +144,7 @@ public class ServerMessages { public static final Message REQUEST_BODY_EMPTY = new Message(MessageType.Error, 0, "Request body was empty."); - public static final Message SQL_PROCEDURE_EXCEPTION = + public static final Message MYSQL_PROCEDURE_EXCEPTION = new Message( MessageType.Error, 0,