Twitter Text from Java to MySQL: utf8mb4 SQL error "reportcharsetnr ("
In context: trying to load Twitter text into MySQL database. Some tweets have characters utf8mb4
that throw java.SQL.Exception. I solved it thanks to this post too.
The Java code now runs without errors; however, I am unable to perform a simple one select * from test.tweet
on my table.
I am getting the following SQL error:
Error code: 0 45). Please report this (
SQL code:
create table test.tweet (
text varchar(200) character set utf8mb4 collate utf8mb4_unicode_ci not null);
Java code: (I know this works)
// create a mysql database connection
String myDriver = "com.mysql.jdbc.Driver";
String myUrl = "jdbc:mysql://localhost:3306/test?";
Class.forName(myDriver).newInstance();
Connection conn = DriverManager.getConnection(myUrl, "root", "pass");
PreparedStatement setNames = conn.prepareStatement("SET NAMES 'utf8mb4'");
setNames.execute();
//Load the tweets into a mySQL DB
loadTweets(jsonObject, conn);
There is NOTHING on the internet about this error. Any thoughts why I am unable to request this error message:
Error code: 0 45). Please report this (
+3
source to share
2 answers