So how do you do this step by step? Say that i've made a database and saved it. Now what do i do? I know there are some lines of code to actually open the database in a java application yet are there more steps i have to go through before i can even open it? I tried using some code i got from a site yet had no luck. So step by step what do I do? 1, I saved the databade Whats next? Some code would be helfull too =] Thx alot.
posted 12 years ago
Hi! Kevin..... here is ur step by step procedure to connect to an access DB... 1.) Create a system DSN for ur DataBase(*.mdb file) to learn how to do this u can go thru this WebSite: http://www.webwizguide.info/asp/tutorials/setting_up_dsn.asp 2.) In ur java code load the jdbc-odbc bridge driver in the following manner: Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); 3.) Create a connection using : String url = "jdbc dbc:Ajay"; Connection con = DriverManager.getConnection(url,"myLogin", "myPassword"); where Ajay is ur system DSN name.and if u don't have any passord or login then ur connection variables wud be like this: String url = "jdbc dbc:Ajay"; Connection con = DriverManager.getConnection(url,"", ""); 4.) Next is creating statement objects and resultset objects......For complete info on this u can read the following tutorial.. http://www.interex.org/pubcontent/enterprise/jan00/14chew.html 5.) u can have look at this sample code : Hope all this helps u solve ur problem.