Commit a3343329 authored by Administrator's avatar Administrator

Updates to MySQL 8+

The project has been updated so that it now supports MySQL 8+
databases.
parent eae2d5a0
......@@ -4,8 +4,8 @@ This repository contains the code base of a sample project that will be used in
the XCS subject inside the DGSS itinerary.
## 1. Deployment Environment
The environment is based on Java 8, Maven 3.3+, Git 1.9+, MySQL 5.5+,
WildFly 10.1.0 and Eclipse Oxygen for JavaEE.
The environment is based on Java 8, Maven 3.3+, Git 1.9+, MySQL 8+,
WildFly 10.1.0 and Eclipse for JavaEE.
### 1.1. Java JDK 8
Download and install Java JDK 8, preferably the Oracle version (the commands
......@@ -51,7 +51,7 @@ Once Git is installed in your system, clone the project:
git clone http://sing-group.org/dt/gitlab/dgss-2021/xcs-sample.git
```
### 1.4. MySQL 5.5+
### 1.4. MySQL 8+
In order to run the tests with the `wildfly-embedded-mysql` profile (more about
this in the **Sample 2** section) and to run the application, we need a MySQL
server.
......@@ -66,11 +66,12 @@ commands:
```sql
CREATE DATABASE xcs;
GRANT ALL PRIVILEGES ON xcs.* TO xcs@localhost IDENTIFIED BY 'xcs';
FLUSH PRIVILEGES;
CREATE DATABASE xcssampletest;
GRANT ALL PRIVILEGES ON xcssampletest.* TO xcs@localhost IDENTIFIED BY 'xcs';
CREATE USER xcs@'%' IDENTIFIED BY 'xcs';
GRANT ALL PRIVILEGES ON xcs.* TO xcs@'%';
GRANT ALL PRIVILEGES ON xcssampletest.* TO xcs@'%';
FLUSH PRIVILEGES;
```
......@@ -119,8 +120,8 @@ VALUES ('CAT','2000-01-01 01:01:01','Pepecat','pepe'),
You can find the `xcs-sample-mysql.sql` and `xcs-sample-test-mysql.sql` scripts
with these queries stored in the `additional-material/db` project folder.
### 1.5. Eclipse Oxygen for Java EE
Open Eclipse Oxygen for Java EE and import your Maven project with
### 1.5. Eclipse for Java EE
Open Eclipse for Java EE and import your Maven project with
`File -> Import -> Maven -> Existing Maven Projects`. In the dialog opened you
have to select as `Root directory` the directory of the project that you have
just cloned (it should contain a `pom.xml` file).
......@@ -134,7 +135,7 @@ advanced settings of the dialog and use a custom `Name template` (for example,
If you want, you can use any other IDE, such as IntelliJ IDEA or NetBeans, as
long as they are compatible with Maven projects, but we recommend using Eclipse
Oxygen for Java EE.
for Java EE.
### 1.6 WildFly 10.1.0
If you want to run the project you need a Java EE server. In this section you
......@@ -156,12 +157,9 @@ file of the server. To do so, you have to edit this file and add the following
content to the `<datasources>` element:
```xml
<datasource jndi-name="java:jboss/datasources/xcs" pool-name="MySQLPool">
<connection-url>jdbc:mysql://localhost:3306/xcs</connection-url>
<driver>mysql-connector-java-5.1.21.jar</driver>
<pool>
<max-pool-size>30</max-pool-size>
</pool>
<datasource jta="true" jndi-name="java:jboss/datasources/xcs" pool-name="xcs-mysql" enabled="true" use-ccm="true">
<connection-url>jdbc:mysql://localhost:3306/xcs?useJDBCCompliantTimezoneShift=true&amp;useLegacyDatetimeCode=false&amp;serverTimezone=Europe%2FMadrid</connection-url>
<driver>mysql-connector-java-8.0.21.jar</driver>
<security>
<user-name>xcs</user-name>
<password>xcs</password>
......@@ -170,7 +168,7 @@ content to the `<datasources>` element:
```
In addition, you also have to add the MySQL driver to the deployments folder
(`standalone/deployments`). You can download it form [here](http://central.maven.org/maven2/mysql/mysql-connector-java/5.1.21/mysql-connector-java-5.1.21.jar)
(`standalone/deployments`). You can download it form [here](http://central.maven.org/maven2/mysql/mysql-connector-java/8.0.21/mysql-connector-java-8.0.21.jar)
to the deployments (`standalone/deployments`) directory and WildFly will
automatically deploy it on startup.
......@@ -239,7 +237,7 @@ This will launch the construction of the project and, at the end, the EAR will
be deployed. Remember that, if you want a fast deployment, you can avoid the
test execution with the parameter `-DskipTests=true`.
#### 1.7. Running the application from Maven
#### 1.7. Running the application from Maven (Recommended)
This project includes the Maven WildFly plugin, which allows the execution of
the application without needing an external WildFly server. To run the
application with the running MySQL database (`xcs`) you just have execute the
......@@ -336,7 +334,7 @@ configuration will work for the current configuration:
This configuration will run with the **H2** database. If you wish to run the
tests with the **MySQL** database, you have to add to additional system
configuration:
* `mysql.version`: The version of the MySQL driver (currently, `5.1.21`).
* `mysql.version`: The version of the MySQL driver (currently, `8.0.21`).
* `arquillian.launch`: This system property is used to change the profile used
by Arquillian. It should be `wildfly-embedded-mysql` to use the MySQL profile.
......@@ -345,7 +343,7 @@ using the MySQL database is:
```
-Darquillian.launch=wildfly-embedded-mysql
-Dmysql.version=5.1.21
-Dmysql.version=8.0.21
-Dwildfly.version=10.1.0.Final
-Dwildfly.jbossHome=target/wildfly-10.1.0.Final
-Dwildfly.modulePath=target/wildfly-10.1.0.Final/modules
......
......@@ -150,9 +150,8 @@
</security>
</datasource>
<datasource jta="true" jndi-name="java:jboss/datasources/xcs" pool-name="xcs-mysql" enabled="true" use-ccm="true">
<connection-url>jdbc:mysql://localhost:3306/xcs</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<driver>mysql-connector-java-5.1.21.jar</driver>
<connection-url>jdbc:mysql://localhost:3306/xcs?useJDBCCompliantTimezoneShift=true&amp;useLegacyDatetimeCode=false&amp;serverTimezone=Europe%2FMadrid</connection-url>
<driver>mysql-connector-java-8.0.21.jar</driver>
<security>
<user-name>xcs</user-name>
<password>xcs</password>
......
......@@ -153,9 +153,8 @@
</security>
</datasource>
<datasource jta="true" jndi-name="java:jboss/datasources/xcs" pool-name="xcs-mysql" enabled="true" use-ccm="true">
<connection-url>jdbc:mysql://localhost:3306/xcs</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<driver>mysql-connector-java-5.1.21.jar</driver>
<connection-url>jdbc:mysql://localhost:3306/xcs?useJDBCCompliantTimezoneShift=true&amp;useLegacyDatetimeCode=false&amp;serverTimezone=Europe%2FMadrid</connection-url>
<driver>mysql-connector-java-8.0.21.jar</driver>
<security>
<user-name>xcs</user-name>
<password>xcs</password>
......
......@@ -59,7 +59,7 @@
<hamcrest.version>2.0.0.0</hamcrest.version>
<jacoco.version>0.7.9</jacoco.version>
<junit.version>4.12</junit.version>
<mysql.connector.java.version>5.1.21</mysql.connector.java.version>
<mysql.connector.java.version>8.0.21</mysql.connector.java.version>
<resteasy.version>3.0.24.Final</resteasy.version>
<slf4j.version>1.5.10</slf4j.version>
......@@ -752,8 +752,8 @@
<commands>
<command>deploy ${project.build.directory}/mysql-connector-java-${mysql.connector.java.version}.jar</command>
<command>data-source add --jndi-name=java:jboss/datasources/xcs --name=xcs-sample --jta=true --use-ccm=true
--connection-url=jdbc:mysql://localhost:3306/xcs --driver-name=mysql-connector-java-${mysql.connector.java.version}.jar
--driver-class=com.mysql.jdbc.Driver --user-name=xcs --password=xcs</command>
--connection-url=jdbc:mysql://localhost:3306/xcs?useJDBCCompliantTimezoneShift=true&amp;useLegacyDatetimeCode=false&amp;serverTimezone=Europe%2FMadrid --driver-name=mysql-connector-java-${mysql.connector.java.version}.jar
--user-name=xcs --password=xcs</command>
<command>/core-service=management/security-realm=RemotingRealm:add</command>
<command>/core-service=management/security-realm=RemotingRealm/authentication=jaas:add(name="AppRealmLoopThrough")</command>
<command>/subsystem=remoting/http-connector=http-remoting-connector:write-attribute(name="security-realm", value="RemotingRealm")</command>
......
Markdown is supported
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