jelen56 / mdb-sqlite

Automatically exported from code.google.com/p/mdb-sqlite
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

java.sql.SQLException: column homework_id is not unique #14

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
~/mdb-sqlite-1.0.2$ java -jar dist/mdb-sqlite.jar ../homework.mdb 
../homework.sdb
JarClassLoader: Warning: Unable to load native library: 
java.lang.NullPointerException
Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at com.simontuffs.onejar.Boot.run(Boot.java:306)
    at com.simontuffs.onejar.Boot.main(Boot.java:159)
Caused by: java.sql.SQLException: column homework_id is not unique
    at org.sqlite.DB.execute(DB.java:275)
    at org.sqlite.DB.executeUpdate(DB.java:281)
    at org.sqlite.PrepStmt.executeUpdate(PrepStmt.java:77)
    at com.plausiblelabs.mdb.AccessExporter.populateTable(Unknown Source)
    at com.plausiblelabs.mdb.AccessExporter.populateTables(Unknown Source)
    at com.plausiblelabs.mdb.AccessExporter.export(Unknown Source)
    at com.plausiblelabs.mdb.Main.main(Unknown Source)
    ... 6 more

What version of the product are you using? On what operating system?
$ java -version
java version "1.6.0_20"
OpenJDK Runtime Environment (IcedTea6 1.9.2) (6b20-1.9.2-0ubuntu1~10.04.1)
OpenJDK Client VM (build 19.0-b09, mixed mode, sharing)

mdb-sqlite version: 1.0.2

Please provide any additional information below.

Original issue reported on code.google.com by roy...@gmail.com on 10 Dec 2010 at 3:07

GoogleCodeExporter commented 8 years ago
once I changed on line in     private void createIndex(final Index index, final 
Connection jdbc) throws SQLException:
-        final String uniqueString = index.isUnique() ? "UNIQUE" : "";
+        final String uniqueString = /*index.isUnique() ? "UNIQUE" :*/ "";

and the file is converted successfully (without any views/queries).

BTW I wonder if Views/Queries are supported in conversion.

Original comment by roy...@gmail.com on 10 Dec 2010 at 3:15

GoogleCodeExporter commented 8 years ago
Error is on populateTable method. On switch statement, a missing "i" is on 
FLOAT case

                case FLOAT:
                        prep.setDouble(+1, Double.parseDouble(row.get(
                                column.getName()).toString()));
                        break;

Should be "i+1" on index assigment.

                case FLOAT:
                        prep.setDouble(i+1, Double.parseDouble(row.get(
                                column.getName()).toString()));
                        break;

Original comment by carlospo...@gmail.com on 30 Sep 2013 at 5:11