help !!!

meena's Avatar, Join Date: Jul 2004
Light Poster
hi,

i want to use database - access in my java pgm.
first of all , i dunno wheter jdbc driver is installed in my sys
or not. how to check it. if not, how to install it.

then, vot r the lines of code in java in order to access my
database (ms-access).

plz, itz very urgent. plz mail me asap

bye,
meena
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Quote:
first of all , i dunno wheter jdbc driver is installed in my sys or not. how to check it. if not, how to install it.
Try executing this code. If it runs successfully you have JDBC installed if not you need to get it for Access. Let me know if it runs.

Code:
  Query = "Some Valid SQL";
  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  String sourceURL = "jdbc:odbc:Dictionary";
  Connection databaseConnection = DriverManager.getConnection(sourceURL);
  Statement stmt = databaseConnection.createStatement();
  stmt.executeUpdate(Query);
Also you can see the Database drivers at
http://www.idssoftware.com/download.html#ODBC

Thanks
Shabbir Bhimani
Amit Ray's Avatar, Join Date: Jul 2004
Contributor
For most database systems, you can simply download a JDBC driver to connect to the Db with Java, but there aren't any free ones for Access. What you can do is create an ODBC datasource (with Windows), and use the JDBC-ODBC bridge to connect to that. I think the JDBC-ODBC bridge is included with the JDK package. Good luck!

You can create an access datasource in Win2k as follows: Start->Control panel->Administrative tools->Data Sources(ODBC)->MS Access Database->System DSN->Add->Select MS Access Database Driver ->Finish->Enter datasource name->Select Database->Click ok

Cheers,
Amit.
meena's Avatar, Join Date: Jul 2004
Light Poster
hi

thanx very much. itz workin. (the code)

bye
Amit Ray's Avatar, Join Date: Jul 2004
Contributor
gr8 ... just drop a line if you need further help ...

Cheers,
Amit Ray.
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Quote:
thanx very much. itz workin. (the code)
Looks nice when something like this comes up

ALso if you need any further help just drop a query.

Thanks
Shabbir Bhimani