我在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。
答案 0 :(得分:-1)
https://dev.mysql.com/downloads/connector/j/
您是否尝试过使用MySQL Connector / J? MySQL和MariaDB是二进制兼容的,我从来没有遇到过任何问题。 MySQL Connector具有更大的社区优势。