From 60ca2e164589cda57f4baf2d95b59110fb7fca3d Mon Sep 17 00:00:00 2001 From: Martin Goik <goik@hdm-stuttgart.de> Date: Sun, 17 Mar 2019 10:37:49 +0100 Subject: [PATCH] mysql -> postgresql --- Doc/Sda1/jdbc.xml | 75 +++++++++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 39 deletions(-) diff --git a/Doc/Sda1/jdbc.xml b/Doc/Sda1/jdbc.xml index 5e429cbc4..fc30ba096 100644 --- a/Doc/Sda1/jdbc.xml +++ b/Doc/Sda1/jdbc.xml @@ -191,9 +191,7 @@ INSERT INTO User VALUES('Joe Bix', 'bix');</programlisting> </mediaobject> </figure> - <para>So what is actually required to connect to a database server? A - client requires the following parameter values to open a - connection:</para> + <para>Opening a connection to a database server requires:</para> <figure xml:id="sda1_jdbc_fig_jdbcOpenPrerequisites"> <title><xref linkend="glo_JDBC"/> connection parameter</title> @@ -206,9 +204,9 @@ INSERT INTO User VALUES('Joe Bix', 'bix');</programlisting> xlink:href="https://en.wikipedia.org/wiki/IBM_Db2">DB2</productname>, <productname xlink:href="http://www-01.ibm.com/software/data/informix">Informix</productname>, - <productname - xlink:href="https://www.mysql.com">Mysql</productname> etc. due to - vendor specific <trademark + <xref linkend="glo_Soft_Postgresql"/>, <productname + xlink:href="https://www.mysql.com">Mysql</productname> + <abbrev>etc.</abbrev> due to vendor specific <trademark xlink:href="https://en.wikipedia.org/wiki/Java_Database_Connectivity">JDBC</trademark> protocol implementations.</para> </listitem> @@ -305,6 +303,13 @@ abs_path = "/" path_segments <th><xref linkend="glo_JDBC"/> URI</th> </tr> + <tr> + <td valign="top">PostgreSQL</td> + + <td + valign="top">jdbc:postgresql://<HOST>:<PORT>/[database]</td> + </tr> + <tr> <td valign="top">MySQL</td> @@ -326,13 +331,6 @@ abs_path = "/" path_segments valign="top">jdbc:db2://<HOST>:<PORT>/[database]</td> </tr> - <tr> - <td valign="top">PostgreSQL</td> - - <td - valign="top">jdbc:postgresql://<HOST>:<PORT>/[database]</td> - </tr> - <tr> <td valign="top">Derby</td> @@ -366,10 +364,10 @@ abs_path = "/" path_segments <tr> <td valign="top"><glosslist> <glossentry> - <glossterm>Mysql:</glossterm> + <glossterm>Postgresql:</glossterm> <glossdef> - <para>3306</para> + <para>5432</para> </glossdef> </glossentry> @@ -412,11 +410,9 @@ abs_path = "/" path_segments <title><productname>... but Mysql</productname> made it into Linux</title> - <screen>Doc> grep -i mysql /etc/services -<emphasis role="red">mysql</emphasis> <emphasis role="red">3306</emphasis>/tcp -<emphasis role="red">mysql</emphasis> <emphasis role="red">3306</emphasis>/udp -mysql-proxy 6446/tcp -mysql-proxy 6446/udp</screen> + <screen>>grep postgresql /etc/services +postgresql 5432/tcp postgres # PostgreSQL Database +postgresql 5432/udp postgres</screen> </figure> <para>Writing <trademark @@ -497,15 +493,15 @@ mysql-proxy 6446/udp</screen> <itemizedlist> <listitem> - <para><filename>mysql-connector-java-x.y.z.jar</filename></para> + <para><filename>postgresql-42.1.4.jar</filename></para> </listitem> <listitem> - <para><filename>ojdbc6.jar</filename></para> + <para><filename>mysql-connector-java-x.y.z.jar</filename></para> </listitem> <listitem> - <para><filename>postgresql-42.1.4.jar</filename></para> + <para><filename>ojdbc6.jar</filename></para> </listitem> </itemizedlist> </figure> @@ -513,11 +509,12 @@ mysql-proxy 6446/udp</screen> <figure xml:id="sda1_jdbc_fig_driverLibrariesMaven"> <title>Driver libraries, <xref linkend="glo_Maven"/></title> - <programlisting language="xml"><groupId>mysql</groupId> -<artifactId>mysql-connector-java</artifactId> -<version>6.0.6</version></programlisting> + <programlisting language="xml"><groupId>postgresql</groupId> +<artifactId>postgresql</artifactId> +<version>9.1-901-1.jdbc4</version></programlisting> - <programlisting language="xml"><groupId>com.oracle</groupId> + <programlisting language="xml"><groupId>com.oracle</groupId> <emphasis + role="red"><!-- requires access credentials --></emphasis> <artifactId>ojdbc7</artifactId> <version>12.1.0</version></programlisting> </figure> @@ -526,10 +523,10 @@ mysql-proxy 6446/udp</screen> <title>Driver unavailable</title> <programlisting language="none">conn = DriverManager.getConnection( - "jdbc:mysql<emphasis role="red">o</emphasis>://localhost:3306/hdm", "hdmuser", "XYZ");</programlisting> + "jdbc:postgresql<emphasis role="red">l</emphasis>://localhost/hdm", "hdmuser", "XYZ");</programlisting> <screen>java.sql.SQLException: No suitable driver found for - <emphasis role="red">jdbc:mysqlo://localhost:3306/hdm</emphasis> + jdbc:postgresqll://localhost/hdm at java.sql.DriverManager.getConnection(DriverManager.java:689) at java.sql.DriverManager.getConnection(DriverManager.java:247) @@ -764,9 +761,9 @@ mysql-proxy 6446/udp</screen> <programlisting language="xml">... <dependency> - <groupId>mysql</groupId> - <artifactId>mysql-connector-java</artifactId> - <version>5.1.45</version> + <groupId>postgresql</groupId> + <artifactId>postgresql</artifactId> + <version>9.1-901-1.jdbc4</version> <scope><emphasis role="red">runtime</emphasis></scope> </dependency> ...</programlisting> </figure> @@ -840,7 +837,7 @@ mysql-proxy 6446/udp</screen> xlink:href="https://gitlab.mi.hdm-stuttgart.de/goik/GoikLectures/blob/master/ws/eclipse/Jdbc/src/main/java/sda/jdbc/intro/SimpleInsert.java#L22">Step 1: Open connection to database server</link> final Connection conn = DriverManager.<link xlink:href="https://docs.oracle.com/javase/10/docs/api/java/sql/DriverManager.html#getConnection(java.lang.String)">getConnection</link> ( - "jdbc:mysql://localhost:3306/hdm", // Connection parameter URL + "jdbc:postgresql://localhost/hdm", // Connection parameter URL "hdmuser", // Username "XYZ"); // Password @@ -962,7 +959,7 @@ goik@goiki Minimum> java -jar /.../Jdbc/Insert/Minimum/target/insert_user-0.1 <glossdef> <programlisting language="none">... = DriverManager.getConnection ( - "<emphasis role="red">jdbc:mysql://localhost:3306/hdm</emphasis>", //JDBC URL + "<emphasis role="red">jdbc:postgresql://localhost/hdm</emphasis>", //JDBC URL "<emphasis role="red">hdmuser</emphasis>", // Username "<emphasis role="red">XYZ</emphasis>") // Password</programlisting> </glossdef> @@ -1009,7 +1006,7 @@ goik@goiki Minimum> java -jar /.../Jdbc/Insert/Minimum/target/insert_user-0.1 <filename>resources/jdbc.properties</filename></glossterm> <glossdef> - <programlisting language="properties"><emphasis role="red">jdbcurl</emphasis>=jdbc:mysql://localhost:3306/hdm + <programlisting language="properties"><emphasis role="red">jdbcurl</emphasis>=jdbc:postgresql://localhost/hdm <emphasis role="red">username</emphasis>=hdmuser <emphasis role="red">password</emphasis>=XYZ</programlisting> </glossdef> @@ -1090,7 +1087,7 @@ ResourceBundle jdbcProperties = ResourceBundle.getBundle("<emphasis role="red">j </listitem> <listitem> - <para> Close database connection.</para> + <para>Close database connection.</para> </listitem> </itemizedlist> </listitem> @@ -1524,15 +1521,15 @@ public someClass { </tr> <tr> - <td>jdbc:mysql</td> + <td>jdbc:postgresql</td> - <td>mysqlDriver instance</td> + <td>Postgresql driver instance</td> </tr> <tr> <td>jdbc:oracle</td> - <td>oracleDriver instance</td> + <td>Oracle driver instance</td> </tr> <tr> -- GitLab