Re: Create Access databases programmatically via JDBC-ODBC?

From: Bjorn Abelli (DoNotSpam.bjorn_abelli_at_hotmail.com)
Date: 02/05/04


Date: Thu, 5 Feb 2004 14:06:54 +0100


"Jonathan Fisher" ...

> I am interacting with Access through a JDBC-ODBC
> bridge, and my code needs to create new Access
> databases frequently. Is there some way to
> create a database programmatically from Java,
> instead of forcing my users to invoke the Data
> Source Adminstrator to create a DSN each time?
> I'm hoping for something like SQLConfigDataSource(),
> but without having to muck about in C.

There are several ways to do this, but I think the easiest would be to
deliver an empty "template" database with your application. When the need to
create a "new" db occurs, you simply make a copy of it to the desired
location and with an approriate name.

> Also, once I create a database, how do I create
> new tables in it? Obvious things like
> "CREATE TABLE ... " don't seem to work.

Yes it does.

You maybe have problems with what column types you're trying to use?

All of the types from SQL-92 can be used (except DECIMAL), though some of
the types might not map to what you expect...

// Bjorn A



Relevant Pages

  • Re: Dictionary Object name/value pair
    ... I "think" he's trying to prop up existing code by re-writing this library. ... If the API changes then more code needs to be re-written. ... That's why I think he's not using a database. ... the dictionary object creates a new element key called ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Create Access databases programmatically via JDBC-ODBC?
    ... and my code needs to create new Access ... ODBC data-source to connect to that .mdb file. ... database that is registered with the ODBC Data Source Administrator. ...
    (comp.lang.java.databases)
  • Re: Error Handling
    ... all my code needs as well. ... think is that mine creates an external error log which it will create on ... and Allen's writes the log to a table within the database. ... just email me the plain text file. ...
    (microsoft.public.access.formscoding)
  • Developing in Access 2003 with conversion problem
    ... Having a problem developing an Access 97 database in Access 2003. ... database needs to go out to a number of staff who will review it and ... it opens fine on my machine (with the usual convert or open ... message pops up saying that the code needs to be recompiled for the ...
    (comp.databases.ms-access)
  • Re: Dictionary Object name/value pair
    ... If the API changes then more code needs to be re-written. ... That's why I think he's not using a database. ... "Todos" isn't trying to make serious points - he's just trolling. ...
    (microsoft.public.dotnet.languages.csharp)