[SOLVED] Mariadb connector setLocalInfileInputStream equivalent of JdbcStatement


I am using folowing mariadb to connect to a mysql :


My problem is that I want to use local script. According to the mariadb connector documentation, this should be achievable using "setLocalInfileInputSream" as describe here : https://mariadb.com/kb/en/about-mariadb-connector-j/#jdbc-api-implementation-notes

But as describe, the Statement used should be a wrapper of MariaDbStatement. In my code the statement I use is of this class : class org.mariadb.jdbc.ClientPreparedStatement

Also the class MariaDbStatement is not in my class path, so I can’t even have the example coed compiling.

Here is an extract of my code. This code is an alternate version using the java mysql connector as I was not able to use the mariadb java client. Again, the main problem seems to be that I don’t have MariaDbStatement in my class path (to be used instead of JdbcStatement).

 try (PreparedStatement stmt = con.prepareStatement(query)) {
        ((JdbcStatement) stmt).setLocalInfileInputStream(stream);
    } catch (SQLException e) {


The MariaDbStatement is not present anymore in the mariadb java connector since the 3.0.0 version.

It was deleted in this commit : https://github.com/mariadb-corporation/mariadb-connector-j/commit/e5e95ddfd6ceed7bce757a5b2521c61208e59700

The documentation seems outdated then.

Answered By – bloub

Answer Checked By – Dawn Plyler (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *