diff --git a/Doc/Common/glossary.xml b/Doc/Common/glossary.xml index 257b79f7106494bd0675d1e1468c1b55877a39d1..451dbf9d7b45e6591c1418f6a814cca33c1b31ec 100644 --- a/Doc/Common/glossary.xml +++ b/Doc/Common/glossary.xml @@ -773,7 +773,16 @@ <glossdef> <para><link xlink:href="https://www.mysql.com/about/legal/trademark.html">The - <acronym>Mysql</acronym> database server product</link></para> + <acronym>Mysql</acronym> database server</link></para> + </glossdef> + </glossentry> + + <glossentry xml:id="glo_Soft_Postgresql"> + <glossterm><trademark>Postgresql</trademark></glossterm> + + <glossdef> + <para><link xlink:href="https://www.postgresql.org">The + <acronym>Postgresql</acronym> database server</link></para> </glossdef> </glossentry> diff --git a/Doc/Sda1/jdbc.xml b/Doc/Sda1/jdbc.xml index ddd18b33c00de0886b3a6e3a70d0ba229318feb0..5e429cbc479b3d923705d26816cb503f01876fdc 100644 --- a/Doc/Sda1/jdbc.xml +++ b/Doc/Sda1/jdbc.xml @@ -1063,11 +1063,11 @@ ResourceBundle jdbcProperties = ResourceBundle.getBundle("<emphasis role="red">j <itemizedlist> <listitem> - <para>Opening database connection</para> + <para>Open database connection</para> </listitem> <listitem> - <para>Erase and re-create a desired schema.</para> + <para>Create a required schema.</para> </listitem> <listitem> @@ -1077,13 +1077,22 @@ ResourceBundle jdbcProperties = ResourceBundle.getBundle("<emphasis role="red">j </listitem> <listitem> - <para><emphasis role="red">Test:</emphasis> Executing <xref + <para><emphasis role="red">Test:</emphasis> Execute <xref linkend="glo_JDBC"/> CRUD / SELECT operations.</para> </listitem> <listitem> - <para><emphasis role="red">Tear down:</emphasis> Close database - connection.</para> + <para><emphasis role="red">Tear down:</emphasis></para> + + <itemizedlist> + <listitem> + <para>Drop schema</para> + </listitem> + + <listitem> + <para> Close database connection.</para> + </listitem> + </itemizedlist> </listitem> </orderedlist> </figure> @@ -1143,7 +1152,7 @@ ResourceBundle jdbcProperties = ResourceBundle.getBundle("<emphasis role="red">j <programlisting language="xml"><dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> - <version>5.1.4.RELEASE</version> + <version>5.1.5.RELEASE</version> <emphasis role="red"><scope>test</scope></emphasis> </dependency></programlisting> </figure> diff --git a/Doc/Sda1/prerequisites.xml b/Doc/Sda1/prerequisites.xml index 79c010aa4633e77b3c97066577d621f12fcba4d0..90e62ad936347481bbeadbbbe22b1998dcbe8265 100644 --- a/Doc/Sda1/prerequisites.xml +++ b/Doc/Sda1/prerequisites.xml @@ -180,6 +180,33 @@ </informaltable> </figure> + <section xml:id="sda1_sect_setupPostgresql"> + <title><productname + xlink:href="https://www.postgresql.org">Postgresql</productname> + database components</title> + + <figure xml:id="sda1_fig_installPostgresql"> + <title>Installing <xref linkend="glo_Soft_Postgresql"/></title> + + <para>Installation references:</para> + + <itemizedlist> + <listitem> + <para><link + xlink:href="https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-18-04">How + To Install and Use PostgreSQL on Ubuntu 18.04</link></para> + </listitem> + + <listitem> + <para><link + xlink:href="https://blog.2ndquadrant.com/how-to-safely-change-the-postgres-user-password-via-psql">How + to safely change the “postgres†user password via + “psqlâ€</link></para> + </listitem> + </itemizedlist> + </figure> + </section> + <section xml:id="sda1_sect_setupMysql"> <title><productname xlink:href="https://www.mysql.com">Mysql</productname> Database diff --git a/P/Sda1/Jdbc/Insert/MinimumTest/pom.xml b/P/Sda1/Jdbc/Insert/MinimumTest/pom.xml index cd88c7b50b115108a90a476ab3cd9eff8b8dee8d..98a8d1f9eb1703273c0802e21e78348ca5236ec0 100644 --- a/P/Sda1/Jdbc/Insert/MinimumTest/pom.xml +++ b/P/Sda1/Jdbc/Insert/MinimumTest/pom.xml @@ -25,9 +25,9 @@ </dependency> <dependency> - <groupId>mysql</groupId> - <artifactId>mysql-connector-java</artifactId> - <version>8.0.8-dmr</version> + <groupId>postgresql</groupId> + <artifactId>postgresql</artifactId> + <version>9.1-901-1.jdbc4</version> <scope>runtime</scope> </dependency> diff --git a/P/Sda1/Jdbc/Insert/MinimumTest/src/main/java/de/hdm_stuttgart/sda1/insert/SimpleInsert.java b/P/Sda1/Jdbc/Insert/MinimumTest/src/main/java/de/hdm_stuttgart/sda1/insert/SimpleInsert.java index d99407c2a87ba7ffe36ae657d4fa80711131a891..ce93374b3065c5c35d17be4175df4b8d74115e45 100644 --- a/P/Sda1/Jdbc/Insert/MinimumTest/src/main/java/de/hdm_stuttgart/sda1/insert/SimpleInsert.java +++ b/P/Sda1/Jdbc/Insert/MinimumTest/src/main/java/de/hdm_stuttgart/sda1/insert/SimpleInsert.java @@ -89,7 +89,7 @@ public class SimpleInsert { * @param email Person's email * @return Inserted reord count: 1 on successful INSERT, 0 in case of duplicate email violating UNIQUE constraint. * - * @throws SQLException To be thrown in case of non - {@link SQLIntegrityConstraintViolationException} + * @throws SQLException In case e.g. of constraint violation * errors. */ static public int insertPerson(final Statement statement, final String name, final String email) @@ -97,11 +97,6 @@ public class SimpleInsert { final String sql = "INSERT INTO Person VALUES('" + name + "', '" + email + "')"; log.info("Executing »" + sql + "«"); - try { - return statement.executeUpdate(sql); - } catch (final SQLIntegrityConstraintViolationException ex) { - log.info("Constraint violation, possibly inserting duplicate email '" + email + "'"); - return 0; - } + return statement.executeUpdate(sql); } } \ No newline at end of file diff --git a/P/Sda1/Jdbc/Insert/MinimumTest/src/main/resources/jdbc.properties b/P/Sda1/Jdbc/Insert/MinimumTest/src/main/resources/jdbc.properties index 47fb0a5aef5dcd82f5a988fac4a20fd8af5f5f59..39599462cb25c91aa24a81743fdf6222487c2bcb 100644 --- a/P/Sda1/Jdbc/Insert/MinimumTest/src/main/resources/jdbc.properties +++ b/P/Sda1/Jdbc/Insert/MinimumTest/src/main/resources/jdbc.properties @@ -1,3 +1,3 @@ -jdbcurl=jdbc:mysql://localhost:3306/hdm?allowMultiQueries=true&serverTimezone=UTC +jdbcurl=jdbc:postgresql://localhost/hdm +username=hdmuser password=XYZ -username=hdmuser \ No newline at end of file diff --git a/P/Sda1/Jdbc/Insert/MinimumTest/src/test/java/de/hdm_stuttgart/sda1/insert/InsertTest.java b/P/Sda1/Jdbc/Insert/MinimumTest/src/test/java/de/hdm_stuttgart/sda1/insert/InsertTest.java index 85bf9b894a5ef7f1488c4d22e9255f0e66ba6686..2bfec3801be417d0f303de7b7fd5f89a0fb04e20 100644 --- a/P/Sda1/Jdbc/Insert/MinimumTest/src/test/java/de/hdm_stuttgart/sda1/insert/InsertTest.java +++ b/P/Sda1/Jdbc/Insert/MinimumTest/src/test/java/de/hdm_stuttgart/sda1/insert/InsertTest.java @@ -15,7 +15,7 @@ import java.util.ResourceBundle; * Testing insert operations. */ -@FixMethodOrder(MethodSorters.NAME_ASCENDING) // SQL inserts require fixed execution order. +@FixMethodOrder(MethodSorters.NAME_ASCENDING) // Subsequent SQL inserts require fixed execution order. @SuppressWarnings({"UnusedDeclaration"}) public class InsertTest { @@ -57,7 +57,7 @@ public class InsertTest { * Insert fails due to UNIQUE constraint on email value »jill@programmer.org« * */ - @Test + @Test (expected = SQLException.class) // Duplicate key public void test_030_insertJillAgain() throws SQLException { Assert.assertEquals(0, SimpleInsert.insertPerson(stmt, "Jill", "jill@programmer.org")); }