I'm a Linux user so an open-source, Linux-friendly solution would be preferable.
MDB Tools is a set of open source libraries and utilities to facilitate exporting data from MS Access databases (mdb files) without using the Microsoft DLLs. Thus non Windows OSs can read the data. Or, to put it another way, they are reverse engineering the layout of the MDB file.
Jackcess is a pure Java library for reading from and writing to MS Access databases. It is part of the OpenHMS project from Health Market Science, Inc. . It is not an application. There is no GUI. It's a library, intended for other developers to use to build Java applications.
ACCESSdb is a JavaScript library used to dynamically connect to and query locally available Microsoft Access database files within Internet Explorer.
Both Jackcess and ACCESSdb are much newer than MDB tools, are more active and has write support.
This is probably not the answer you want but the safest way to do this would be to get Visual Studio Express and read in the database using ODBC connector and then writing out the data using the ADO.NET Sqlite connector. I have found generally third party tools to talk to JET databases... JET waas aweful and never easily reverse engineered.
To complement Tony's answer with examples:
This is how I just did a conversion with MDB Tools to sqlite, in Ubuntu 16.04:
sudo apt install mdbtools
# define variables for easier copy/paste of the rest
in="my-jet4-file"
schema="$in-schema.sql"
out="$in.sqlite"
mdb-schema "$in" sqlite > "$schema"
sqlite3 "$out" < "$schema"
mdb-tables -1 "$in" \
| while read table; do \
mdb-export -I sqlite "$in" "$table" | sqlite3 "$out"; \
done
This uses Insert statements and is quite slow.
A faster alternative would be to export/import .csv files. I had used that sucessfully with Postgres:
#...
out="my_pg_db"
createdb "$out"
mdb-schema "$in" postgres > "$schema"
psql -U postgres -d "$out" -f "$schema"
mdb-tables -1 "$in" \
| while read table; do \
mdb-export -d'|' "$in" "$table" > "$table.csv"; \
psql -d "$out" -c "COPY \"$table\" FROM '$table.csv' DELIMITER '|' CSV HEADER"
done
Finally, there is also mdb-sqlite, which uses Jackcess and Java. After installing Java and ant:
cd mdb-sqlite-1.0.2
ant dist
java -jar dist/mdb-sqlite.jar "$in" "$out"
Related
Is there any third party tool (free or paid) which could be useful in generating Entity Relationship Diagram from the views in SQL Server 2005/2008 or higher version?
For example,I have a view in my database and I wish to generate ER Diagram based on all the tables that are being referred in the view.
Let me know for any doubts
Thanks!
you can use a Java-based free tool named SchemaSpy. It basically works with any RDBMS as long as it has a JDBC connector.
I have discovered this while scratching my own itch, and also created a detailed post on it. Can be found here: http://blog.kmonsoor.com/generate-er-diagram-from-sql-database/
Summary:
First of all, your system should have Java runtime properly
installed. SchemaSpy is a .jar file. Get it:
http://sourceforge.net/projects/schemaspy/files/
JDBC connector to
you DB. Make sure to match your DBMS version.
Also, SchemaSpy
depends on GarphViz to generate the ER-diagrams, so you need to be
installed it on your system. http://www.graphviz.org/Download..php
target DB instance must be up & running
Now, this command will do the magic:
$ java -jar ./schemaSpy_5.0.0.jar -t pgsql -host 127.0.0.1:5432 -db your_database_name \
-u your_DB_user_name -p your_password -s public \
-dp ./database_specific.jdbc3.jar \
-o output_folder
There are a couple ways to do this, many outlined below. The easiest approach would be to use SQL Server's own diagrammer (described on the link below).
http://msdn.microsoft.com/en-us/library/aa224825(v=sql.80).aspx
Just do it in SQL Server Management Studio:
Connect your DB, open Object Explorer and right click your view and select "Design". This gives you the graphical view designer, which is a pretty good ER diagram of your view.
use mysql workbench. There are tools already provided to generate ER diagram directly from database.
So, for some reason, I am having a bit of trouble with my sqlite database. I'm trying to dump my database into a file that could be used in Titanium. I know about the .dump command, but when I try to use the instructions on the sqlite website:
A good way to make an archival copy of a database is this:
$ echo '.dump' | sqlite3 ex1 | gzip -c >ex1.dump.gz
and change the ex1.dump.gz to ex1.sqlite.gz, it gives a really messed up file that is useless. How can I dump my database so that I can then use it in my Titanium Studios mobile app?
Why do you dump the database file when you can simply copy it, i.e. use it as it is?
As explained here, sqlite databases are cross-platform:
A database in SQLite is a single disk file. Furthermore, the file
format is cross-platform. A database that is created on one machine
can be copied and used on a different machine with a different
architecture. SQLite databases are portable across 32-bit and 64-bit
machines and between big-endian and little-endian architectures.
On the other hand, you should be able to dump, compress you database like this:
echo '.dump' | sqlite3 foo.db | gzip -c > foo.dump.gz
and restore it in a new SQLite database:
gunzip -c foo.dump.gz | sqlite3 foo.new.db
.dump exports the contents of your database as a series of insert statements. If you run it without the gzip command you'll see plain text sql:
$ echo '.dump' | sqlite3 ex1
But you don't need to do that to use a SQLite database in Titanium Studios. It supports SQLite natively. Just copy the database file to your project directory and then use code like this to open it:
var db = Ti.Database.install('../products.sqlite','products');
var rows = db.execute('SELECT DISTINCT category FROM products');
More details here:
http://mobile.tutsplus.com/tutorials/appcelerator/titanium-mobile-database-driven-tables-with-sqlite/
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I've been given a database which I can't handle with my pc, because of little available storage and memory.
The person who gave me this db gave me the following details:
The compressed file is about 15GB, and uncompressed it's around
85-90GB. It'll take a similar amount of space once restored, so make
sure the machine that you restore it on has at least 220GB free to be
safe. Ideally, use a machine with at least 8GB RAM - although even our
modest 16GB RAM server can struggle with large queries on the tweet
table.
You'll need PostgreSQL 8.4 or later, and you'll need to create a
database to restore into with UTF8 encoding (use -E UTF8 when creating
it from the command-line). If this is a fresh PostgreSQL install, I
highly recommend you tweak the default postgresql.conf settings - use
the pgtune utility (search GitHub) to get some sane defaults for your
hardware. The defaults are extremely conservative, and you'll see
terrible query performance if you don't change them.
When I told him that my pc sort of sucks, he suggested me to use an Amazon EC2 instance.
My two issues are:
How do I upload the db to an Amazon VM?
How do I use it after that?
I'm completely ignorant regarding cloud services and databases as you can see. Any relevant tutorial will be highly appreciated.
If you're new to cloud hosting, rather than using EC2 directly consider using EnterpriseDB's cloud options. Details here.
If you want to use EC2 directly, sign up and create an instance.
Choose your preferred Linux distro image. I'm assuming you'll use Linux on EC2; if you want to use Windows that's because you probably already know how. Let the new VM provision and boot up, then SSH into it as per the documentation available on Amazon for EC2 and for that particular VM image. Perform any recommended setup for that VM image as per its documentation.
Once you've done the recommended setup for that instance, you can install PostgreSQL:
For Ubuntu, apt-get install postgresql
For Fedora, yum install postgresql
For CentOS, use the PGDG yum repository, not the outdated version of PostgreSQL provided.
You can now connect to Pg as the default postgres superuser:
sudo -u postgres psql
and are able to generally use PostgreSQL much the same way you do on any other computer. You'll probably want to make yourself a user ID and a new database to restore into:
echo "CREATE USER $USER;" | sudo -u postgres psql
echo "CREATE DATABASE thedatabase WITH OWNER $USER" | sudo -u postgres psql
Change "thedatabase" to whatever you want to call your db, of course.
The exact procedure for restoring the dump to your new DB depends on the dump format.
For pg_dump -Fc or PgAdmin-III custom-format dumps:
sudo -u postgres pg_restore --dbname thedatabase thebackupfile
See "man pg_restore" and the online documentation for details on pg_restore.
For plain SQL format dumps you will want to stream the dump through a decompression program then to psql. Since you haven't said anything about the dump file name or format it's hard to know what to do. I'll assume it's gzip'ed (".gz" file extension), in which case you'd do something like:
gzip -d thedumpfile.gz | sudo -u postgres psql thedatabase
If its file extension is ".bz2" change gzip to bzip2. If it's a .zip you'll want to unzip it then run psql on it using sudo -u postgres psql -f thedumpfilename.
Once restored you can connect to the db with psql thedatabase.
How can I extract (reverse engineering) a graphical (schema) representation of an Oracle database (tables and their relationships; with colums and datatypes....). Are there (free) tools, which can do this?
I think the Oracle SQL Developer has no such feature...
There is a related Oracle tool, SQL Developer Data Modeler which does reverse engineering and it is free. Find out more.
Sql Developer does this (check the SQL Modeller option) and lots lots more. An amazingly good tool !
For a free tool I recommend schema spy, http://schemaspy.sourceforge.net/.
It needs Java Runtime.
Look to http://schemaspy.sourceforge.net/sample/relationships.html to see diagrams it generate.
This tool is also more suitable to automatic build scripts.
simple usage with oracle hr template is given below.
SET JDBC_ORACLE_JAR=C:\oracle\product\10.2.0\client_1\jdbc\lib\ojdbc14.jar
SET CONNECTION_USERNAME=hr
SET CONNECTION_PASSWORD=hr
SET TNS_DATABASE_NAME=orcl
SET SCHEMA_NAME=HR
SET TABLE_NAME='EMP'
SET OUTPUT_NAME=HR_EMP
java -jar schemaSpy_5.0.0.jar -dp %JDBC_ORACLE_JAR% -db %TNS_DATABASE_NAME% -o schemaOutput%OUTPUT_NAME% -u %CONNECTION_USERNAME% -p %CONNECTION_PASSWORD% -i %TABLE_NAME%.* -schemas %SCHEMA_NAME% -hq -noviews -loglevel severe
java -jar schemaSpy_5.0.0.jar -dp %JDBC_ORACLE_JAR% -db %TNS_DATABASE_NAME% -o schemaOutput%OUTPUT_NAME% -u %CONNECTION_USERNAME% -p %CONNECTION_PASSWORD% -schemas %SCHEMA_NAME% -hq -noviews -loglevel severe
First one will give you diagram with tables starting with EMP .
Second one will give you diagram with all tables in hr schema .
Adminer is an awesome PHP single file that should be able to do what you request. I tried only with MySQL, but Oracle it's supported as well.
I'm not aware of any free tools:
MS Visio can reverse engineer (professional/Premium)
TOAD an expensive tool but well worth it IMO
The development machine I work on has Ubuntu Jaunty Jackalope as its operating system. I have been presented with data for a project I'm working on in the form of an .accdb file created by Microsoft Access. I do not own a copy of Microsoft Access. I do have Open Office installed and would be willing to install any software package available to my operating system. Is there a way I can open or transform this file so that I can view and edit the data on my computer? Is there another format that the Access database could be saved as that I would be able to open?
There are two open source tools available however they only work on MDB format files. Can you ask the supplier of the ACCDB file to give it to you in MDB format?
MDB Tools is a set of open source libraries and utilities to facilitate exporting data from MS Access databases (mdb files) without using the Microsoft DLLs.
Jackcess is a pure Java library for reading from and writing to MS Access databases. It is part of the OpenHMS project from Health Market Science, Inc. . It is not an application. There is no GUI. It's a library, intended for other developers to use to build Java applications. It appears to be much newer than MDB tools, is more active and has write support.
Jackcess now supports everything from Access 97 (read-only), 2000, 2003, 2007, and 2010 (read-write), both .mdb and .accdb files.
Dumping the file can be as easy as
import com.healthmarketscience.jackcess.*;
import java.io.*;
public class AccessExport {
public static void main(String []args) throws IOException {
System.out.println(Database.open(new File(args[0])).getTable(args[1]).display());
}
}
(of course, you need a java compiler, libcommons-logging-java, libcommons-lang-java and you have to pass the .accdb filename as the first and the table name as the second parameter).
-Marcel
I just had this same problem on an Ubuntu 14.01 AWS EC2 instance and I was able to accomplish this task (convert .accdb file to CSV on Ubuntu) by using access2csv. I had to install Git, install Java, and install ant, but then was able to convert the .accdb files I had to CSV by typing:
$ java -jar access2csv.jar myfile.accdb
It uses Jackcess so you get the same functionality without having to write your own Java code to accomplish this basic task. Each table is returned as its own CSV file.
You can also access the schema by passing the --schema option:
java -jar access2csv.jar myfile.accdb --schema
Hope this is helpful. It certainly was for me.
A good format to view and work with on Linux would be CSV.
As the accepted answer suggests MDB Tools does the job. To export all the tables on Linux to CSV format try this command:
mdb-tables -d ',' database.accdb| xargs -L1 -d',' -I{} bash -c 'mdb-export database.accdb "$1" >"$1".csv' -- {}
You can use mdbtools also into windows via WSL (Ubuntu on Windows or Debian on Windows):
Then install it in console with:
sudo apt install mdbtools
This may be of interest: How to convert accdb to a postgres database
I am not sure if Wine would suit, but it might be worth a look.
I found this blog: http://tahsinabrar.com/open-a-microsoft-access-accdb-file-in-ubuntu/
In case the link is broken, the contents say:
We can use the UCanAccess JDBC driver to connect to Access databases
(.mdb and .accdb) in LibreOffice Base. Here’s how I did it on a clean
install of Ubuntu 14.04 LTS.
First, I installed LibreOffice Base itself
sudo apt-get install libreoffice-base
Then I downloaded UCanAccess to my Downloads folder and unzipped it.
I launched LibreOffice (not Base, just LibreOffice itself)
LibreOffice.png
and chose Tools > Options
On the Advanced tab I clicked the “Class Path…” button and then added
the following five (5) JAR files using the “Add Archive…” button:
/home/abrar/Downloads/UCanAccess-2.0.9.5-bin/ucanaccess-2.0.9.5.jar
/home/abrar/Downloads/UCanAccess-2.0.9.5-bin/lib/commons-lang-2.6.jar
/home/abrar/Downloads/UCanAccess-2.0.9.5-bin/lib/commons-logging-1.1.1.jar
/home/abrar/Downloads/UCanAccess-2.0.9.5-bin/lib/hsqldb.jar
/home/abrar/Downloads/UCanAccess-2.0.9.5-bin/lib/jackcess-2.1.0.jar
Note that you must close and re-open LibreOffice for the new Class
Path values to take effect.
Then I launched LibreOffice Base, and in Step 1 of the wizard I chose
“Connect to an existing database (JDBC)”
The Access file I wanted to manipulate was named “baseTest.accdb” in
my Downloads folder, so in Step 2 the “Datasource URL” was
jdbc:ucanaccess:///home/abrar/Downloads/baseTest.accdb
and the “JDBC driver class” was
net.ucanaccess.jdbc.UcanaccessDriver
In Step 3, I left the “User name” field empty and just clicked “Next
”.
In Step 4, I saved the LibreOffice Base database as “accdbTest.odb” in
my Documents folder.
When the wizard completed it opened my LibreOffice database and I
could see the tables in the .accdb file
But you have download and unzip UCANACCESS first from here: http://ucanaccess.sourceforge.net/site.html
I can see all the tables in LibreOffice Base. Here is one:
I guess you want to extract data from tables, not code from modules. I do not know specifically Ubuntu but I guess you can connect to the access file using an ODBC connection (or, if available, OLEDB connection) and extract the data? Depending on the connection type, you might still need to know the tables names in order to import them.
Microsoft Access Runtime is a free software. You can install it in Ubntu using Wine and then open the accdb database.
Im not sure if there are any native tools, but you can always install a copy of windows and install a free view for accdb files or install a trial of Access.