Mariadb connector setLocalInfileInputStream equivalent of JdbcStatement

Viewed 64

I am using folowing mariadb to connect to a mysql :

    <dependency>
        <groupId>org.mariadb.jdbc</groupId>
        <artifactId>mariadb-java-client</artifactId>
        <version>3.0.3</version>
    </dependency>

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)) {
        stmt.clearParameters();
        ((JdbcStatement) stmt).setLocalInfileInputStream(stream);
        stmt.execute();
    } catch (SQLException e) {
        e.printStackTrace();
    } 
1 Answers
Related