Skip to content

[1.5.1] call mysql_query() error. java.sql.SQLException: IO Error: Lost connection to server during query. autocommit mode #218

@robotslacker

Description

@robotslacker

What happens?

start duckdb v1.5.1
attach remote mysql database.
set connection autocommit.
use PreparedStatement to execute mysql_query()

java.sql.SQLException: IO Error: Failed to execute MySQL query "select 1": Lost connection to server during query

at org.duckdb.DuckDBNative.duckdb_jdbc_execute(Native Method)
at org.duckdb.DuckDBPreparedStatement.execute(DuckDBPreparedStatement.java:229)

To Reproduce

    void testMysql() throws Exception
    {
        String  connectURL = "jdbc:duckdb::memory:";
        Connection pgConn = DriverManager.getConnection(
                connectURL, "", "");
        pgConn.setAutoCommit(true);
        PreparedStatement preparedStatement;
        preparedStatement = pgConn.prepareStatement("load mysql");
        preparedStatement.execute();
        preparedStatement = pgConn.prepareStatement("ATTACH 'host=192.168.183.134 user=root password=123456 port=3406 database=mysql' AS mysqldb (TYPE mysql)");
        preparedStatement.execute();
        preparedStatement = pgConn.prepareStatement("select * from mysql_query('mysqldb','select 1')");
        preparedStatement.execute();
    } 

OS:

Generic

MySQL Version:

8.4.5

DuckDB Version:

1.5.1

DuckDB Client:

Java

Full Name:

Robotslacker

Affiliation:

Free

Have you tried this on the latest main branch?

  • I agree

Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

  • I agree

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions