I’m trying to load the Wikipedia dumps (for example, this one), which are a series of .sql scripts, into an SQLite database via the org.xerial sqlite-jdbc connector and MyBatis, but it appears to be failing on some /* … */ style comments at the beginning of the file with the following error:
org.apache.ibatis.jdbc.RuntimeSqlException: Error executing: /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */
. Cause: java.sql.SQLException: not implemented by SQLite JDBC driver
at org.apache.ibatis.jdbc.ScriptRunner.executeLineByLine(ScriptRunner.java:159)
at org.apache.ibatis.jdbc.ScriptRunner.runScript(ScriptRunner.java:119)
at com.tracesemantics.knowledgeengine.DatabaseConnector.loadSQLFile(DatabaseConnector.java:120)
at com.tracesemantics.knowledgeengine.DatabaseConnector.loadSQLFiles(DatabaseConnector.java:67)
at com.tracesemantics.knowledgeengine.KnowledgeEngine.loadWikimediaDumpsIntoDatabase(KnowledgeEngine.java:155)
at com.tracesemantics.knowledgeengine.KnowledgeEngine.call(KnowledgeEngine.java:119)
at com.tracesemantics.knowledgeengine.KnowledgeEngine.call(KnowledgeEngine.java:1)
at picocli.CommandLine.executeUserObject(CommandLine.java:1933)
at picocli.CommandLine.access$1200(CommandLine.java:145)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2332)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2326)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2291)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2159)
at picocli.CommandLine.execute(CommandLine.java:2058)
at com.tracesemantics.knowledgeengine.KnowledgeEngine.main(KnowledgeEngine.java:93)
Caused by: java.sql.SQLException: not implemented by SQLite JDBC driver
at org.sqlite.jdbc3.JDBC3Statement.unused(JDBC3Statement.java:387)
at org.sqlite.jdbc3.JDBC3Statement.setEscapeProcessing(JDBC3Statement.java:382)
at org.apache.ibatis.jdbc.ScriptRunner.executeStatement(ScriptRunner.java:243)
at org.apache.ibatis.jdbc.ScriptRunner.handleLine(ScriptRunner.java:223)
at org.apache.ibatis.jdbc.ScriptRunner.executeLineByLine(ScriptRunner.java:152)
... 14 common frames omitted
The start of the input file is:
-- MySQL dump 10.16 Distrib 10.1.45-MariaDB, for debian-linux-gnu (x86_64)
--
-- Host: 10.64.48.13 Database: enwiki
-- ------------------------------------------------------
-- Server version 10.1.43-MariaDB
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
I think these comments are intended to give instructions to MySQL databases. Given that they’re not supported by SQLite, is there any way I can configure either the JDBC driver or MyBatis to ignore these comments so that I can get the data into the database?
Any help would be greatly appreciated.
2
Answers
Oh, found a solution...
you also know about comment like this "/* … bla bla … /".
That must do not work on your mind, but it works.
Thus, I recommend you that change the comment from "/… */" to "– bla bla".
start of "–" comment can ignore that line without run.
ex>
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
=>
— 40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT