Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Java (http://www.go4expert.com/forums/java/)
-   -   help !!! (http://www.go4expert.com/forums/help-t172/)

meena 19Sep2004 07:45

help !!!
 
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 19Sep2004 09:20

Re: help !!!
 
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 19Sep2004 13:54

Re: help !!!
 
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 19Sep2004 21:51

Re: help !!!
 
hi

thanx very much. itz workin. (the code)

bye

Amit Ray 19Sep2004 23:07

Re: help !!!
 
gr8 ... just drop a line if you need further help ...

Cheers,
Amit Ray. :)

shabbir 20Sep2004 07:36

Re: help !!!
 
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


All times are GMT +5.5. The time now is 22:34.