2

我在 MariaDB 中有一个带有此规范的表:

CREATE TABLE `pages_txt` (
    `id` INT(10) UNSIGNED NOT NULL,
    `title` TEXT NOT NULL,
    `txt` MEDIUMTEXT NOT NULL,
    PRIMARY KEY (`id`)
)
COLLATE='utf8_general_ci'
ENGINE=MyISAM;

我想在这个表中插入大约 200 万条记录。但是,在插入大约 160K 记录后,连接断开,我收到此异常:

at Main.main(Main.java:57)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: org.mariadb.jdbc.internal.common.QueryException: Could not send query: Last packet not finished
    at org.mariadb.jdbc.internal.mysql.MySQLProtocol.executeQuery(MySQLProtocol.java:954)
    at org.mariadb.jdbc.MySQLStatement.execute(MySQLStatement.java:278)
    ... 21 more
Caused by: java.io.IOException: Last packet not finished
    at org.mariadb.jdbc.internal.common.packet.PacketOutputStream.startPacket(PacketOutputStream.java:38)
    at org.mariadb.jdbc.internal.common.packet.commands.StreamedQueryPacket.send(StreamedQueryPacket.java:76)
    at org.mariadb.jdbc.internal.mysql.MySQLProtocol.executeQuery(MySQLProtocol.java:952)
    ... 22 more
java.sql.SQLNonTransientConnectionException: Could not send query: Last packet not finished
    at org.mariadb.jdbc.internal.SQLExceptionMapper.get(SQLExceptionMapper.java:136)
    at org.mariadb.jdbc.internal.SQLExceptionMapper.throwException(SQLExceptionMapper.java:106)
    at org.mariadb.jdbc.MySQLStatement.executeQueryEpilog(MySQLStatement.java:262)
    at org.mariadb.jdbc.MySQLStatement.execute(MySQLStatement.java:285)
    at org.mariadb.jdbc.MySQLStatement.executeUpdate(MySQLStatement.java:313)
    at org.mariadb.jdbc.MySQLPreparedStatement.executeUpdate(MySQLPreparedStatement.java:156)
    at Main$1.process(Main.java:50)

但 MariaDB 服务器已启动并正常工作!JDBC连接器中是否有任何错误???版本是 5.5.32-MariaDB。

4

1 回答 1

-1

https://dev.mysql.com/downloads/connector/j/

你试过只使用 MySQL Connector/J 吗?MySQL 和 MariaDB 是二进制兼容的,我从来没有遇到过任何问题。MySQL 连接器具有显着更大的社区的好处。

于 2013-09-10T06:03:25.587 回答