Giter Site home page Giter Site logo

access2csv's Introduction

access2csv

Simple program to extract data from Access databases into CSV files.

Features

  • view the schema of the database
  • export all tables to csv files named after the table
  • export one table

Examples

Dumping a schema:

$ ./access2csv myfile.accdb --schema	
CREATE TABLE Test(
	Id INT,
	Name TEXT,
)
CREATE TABLE Test2(
	Id INT,
	Name TEXT
)

Exporting all tables:

$ ./access2csv myfile.accdb
Exporting 'Test' to /home/ryepup/Test.csv
2 rows exported
Exporting 'Test2' to /home/ryepup/Test2.csv
100000 rows exported

Export one table:

$ ./access2csv myfile.accdb Test
1,"foo"
2,"bar"

Installation

Binaries are available at https://github.com/AccelerationNet/access2csv/releases, download a jar file from there then use it as shown above.

Compile from source

$ git clone https://github.com/AccelerationNet/access2csv.git
$ cd access2csv
$ mvn clean install

Now you should have a access2csv.jar in the target directory, ready to go.

Note December, 2017. Things have changed a little. If nothing else works then, (after compiling with mvn clean install) try running something like this (example of Windows batch file) in the root of the repository (replace the path\to\file):

 ".\target\appassembler\bin\access2csv.bat" --input ".\path\to\file" --output . --write-null NULL --quote-all false --schema --with-header 

Depenencies

  • Jackess - a pure Java library for reading from and writing to MS Access databases
  • opencsv - CSV library

Contributing

Use https://github.com/AccelerationNet/access2csv to open issues or pull requests.

access2csv's People

Contributors

ansell avatar ayee-hatfield avatar bobbysmith007 avatar cristianoteles avatar dweekly avatar jeff-99 avatar ryepup avatar venetianred avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

access2csv's Issues

binary file

./access2csv myfile.accdb

seems above command uses a binary file access2csv instead of using jar file, when can I find it?

Build failure: Class java/util/UUID could not be instrumented.

I updated the Maven version from 1.6 to 1.7 (as in PR #18 ), but I still can't complete the installation from the latest source (see below). I'm running MacOSX 10.15.4 and Java 17.0.1. I wonder if you have any thoughts?


T E S T S

Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:491)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:503)
Caused by: java.lang.RuntimeException: Class java/util/UUID could not be instrumented.
at org.jacoco.agent.rt.internal_773e439.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:139)
at org.jacoco.agent.rt.internal_773e439.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:100)
at org.jacoco.agent.rt.internal_773e439.PreMain.createRuntime(PreMain.java:55)
at org.jacoco.agent.rt.internal_773e439.PreMain.premain(PreMain.java:47)
... 6 more
Caused by: java.lang.NoSuchFieldException: $jacocoAccess
at java.base/java.lang.Class.getField(Class.java:2117)
at org.jacoco.agent.rt.internal_773e439.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:137)
... 9 more
*** java.lang.instrument ASSERTION FAILED ***: "result" with message agent load/premain call failed at src/java.instrument/share/native/libinstrument/JPLISAgent.c line: 422
FATAL ERROR in native method: processing of -javaagent failed, processJavaStart failed
/bin/sh: line 1: 71045 Abort trap: 6 /usr/local/Cellar/openjdk/17.0.1_1/libexec/openjdk.jdk/Contents/Home/bin/java -javaagent:.m2/repository/org/jacoco/org.jacoco.agent/0.7.4.201502262128/org.jacoco.agent-0.7.4.201502262128-runtime.jar=destfile=access2csv/target/jacoco.exec -jar access2csv/target/surefire/surefirebooter8339662964889775121.jar access2csv/target/surefire/surefire4240032854075140718tmp access2csv/target/surefire/surefire_02164987154270898057tmp

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.949 s
[INFO] Finished at: 2022-01-14T18:17:02-08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project access2csv: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test failed: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was /bin/sh -c cd access2csv && /usr/local/Cellar/openjdk/17.0.1_1/libexec/openjdk.jdk/Contents/Home/bin/java -javaagent:.m2/repository/org/jacoco/org.jacoco.agent/0.7.4.201502262128/org.jacoco.agent-0.7.4.201502262128-runtime.jar=destfile=access2csv/target/jacoco.exec -jar access2csv/target/surefire/surefirebooter8339662964889775121.jar access2csv/target/surefire/surefire4240032854075140718tmp access2csv/target/surefire/surefire_02164987154270898057tmp
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

jar with password flag

Hi, May I have the latest release with --password flag?

Seems build from source code with the latest master branch, there wasn't an valid access2csv.jar file there... Thanks for the help.

