aspose file tools*
The moose likes JDBC and the fly likes How can I access database files with out DSN? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How can I access database files with out DSN?" Watch "How can I access database files with out DSN?" New topic
Author

How can I access database files with out DSN?

jiayu gao
Greenhorn

Joined: Jul 16, 2003
Posts: 9
I want to access database file,for example MS ACCESS(.mdb).But the file was supply by the user.Maybe he/she didn't register the DSN for it.How can I implement it?
Thanks.
[ July 19, 2003: Message edited by: jiayu gao ]
Andri G
Greenhorn

Joined: Jul 21, 2003
Posts: 2
as far as I know, you can't.
The DSN alias is for an ODBC alias, that when you're using JDBC-ODBC bridge it will refer to the alias.
Arnold Kesselaar
Greenhorn

Joined: Feb 28, 2003
Posts: 14
HI Guys,
I have a somewhat simmilar problem. I want to write a program that has its own little database that it can access when it wishes. I do not know the operating system of the user. The user shouldn't have to register drivers or anything. How can I do this?
jiayu gao
Greenhorn

Joined: Jul 16, 2003
Posts: 9
Thanks.
Does anybody know <crystal report>?
It can open so many kinds of database files with out DSN.How does it implement?
And I don't have to use JDBC/JDBC-ODBC.
Is there any other mothed?
[ July 21, 2003: Message edited by: jiayu gao ]
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Originally posted by Arnold Kesselaar:
HI Guys,
I have a somewhat simmilar problem. I want to write a program that has its own little database that it can access when it wishes. I do not know the operating system of the user. The user shouldn't have to register drivers or anything. How can I do this?

Try HSQLDB


Spritle Software Blogs
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Originally posted by jiayu gao:
I want to access database file,for example MS ACCESS(.mdb).But the file was supply by the user.Maybe he/she didn't register the DSN for it.How can I implement it?
Thanks.
[ July 19, 2003: Message edited by: jiayu gao ]

A way around!..
if you know where the user will be storing the MDB files then you can try the below(no dsn needed)

but you have to be very careful on setting the filename as it may lean to file not foind exception
jiayu gao
Greenhorn

Joined: Jul 16, 2003
Posts: 9
Thank you very much,Balaji Loganathan.
I have put the database file "world20.mdb" and the .java file in the same directory.
And finally,I got the String database:
jdbc.odbc.driver={Microsoft Access Driver (*.mdb)};DBQ=world20.mdb;DriverID=22;READONLY=true}
Is it right?
But it said that "SQL Error: java.sql.SQLException: No suitable driver 0 08001".
Is there anything that I should pay attention?
And are there some documents for this technology?I want to know the details.
Thanks a lot.
[ July 21, 2003: Message edited by: jiayu gao ]
Marcus Howarth
Ranch Hand

Joined: Jan 04, 2002
Posts: 37

And finally,I got the String database:
jdbc.odbc.driver={Microsoft Access Driver (*.mdb)};DBQ=world20.mdb;DriverID=22;READONLY=true}
Is it right?

those smilies are getting in the way I think
try:
jdbcdbc:driver
in the database String (with colons)


Marcus<br /> <br />SCJP, March '02
jiayu gao
Greenhorn

Joined: Jul 16, 2003
Posts: 9
Oh,what a fool fault!
I've got it. Thanks,Marcus Howarth.
And how about other kinds of database file?
Are they similar?
OR is this a property of MS Access?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can I access database files with out DSN?