Forked from craigvantonder/connectorj-mysql-integration.md
Created
June 6, 2019 23:43
-
-
Save lehungio/7c4fcbb7e6e6847883471569b5d57d7a to your computer and use it in GitHub Desktop.
Revisions
-
craigvantonder revised this gist
Mar 18, 2017 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,13 @@ Read through: https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04 Then install Oracle Java 8: sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java8-installer Read through: https://help.ubuntu.com/community/JDBCAndMySQL Then install the connector driver: sudo apt-get install libmysql-java -
craigvantonder revised this gist
Mar 18, 2017 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,12 @@ Read through: https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04 Then install Oracle Java 8: sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java8-installer Read through: https://help.ubuntu.com/community/JDBCAndMySQL Then install the connector driver: sudo apt-get install libmysql-java @@ -67,7 +67,7 @@ If you get the error: Check out: http://stackoverflow.com/questions/36746677/table-performance-schema-session-variables-doesnt-exist I personally needed to run: mysql_upgrade -u root -p --force -
craigvantonder revised this gist
Mar 18, 2017 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,6 @@ Read through: https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04 Then install Oracle Java 8: sudo add-apt-repository ppa:webupd8team/java sudo apt-get update -
craigvantonder revised this gist
Mar 18, 2017 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -72,4 +72,6 @@ I needed to run: And then: echo "# JDBC Connection error performance_schema=ON" >> /etc/mysql/mysql.conf.d/mysqld.cnf You can make use of this to setup a data pipeline between MySQL and Amazon ElasticService by following these instructions here: https://gist.github.com/craigvantonder/8566c6992b930e7d2ac2520e18516e4d -
craigvantonder renamed this gist
Mar 17, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
craigvantonder revised this gist
Mar 17, 2017 . No changes.There are no files selected for viewing
-
craigvantonder revised this gist
Mar 16, 2017 . 1 changed file with 8 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,8 @@ Install Oracle Java 8 - https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04: sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java8-installer Install the connector driver - https://help.ubuntu.com/community/JDBCAndMySQL: @@ -60,13 +62,13 @@ Run the test: If you get the error: Exception in thread "main" com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'performance_schema.session_variables' doesn't exist Check out: http://stackoverflow.com/questions/36746677/table-performance-schema-session-variables-doesnt-exist I needed to run: mysql_upgrade -u root -p --force And then: echo "# JDBC Connection error -
craigvantonder revised this gist
Mar 16, 2017 . No changes.There are no files selected for viewing
-
craigvantonder revised this gist
Mar 16, 2017 . 1 changed file with 16 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -55,4 +55,19 @@ Compile the test: Run the test: java DBDemo If you get the error: Exception in thread "main" com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'performance_schema.session_variables' doesn't exist Check out: http://stackoverflow.com/questions/36746677/table-performance-schema-session-variables-doesnt-exist I needed to run: mysql_upgrade -u root -p --force And then: echo "# JDBC Connection error performance_schema=ON" >> /etc/mysql/mysql.conf.d/mysqld.cnf -
craigvantonder revised this gist
Mar 16, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -26,7 +26,7 @@ Create a test script: // by adding (say) ?user=craig&password=craig. Not recommended! private static final String CONNECTION = \"jdbc:mysql://localhost:3306/mydatabase\"; public static void main(String[] args) throws ClassNotFoundException,SQLException -
craigvantonder revised this gist
Mar 16, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,7 @@ Install the connector driver - https://help.ubuntu.com/community/JDBCAndMySQL: Set classpath globally: echo "# Set classpath for JDBC & MySQL CLASSPATH=\".:/usr/share/java/mysql.jar\"" >> /etc/environment Create a test script: -
craigvantonder revised this gist
Mar 16, 2017 . No changes.There are no files selected for viewing
-
craigvantonder revised this gist
Mar 16, 2017 . 1 changed file with 31 additions and 19 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,8 @@ Install Java SDK and Runtime environment - https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04: sudo apt-get install default-jdk Install the connector driver - https://help.ubuntu.com/community/JDBCAndMySQL: sudo apt-get install libmysql-java @@ -14,33 +13,46 @@ Set classpath globally: Create a test script: echo "import java.sql.*; import java.util.Properties; public class DBDemo { // The JDBC Connector Class. private static final String dbClassName = \"com.mysql.jdbc.Driver\"; // Connection string. mydatabase is the database the program // is connecting to. You can include user and password after this // by adding (say) ?user=craig&password=craig. Not recommended! private static final String CONNECTION = \"jdbc:mysql://127.0.0.1/mydatabase\"; public static void main(String[] args) throws ClassNotFoundException,SQLException { System.out.println(dbClassName); // Class.forName(xxx) loads the jdbc classes and // creates a drivermanager class factory Class.forName(dbClassName); // Properties for user and password. Here the user and password are both 'craig' Properties p = new Properties(); p.put(\"user\",\"craig\"); p.put(\"password\",\"craig\"); // Now try to connect Connection c = DriverManager.getConnection(CONNECTION,p); System.out.println(\"It works !\"); c.close(); } }" > DBDemo.java Compile the test: javac DBDemo.java Run the test: java DBDemo -
craigvantonder revised this gist
Mar 16, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ Install the connector driver - http://www.wottageek.com/2015/07/how-to-set-up-my Set classpath globally: echo "# Set classpath for JDBC & MySQL export CLASSPATH=$CLASSPATH:/usr/share/java/mysql.jar" >> /etc/environment Create a test script: -
craigvantonder created this gist
Mar 16, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ Install Java SDK and Runtime environment - https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04: sudo apt-get install default-jdk Install the connector driver - http://www.wottageek.com/2015/07/how-to-set-up-mysqljdbc-on-ubuntu.html: sudo apt-get install libmysql-java Set classpath globally: echo "# Set classpath for JDBC & MySQL export CLASSPATH=$CLASSPATH:/usr/share/java/mysql-connector-java.jar" >> /etc/environment Create a test script: echo "import java.sql.Connection; import java.sql.DriverManager; class JDBCTest { String url = \"jdbc:mysql://localhost\"; String user = \"username\"; String password = \"password\"; public static void main(String args[]) { try { Connection con; con = DriverManager.getConnection(url, user, password); System.out.println(\"Success\"); } catch (Exception e) { e.printStackTrace(); } } }" > JDBCTest.java Compile the test: javac JDBCTest.java Run the test: java JDBCTest