Re: Create Access databases programmatically via JDBC-ODBC?
From: Jonathan Fisher (hq8jk4302_at_sneakemail.com.nospam)
Date: 02/13/04
- Next message: David Harper: "Re: How to count the result from sql statement?"
- Previous message: Silvio Bierman: "Re: Connection reset on MS JDBC driver"
- In reply to: Bjorn Abelli: "Re: Create Access databases programmatically via JDBC-ODBC?"
- Next in thread: UGENT: "Re: Create Access databases programmatically via JDBC-ODBC?"
- Reply: UGENT: "Re: Create Access databases programmatically via JDBC-ODBC?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 13 Feb 2004 06:16:39 GMT
In article <bvtf5f$10mong$1@ID-73292.news.uni-berlin.de>,
"Bjorn Abelli" <DoNotSpam.bjorn_abelli@hotmail.com> wrote:
> "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.
Thanks for the reply.
I'm afraid I may not have explained my question clearly enough, though.
It's not creating the new underlying .mdb file that bothers me, but the
ODBC data-source to connect to that .mdb file. As far as I can tell,
JDBC-ODBC will only allow me to interact directly with the "template"
database that is registered with the ODBC Data Source Administrator. It
seems like your suggestion would lead me to do the following every time
I want to interact with my database:
(1) Copy my "real" database, say MyDatabase.mdb, to the one that's
registered with the ODBC Data Source Administrator, say
ODBC_Template.mdb.
(2) Send my SQL code to JDBC-ODBC, referencing the DSN that is
registered to ODBC_Template.mdb.
(3) Copy ODBC_Template.mdb back to MyDatabase.mdb.
That seems like such a roundabout way of catching fish....* (And that's
assuming that the ODBC Data Source Administrator will put up with me
copying files into and out of the files that are registered with it,
which I haven't tried.) Am I missing something?
> > 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
>
>
You're right, it worked when I tried it again. I must have had a
mismatched quotation-mark or something before.... :-/
Thanks,
Jonathan
* cf "The Animal Family", by Randall Jarrell
- Next message: David Harper: "Re: How to count the result from sql statement?"
- Previous message: Silvio Bierman: "Re: Connection reset on MS JDBC driver"
- In reply to: Bjorn Abelli: "Re: Create Access databases programmatically via JDBC-ODBC?"
- Next in thread: UGENT: "Re: Create Access databases programmatically via JDBC-ODBC?"
- Reply: UGENT: "Re: Create Access databases programmatically via JDBC-ODBC?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|