0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

MDB-SQLite のインストールと変換メモ

Last updated at Posted at 2020-05-07

はじめに

MDB-SQLiteはMS Access(mdb)をSQLiteにコンバートするソフトウェアです。
Java製のオープンソース・ソフトウェア(New BSD License)です。
インストールするにはJava以外にAntが必要です。
ビルドに際してトラブったので備忘を兼ねて記載します。

インストール手順

1. [Java]

(https://www.oracle.com/technetwork/jp/java/javase/downloads/index.html)をインストールします。

2. Apache Antをダウンロードします。

2020年5月7日時点の最新はapache-ant-1.10.7でした。
適当な位置にコピーします。(私はD:\apache-ant-1.10.7に)
ここで環境変数 "ANT_HOME" にapache-ant-1.10.7のパスを設定します。
ついでに "PATH" 環境変数に %ANT_HOME%\bin を設定しておきます。

3. mdb-sqliteをダウンロードします。

適当な位置にコピーします。(私はD:\mdb-sqlite-1.0.2に)

4. mdb-sqliteをビルドします。

> cd D:\mdb-sqlite-1.0.2  
> ant dist

とここでエラーが!!!


Buildfile: D:\mdb-sqlite-1.0.2\build.xml

prepare:

compile:
    [javac] D:\mdb-sqlite-1.0.2\build.xml:45: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds

BUILD FAILED
D:\mdb-sqlite-1.0.2\build.xml:45: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "C:\Program Files\Java\jre1.8.0_211"

Total time: 0 seconds

ここでは2つのエラーがあって、
前半の [javac] D:\mdb-sqlite-1.0.2\build.xml:45: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable buildsの部分はMDB-SQLiteのAnt1.8以降に発生する問題で、build.xmlを修正すれば解決します。

<target name="compile" depends="prepare">
    <javac srcdir="${src.dir.java}" destdir="${classes.dir}" source="1.5" target="1.5" includeantruntime="false">
        <classpath>
            <path refid="classpath"/>
        </classpath>
    </javac>
</target>

includeantruntime="false"の部分を追加します。
クラスパスにAntのランタイムライブラリを追加するかどうかの設定らしく、デフォルトでTrueとのこと。Ant1.8以降でこいつをFalseにしないと警告が出るらしい。ググったらいろんなサイトで言ってるけどデフォルトをFalseにしてほしい。

根本的なビルドエラーはBUILD FAILED以降の部分でエラー内容を見ると環境変数 "JAVA_HOME" がJDKを指していないじゃないかとのこと。
環境変数 "JAVA_HOME" を設定して、ついでに "PATH" 環境変数に %JAVA_HOME%\bin を設定して解決です。
(ただし、%ANT_HOME%\binより後にあるとエラーとなるような記事を見たので注意です。)

Buildfile: D:\mdb-sqlite-1.0.2\build.xml

prepare:

compile:
    [javac] D:\mdb-sqlite-1.0.2\build.xml:45: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds

dist:
  [one-jar] main.jar fs=main.jar
  [one-jar] Building jar: D:\mdb-sqlite-1.0.2\dist\mdb-sqlite.jar
  [one-jar] No 'manifest' attribute was specified for the <one-jar> task, a default manifest will be generated.

BUILD SUCCESSFUL
Total time: 0 seconds

変換

参考までにサンプルでついているMDBファイルをSQLiteに変換してみます。


> java -jar dist\mdb-sqlite.jar example\test-database.mdb test-database.sqlite

test-database.sqlite が作成されています。
MDB-SQLite1.png

データも無事変換されてます。
MDB-SQLite2.png

0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?