Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / March 2005

Tip: Looking for answers? Try searching our database.

ACCESS 2000 login from a Java Application

Thread view: 
straybullet - 03 Mar 2005 10:34 GMT
I have set up a userID and password on the ACCESS database, which if I
click on the MDB file works fine.

However, I can still connect and use the database from a Java
Application without any password or userID set in the code

eg

driverName = props.getProperty("driverName");
        dbUrl = props.getProperty("dbUrl");
        userId = props.getProperty("");
        passWord = props.getProperty("");

        try{

            // load the driver
            Class.forName(driverName);

            // get the connection
            musicConn = DriverManager.getConnection( dbUrl, userId, passWord);

etc etc...

Can anyone tell me what else I need to do to force the Java
application conform to the restrictions that I have set on the DB.
Axel.Hallez - 04 Mar 2005 11:01 GMT
I guess you will have to put the username and password in the url, so
they are handled by the ODBC driver instead of the JDBC driver.

Axel Hallez

> I have set up a userID and password on the ACCESS database, which if I
> click on the MDB file works fine.
[quoted text clipped - 21 lines]
> Can anyone tell me what else I need to do to force the Java
> application conform to the restrictions that I have set on the DB.
straybullet - 04 Mar 2005 12:25 GMT
Thanks for tip but can you be a little more elaborate

I assume you are meaning something like

String dbUrl = " jdbc:odbc:Media;userid='myUID';password='myPW' ";
but what is the correct syntax. Cannot find an example.

I have tried the above. It does not produce a syntax error but I can
still connect even though the name and password are wrong?
Axel.Hallez - 04 Mar 2005 12:59 GMT
Here's a site with examples:
http://www.able-consulting.com/MDAC/ADO/Connection/ODBC_DSNLess.htm#ODBCDriverFo
rAccess


Of course you have to add jdbc:odbc: in order to use them with jdbc.

Axel Hallez

> Thanks for tip but can you be a little more elaborate
>
[quoted text clipped - 5 lines]
> I have tried the above. It does not produce a syntax error but I can
> still connect even though the name and password are wrong?


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.