Dear all,

I am making MS Access database connection with my java program.
As i know that in Connection Following things are required:

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con  = DriverManager.getConnection("jdbc:odbc:DSNname","Username","password");

Now i have created System DSN in Odbc data connection and also i have attached database with that DSN.
While creating DSN, i also provide username and password in configuration.

but now my problem is,Even if i am not passing username and password in getConnection() method, it will insert data into database.

So where's the problem?
How can i put username and password, so that without it my data should not be inserted in my database.
i am using MS-Access database right now.

please reply as soon as possible.

Thanks.

Recommended Answers

All 4 Replies

if it updates no matter what pass/user you provide, my guess: you did something wrong during the configuration.

yes my database is updated every time i run the program,but wihtout username & password it will update data.

Is it compulsory to pass username and password in getConnection() method?Even if we have given username and password in configuration at creation of System DSN.

My guess is that if your Access file is not password protected the username and password make no difference.

Thanks

Mean is it compulsory to make access file password protected?

can't i make database refuse request on entering wrong password i had set for ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.