MySQL Library BezierSQLib Not Working on New Computer

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!

Just updated and minimally tested on 3.x and 4.x (both on Mac M1) with latest MySQL. Download from here:

https://github.com/fjenett/sql-library-processing/raw/latest/release/BezierSQLib.zip

2 Likes

Fabulous Florian - thank you for your help.
This has resolved the issue perfectly.