How to create Microsoft Access Database (.mdb) in Java - JDBC JAVA

This is a discussion on How to create Microsoft Access Database (.mdb) in Java - JDBC JAVA ; I want to create a blank Microsoft Access 97 Database in Java and later connect to it and create tables and insert data. I know how to connect to an existing .mdb database, but I have no idea how to ...

+ Reply to Thread
Results 1 to 6 of 6

How to create Microsoft Access Database (.mdb) in Java

  1. Default How to create Microsoft Access Database (.mdb) in Java

    I want to create a blank Microsoft Access 97 Database in Java and later
    connect to it and create tables and insert data. I know how to connect to an
    existing .mdb database, but I have no idea how to create one using Java. Can
    you help me figure out how to make it. Thank you!

  2. Default Re: How to create Microsoft Access Database (.mdb) in Java


    "Pony" <bjliu@21cn.com> wrote in message
    news:krkMd.259672$6l.241163@pd7tw2no...
    >I want to create a blank Microsoft Access 97 Database in Java and later
    > connect to it and create tables and insert data. I know how to connect to
    > an
    > existing .mdb database, but I have no idea how to create one using Java.
    > Can
    > you help me figure out how to make it. Thank you!


    The only solution is to copy an existing empty mdb, connect to this and
    create tables etc...
    No way to create a mdb from code (also with MS VB!!).

    Mario



  3. Default Re: How to create Microsoft Access Database (.mdb) in Java

    _Mario_ wrote:
    > "Pony" <bjliu@21cn.com> wrote in message
    > news:krkMd.259672$6l.241163@pd7tw2no...
    >
    >>I want to create a blank Microsoft Access 97 Database in Java and later
    >>connect to it and create tables and insert data. I know how to connect to
    >>an
    >>existing .mdb database, but I have no idea how to create one using Java.
    >>Can
    >>you help me figure out how to make it. Thank you!

    >
    >
    > The only solution is to copy an existing empty mdb, connect to this and
    > create tables etc...
    > No way to create a mdb from code (also with MS VB!!).
    >
    > Mario
    >
    >


    Do you think it would work if the OP read an empty mdb, stored the
    binary, then used his application to spit out the same binary as a file
    every time he wanted to create a blank database?

    John

  4. Default Re: How to create Microsoft Access Database (.mdb) in Java

    Hey Pony, I did some looking into this and found a way to do it.
    (You'll want to thank Albretch in comp.lang.java.programmer for this)

    in order to CREATE a new db in Access you will have to:

    To create a database for MS Access from Java do the following:

    - Know what version of MS Access you have.
    - Keep a blank (no tables, forms, etc...) copy of an .mdb
    - Have a method in your Java app that will copy the (basically its your
    template for databases) blank .mdb file to a new file, and the filename
    will be the name of your database you want to create.
    - Create the DSN on the fly by passing all driver config settings
    inside the connect string. Like so:

    Connection conn =
    DriverManager.getConnection("jdbcdbcriver={MicroSoft Access Driver
    (*.mdb)};DBQ=C:/MSAccess/<dbname>.mdb","<UsersId>","<password>");

    If this doesn't work out for you, I'll throw together a quick sample
    for ya and post it.

    Josh


  5. Default Re: How to create Microsoft Access Database (.mdb) in Java

    Thank you for the reply. I'll try this to see if it works. I'll contact with
    you if this doesn't work.

  6. Default Re: How to create Microsoft Access Database (.mdb) in Java

    _Mario_ wrote:
    > "Pony" <bjliu@21cn.com> wrote in message
    > news:krkMd.259672$6l.241163@pd7tw2no...
    >
    >>I want to create a blank Microsoft Access 97 Database in Java and later
    >>connect to it and create tables and insert data. I know how to connect to
    >>an
    >>existing .mdb database, but I have no idea how to create one using Java.
    >>Can
    >>you help me figure out how to make it. Thank you!

    >
    >
    > The only solution is to copy an existing empty mdb, connect to this and
    > create tables etc...
    > No way to create a mdb from code (also with MS VB!!).


    It's no help for the Java problem, but your wrong about MS VB.
    You can create an ".mdb" file using either DAO or ADO/ADOX.

+ Reply to Thread

Similar Threads

  1. How to create an AutoNumber in an Access database.
    By Application Development in forum ADO DAO RDO RDS
    Replies: 1
    Last Post: 11-06-2007, 05:43 AM
  2. Search a Microsoft Access database
    By Application Development in forum basic.visual
    Replies: 3
    Last Post: 10-25-2007, 09:43 PM
  3. Access to zipped Microsoft Access database
    By Application Development in forum JDBC JAVA
    Replies: 3
    Last Post: 11-08-2006, 08:34 AM
  4. Java access to Microsoft Access database through Samba
    By Application Development in forum JDBC JAVA
    Replies: 1
    Last Post: 06-21-2006, 03:06 PM
  5. Re: how to link Microsoft Access database to JTable ....
    By Application Development in forum JDBC JAVA
    Replies: 0
    Last Post: 10-09-2004, 10:41 AM