473,383 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Trying to create a database in a MS Access DB via JDBC drivers

.. I am trying to create a database in a MS Access DB via JDBC drivers.
I have tried both sun.jdbc.odbc.JdbcOdbcDriver and ids.sql.IDSDriver

From some reason both drivers Exceptions tell me 'Syntax error in
CREATE TABLE statement' even though I am not creating a table, but a
Database

// - - - - - - - - - - - - sun.jdbc.odbc.JdbcOdbc
aSQL=CREATE DATABASE dbtest;
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]
Syntax error in CREATE TABLE statement.
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(Unkn own
Source)
at JDBCDL00.createCtlg(JDL00.java:200)
at JDL00.main(JDL00.java:505)

// - - - - - - - - - - - - ids.sql
aSQL=CREATE DATABASE dbtest;
java.sql.SQLException: [42000][Microsoft][ODBC Microsoft Access
Driver] Syntax error in CREATE TABLE statement
at ids.sql.IDSSocket.error(IDSSocket.java:374)
at ids.sql.IDSSocket.verify(IDSSocket.java:320)
at ids.sql.IDSStatement.submit(IDSStatement.java:157)
at ids.sql.IDSStatement.execute(IDSStatement.java:479 )
at ids.sql.IDSStatement.executeUpdate(IDSStatement.ja va:270)
at JDBCDL00.createCtlg(JDL00.java:200)
at JDL00.main(JDL00.java:505)

Does it mean MS Access does not have a concept of a BD, since it is
kind of a file base Data Store?

There is also something I don't quite know how to interpret.

When you ask the JdbcOdbc driver for Catalogs it gives you

.. . .\Office\Samples\ADDRBOOK
.. . .\Office\Samples\CONTACT
.. . .\Office\Samples\INVENTRY
.. . .\Office\Samples\Northwind

even if you declare the a USer DSN only to

.. . .\Office\Samples\Northwind

Experimentally I dropped a copy of

.. . .\Office\Samples\Northwind.mdb

in

.. . .\IDS\File\examples

and set up a system DSN to got IDSExamples.mdb

However, while query the DBMS for catalogs, I got

.. . .\IDS\File\examples\IDSExamples
.. . .\IDS\File\examples\Northwind

Does it mean Access considers the folder containing the '.mdb' file
as sort of a 'schema'?

How could u still create a Database using JDBC in a MSAccess DB?
Nov 13 '05 #1
9 3522
Liz
I am pretty sure you can't create a database with jdbc,
at least on the pc.

"Albretch" <lb*****@hotmail.com> wrote in message
news:f8**************************@posting.google.c om...
. I am trying to create a database in a MS Access DB via JDBC drivers.
I have tried both sun.jdbc.odbc.JdbcOdbcDriver and ids.sql.IDSDriver

From some reason both drivers Exceptions tell me 'Syntax error in
CREATE TABLE statement' even though I am not creating a table, but a
Database

// - - - - - - - - - - - - sun.jdbc.odbc.JdbcOdbc
aSQL=CREATE DATABASE dbtest;
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]
Syntax error in CREATE TABLE statement.
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(Unkn own
Source)
at JDBCDL00.createCtlg(JDL00.java:200)
at JDL00.main(JDL00.java:505)

// - - - - - - - - - - - - ids.sql
aSQL=CREATE DATABASE dbtest;
java.sql.SQLException: [42000][Microsoft][ODBC Microsoft Access
Driver] Syntax error in CREATE TABLE statement
at ids.sql.IDSSocket.error(IDSSocket.java:374)
at ids.sql.IDSSocket.verify(IDSSocket.java:320)
at ids.sql.IDSStatement.submit(IDSStatement.java:157)
at ids.sql.IDSStatement.execute(IDSStatement.java:479 )
at ids.sql.IDSStatement.executeUpdate(IDSStatement.ja va:270)
at JDBCDL00.createCtlg(JDL00.java:200)
at JDL00.main(JDL00.java:505)

Does it mean MS Access does not have a concept of a BD, since it is
kind of a file base Data Store?

There is also something I don't quite know how to interpret.

When you ask the JdbcOdbc driver for Catalogs it gives you

. . .\Office\Samples\ADDRBOOK
. . .\Office\Samples\CONTACT
. . .\Office\Samples\INVENTRY
. . .\Office\Samples\Northwind

even if you declare the a USer DSN only to

. . .\Office\Samples\Northwind

Experimentally I dropped a copy of

. . .\Office\Samples\Northwind.mdb

in

. . .\IDS\File\examples

and set up a system DSN to got IDSExamples.mdb

However, while query the DBMS for catalogs, I got

. . .\IDS\File\examples\IDSExamples
. . .\IDS\File\examples\Northwind

Does it mean Access considers the folder containing the '.mdb' file
as sort of a 'schema'?

How could u still create a Database using JDBC in a MSAccess DB?

Nov 13 '05 #2
I think the problem is that
Access maps one database to
one file. With the odbc
bridge you can access to a db
either via DSN (see ODBC
sources) or by specifing
the actual file in which the
db is contained.

Therefore it's not possible to
CREATE a new db.
You could try creating a new
..mdb file in the file system
and point the odbc bridge to
that file and finally start
creating TABLEs (and not
DATABASE).
--
Luca Paganelli
Nov 13 '05 #3
You mean a MS Access one right?

