aspose file tools*
The moose likes JDBC and the fly likes create new .mdb file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "create new .mdb file" Watch "create new .mdb file" New topic
Author

create new .mdb file

rajesh mahendran
Greenhorn

Joined: Feb 17, 2013
Posts: 9
I just need to know that how can a create a new database file (.mdb) file dynamically using a java program anyone please help me thanks in advance....
Alexander Bondarev
Greenhorn

Joined: Jan 04, 2012
Posts: 12
I know two ways:
1) Create a new database in Microsoft Access and save it in the file template.mdb. Then to create a new database just copy template.mdb and rename it.
2) If you want to have full control over the database creation then use Jacob - Java COM Bridge and create a database through the DBEngine.CreateDatabase method.
rajesh mahendran
Greenhorn

Joined: Feb 17, 2013
Posts: 9
Alexander Bondarev wrote:I know two ways:
1) Create a new database in Microsoft Access and save it in the file template.mdb. Then to create a new database just copy template.mdb and rename it.
2) If you want to have full control over the database creation then use Jacob - Java COM Bridge and create a database through the DBEngine.CreateDatabase method.



can you just elaborate it in a detailed manner..ie) with a java program..
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3697
    
    5

I think Alexander's answer is self-explanatory. If you need assistance copying files, there are plenty of ways to do this in Java.


My Blog: Down Home Country Coding with Scott Selikoff
rajesh mahendran
Greenhorn

Joined: Feb 17, 2013
Posts: 9
explain it with a simple java code so that i can understand



will it generate a blank database with name abc or what else should i do to create...
Alexander Bondarev
Greenhorn

Joined: Jan 04, 2012
Posts: 12
You will probably get an exception in the line 4,

if the database file 'E:/dbbb.mdb' doesn't exist. Anyway you can run your code and see it. As I know SQL in Microsoft Access doesn't support the CREATE DATABASE command.
rajesh mahendran
Greenhorn

Joined: Feb 17, 2013
Posts: 9
the how can i proceed on with what is the way to create it... in ms access anyone please help me...
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3454
    
  47

There really isn't much to add to Alexander's suggestions.

The first one is probably much easier. Create an empty MDB file somewhere and store it with your application (it could be bundled in your jar file). When you need a new database, just copy this file into the desired location.
Wei Dai
Ranch Hand

Joined: Jun 22, 2005
Posts: 86
1. java.io.File copy blank mdb file

2. free Java Library for MS Access at http://jackcess.sourceforge.net/
Database.create(new File("new.mdb"));
3. commercial JDBC driver for MS Access at http://www.hxtt.com/access.html
sql: create database newfile;
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: create new .mdb file
 
Similar Threads
Database Connection in .jar
create .mdb file through command
MDB file creation
MS ACCESS DSN less Connection
how to create .mdb file?