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?