I have indeed created all kinds of DBs for the other JDBC
drivers/DBMS combinations.

"Liz" <Li*@nospam.com> wrote in message news:<y9CMc.180319$Oq2.73346@attbi_s52>...
I am pretty sure you can't create a database with jdbc,
at least on the pc.

Nov 13 '05 #4
"Luca Paganelli" <as*@me.it> wrote in message news:<%W******************@tornado.fastwebnet.it>. ..
I think the problem is that
Access maps one database to
one file. With the odbc
bridge you can access to a db
either via DSN (see ODBC
sources) or by specifing
the actual file in which the
db is contained.

Therefore it's not possible to
CREATE a new db.
You could try creating a new
.mdb file in the file system
and point the odbc bridge to
that file and finally start
creating TABLEs (and not
DATABASE).


Yeah! I figured! I just wanted to have more input from experienced
people.

So, and this is also info 'for the rest of us', in order to CREATE a
new db in Access you will have to:

1._ know which version of Access you are working with

2._ keep a blank (no tables, queries, . . .) copy of an ".mdb" file
for this version

3._ know which directory do you want the 'new' DB in

4._ transfer the blank copy to this dir

5._ rename the '.mdb' file to the name of the 'created' DB

6._ define the DSN "on the fly" by passing all driver conf. settings
(ODBC configuration params in this case) inside the connect string:

con = DriverManager.getConnection("jdbc:odbc:Driver={Mic roSoft Access
Driver (*.mdb)};DBQ=C:/data/Access/<name>.mdb","<UsersId>","<password>");

I think this is not a big deal at all and works on the OS level, so
probably MS Access drivers should do that on their own. Wouldn't you
agree?

Why don't they?
Nov 13 '05 #5
improving myself on:
4._ transfer the blank copy to this dir


I think there is a way within the OS to produce a blank Access .mdb file

As it is the case when you right click on a folder and select

New > MS Access file
Nov 13 '05 #6
Why don't I see more about JDO? I *thought* it was s'possed to be the OO
database holy grail..
Thufir Hawat
<http://www.shaw.ca/members/hawat/source/>
Nov 13 '05 #7
th**********@mail.com wrote:
Why don't I see more about JDO? I *thought* it was s'possed to be the
OO database holy grail..
Thufir Hawat
<http://www.shaw.ca/members/hawat/source/>


Sorry Thufir, but you were mistaken. Unusual for a mentat. Perhaps
you've been compromised? <g>

Luke
Nov 13 '05 #8
On Tue, 27 Jul 2004, Luke Webber wrote:
th**********@mail.com wrote:
Why don't I see more about JDO? I *thought* it was s'possed to be the OO
database holy grail..
Thufir Hawat
<http://www.shaw.ca/members/hawat/source/>


Sorry Thufir, but you were mistaken. Unusual for a mentat. Perhaps you've
been compromised? <g>

Luke


you've let the cat out of the bag!
Thufir Hawat
<http://www.shaw.ca/members/hawat/source/>

Nov 13 '05 #9
On Wed, 28 Jul 2004 08:38:58 GMT, th**********@mail.com wrote:
On Tue, 27 Jul 2004, Luke Webber wrote:
th**********@mail.com wrote: .... Sorry Thufir, but you were mistaken. Unusual for a mentat. Perhaps you've
been compromised? <g>
.... you've let the cat out of the bag!


Where's my Gom Jabbar? ;-)

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Nov 13 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: apchar | last post by:
I am trying to use php as a kind of servlet to act as a middle man between a java applet and mysql. I know java has jdbc but it's flakey and painful. php access to mysql is much nicer. So I have:...
8
by: nunodonato | last post by:
hi there. i'm thinking of developing an app using Java to manage a library (books, clients, orders..etc). I am not sure of how to store the data, maybe using files or a DBMS. The ammount of data...
3
by: gbhatti | last post by:
Dear all, Our application needs a bit of database redundancy. Our application only accesses database for reading purposes.
2
by: Paul Reddin | last post by:
Hi, (V8.1 Fp2) Our application uses JDBC batch to execute mutiple insert statements and we saw a strange thing this morning. There were 4 SQL Insert statements in the batch, and we know the...
5
by: Jim | last post by:
Hi Folks, We have a DB2 database on a WAN at work. I want to access the database from some Visual Basic for Applications code that I have written at work. The database itself is not directly...
0
by: cwho.work | last post by:
Hi! We are using apache ibatis with our MySQL 5.0 database (using innodb tables), in our web application running on Tomcat 5. Recently we started getting a number of errors relating to...
2
by: sang | last post by:
Hello I have a doubt in JDBC Drivers using in mysql, How many types of Drivers are available in java using msql. From this ""Class.forName("com.mysql.jdbc.Driver"); "", what type of Driver...
6
by: dav3 | last post by:
HI again folks. I spent my weekend coding a function to do statistical analysis on a time series and to my amazement it works without a hitch. I even verified my results were correct with excel. I...
9
by: Peter Duniho | last post by:
Is there a straightfoward API in .NET that allows for inspection of a database? That is, to look at the structure of the database, without knowing anything in advance about it? For example,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.