root@ubuntu16:~/access2csv/target# ll
total 1788
drwxr-xr-x 11 root root 4096 Apr 9 18:51 ./
drwxr-xr-x 6 root root 4096 Apr 9 18:52 ../
-rw-r--r-- 1 root root 8667 Apr 9 18:51 access2csv-0.2-SNAPSHOT-bin.tar.bz2
-rw-r--r-- 1 root root 8166 Apr 9 18:51 access2csv-0.2-SNAPSHOT-bin.tar.gz
-rw-r--r-- 1 root root 8345 Apr 9 18:51 access2csv-0.2-SNAPSHOT-bin.zip
-rw-r--r-- 1 root root 7417 Apr 9 18:50 access2csv-0.2-SNAPSHOT.jar
-rw-r--r-- 1 root root 1720717 Apr 9 18:51 access2csv-0.2-SNAPSHOT-jar-with-dependencies.jar
-rw-r--r-- 1 root root 4815 Apr 9 18:51 access2csv-0.2-SNAPSHOT-tests.jar
drwxr-xr-x 4 root root 4096 Apr 9 18:50 appassembler/
drwxr-xr-x 2 root root 4096 Apr 9 18:51 archive-tmp/
drwxr-xr-x 3 root root 4096 Apr 9 18:50 classes/
drwxr-xr-x 3 root root 4096 Apr 9 18:50 generated-sources/
drwxr-xr-x 3 root root 4096 Apr 9 18:50 generated-test-sources/
-rw-r--r-- 1 root root 9998 Apr 9 18:50 jacoco.exec
drwxr-xr-x 2 root root 4096 Apr 9 18:50 maven-archiver/
drwxr-xr-x 3 root root 4096 Apr 9 18:50 maven-status/
drwxr-xr-x 2 root root 4096 Apr 9 18:50 surefire-reports/
drwxr-xr-x 3 root root 4096 Apr 9 18:50 test-classes/

root@ubuntu16:~/access2csv/target# java -jar access2csv-0.2-SNAPSHOT-jar-with-dependencies.jar --help
no main manifest attribute, in access2csv-0.2-SNAPSHOT-jar-with-dependencies.jar

Fails when exporting linked databases

When running access2csv on databases with linked tables, it fails with a NullPointerException. All links are correct and the database is fully functional in Access.

Exporting 'Abs: HP8524A' to C:\Users\Kim\Documents/Abs HP8524A.csv
Exception in thread "main" java.lang.NullPointerException
at java.io.File.(Unknown Source)
at com.healthmarketscience.jackcess.util.LinkResolver$1.resolveLinkedDatabase(LinkResolver.java:45)
at com.healthmarketscience.jackcess.impl.DatabaseImpl.getTable(DatabaseImpl.java:895)
at com.healthmarketscience.jackcess.impl.DatabaseImpl.getTable(DatabaseImpl.java:839)
at com.healthmarketscience.jackcess.impl.DatabaseImpl.getTable(DatabaseImpl.java:87)
at access2csv.Driver.export(Driver.java:19)
at access2csv.Driver.exportAll(Driver.java:83)
at access2csv.Driver.main(Driver.java:127)

Exception in thread "main" java.lang.ClassNotFoundException: access2csv.Driver

I've cloned and compiled successfully, but when I run the script it throws an error:

Exception in thread "main" java.lang.ClassNotFoundException: access2csv.Driver

Any idea what's going on? I already fixed a few other absolute paths in build.xml that were causing issues, but I'm not familiar enough to track this bug down.

The Driver.java class definitely exists in src/access2csv/Driver.java but I don't think the build.xml is referencing the right path.

unsupported newer version error

hi, I am getting this error when trying to export my db:

 access2csv.jar db.accdb --schema 
Exception in thread "main" java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.io.IOException: Unsupported newer version: 5
	at com.healthmarketscience.jackcess.impl.JetFormat.getFormat(JetFormat.java:293)
	at com.healthmarketscience.jackcess.impl.DatabaseImpl.open(DatabaseImpl.java:378)
	at com.healthmarketscience.jackcess.DatabaseBuilder.open(DatabaseBuilder.java:170)
	at com.healthmarketscience.jackcess.DatabaseBuilder.open(DatabaseBuilder.java:193)
	at access2csv.Driver.schema(Driver.java:49)
	at access2csv.Driver.main(Driver.java:122)
	... 5 more

please advice, kind regards
dan

Does not capture header/title/first row

it's making it rather difficult to sort through some of this data. Am I missing a simple command to capture this? Thanks

here's one of the offending .accdb files for you to reproduce the issue
PA02.zip

Error in OSX

Hi, I compiled from the latest git and seems to be OK

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.458 s
[INFO] Finished at: 2017-02-03T12:31:52-05:00
[INFO] Final Memory: 38M/2172M
[INFO] ------------------------------------------------------------------------

However, trying to run it gives the following error:

jsepulveda:target JS$ java -jar access2csv-0.2-SNAPSHOT-jar-with-dependencies.jar
no main manifest attribute, in access2csv-0.2-SNAPSHOT-jar-with-dependencies.jar

Looking back at the log I see no errors but the following:

[INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ access2csv ---
....
[INFO] skip non existing resourceDirectory /Users/JS/Dropbox/R_packages/JavaJS/access2csv/src/main/resources

...

T E S T S

objc[3147]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/jre/bin/java and /Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.
...
Tests run: 7, Failures: 0, Errors: 0, Skipped: 4
...
[INFO] Building tar: /Users/JS/Dropbox/R_packages/JavaJS/access2csv/target/access2csv-0.2-SNAPSHOT-bin.tar.gz
[WARNING] The assembly descriptor contains a filesystem-root relative reference, which is not cross platform compatible /
...

Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X El Capitan 10.11.6

Thanks for any help!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.