I have used the BezierSQLib library for years to connect Processing to a local MySQL library. I recently moved to a new silicon Mac and installed a recent MySQL build. I believe that there is an incompatibility with the library and the new version of MySQL.
This code that was running fine on my other machine is now giving an error:
import de.bezier.data.sql.*;
MySQL msql;
String user = "root";
String pass = "password";
String database = "BAR01";
String query = "select dayofyear(startTime), startTime, duration from sleep order by startTime ";
int DayOfYear[] = new int[0];
String StartTime[] = new String[0];
int Duration[] = new int[0];
void setup() {
size(300, 300);
fetchData();
}
void fetchData() {
msql = new MySQL( this, "localhost", database, user, pass );
if (msql.connect()) {
msql.query(query);
println(query);
while ( msql.next () ) {
DayOfYear = append(DayOfYear, msql.getInt(1));
StartTime = append(StartTime, msql.getString(2));
Duration = append(Duration, msql.getInt(3));
}
}
}
Now it produces this error:
SQL.connect(): Could not connect to the database ( jdbc:mysql://localhost/BAR01 ).
java.sql.SQLException: Unknown initial character set index '255' received from server. Initial client character set can be forced via the 'characterEncoding' property.
I believe that there is a character set incompatibility. I have tried to resolve this by adding parameters to the database field, like this, but they have not been successful.
String database = "BAR01?characterEncoding=latin1";
I have also read that upgrading the MySQL Connector in the library could alleviate the issue, but I don’t know whether it’s possible to update the library.
Any help would be appreciated!