File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Basic Doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Basic Doubt" Watch "Basic Doubt" New topic
Author

Basic Doubt

prakash muthu
Ranch Hand

Joined: Sep 06, 2000
Posts: 75
Hi
I have a MDB file (Access Database). Can i run the JDBC program, with out Access software in my PC? what are the settings i suppose to do in my PC?
Let me know if i'm unclear.
TIA
with regards
Prakash.M
(prakashem@rediffmail.com)


Prakash.M<BR>Bangalore- India<BR>(prakashem@rediffmail.com)
Apu Nahasapeemapetilon
Ranch Hand

Joined: Sep 06, 2000
Posts: 51
You should be able to access the MDB through the ODBC driver (as long as the Access DB is registered as an ODBC data source). Performance may be better if there exists an Access driver.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
if you need example code.
please review this form...
i have added sample code for oracle and ms-access over the past month.
if you can not find sample code.
please reply or send me an email.
i will be happy to post them again.
monty6
prakash muthu
Ranch Hand

Joined: Sep 06, 2000
Posts: 75
Hi monty6,
Please let me know the code. Why don't mention your mail id while replying.
with regards
Prakash.M
(prakashem@rediffmail.com)
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
As for my email address. I use may computers to access the net.
Each computer uses a different way to access the net.
Becaues of this. I try to keep my email addres private to avoid
junk mail.
Thanks for pointing this out to me. I will include my signature in future posts. Now for the good stuff!
Sample java jdbc code was obtain at Sun's web sight. www.java.sun.com.products.jdbc.book.html
The code that follows. Is one of there sample programs that has
been modified to access a ms-access 2.0 database. So you will have to do the ODBC setup yourself. The ms-access data source name I use is accessDB.
<code>
import java.sql.*;
public class CreateCoffees {
public static void main(String args[]) {
String url = "jdbcdbc:accessDB";
Connection con;
String createString;
createString = "create table COFFEES " +
"(COF_NAME varchar(32), " +
"SUP_ID int, " +
"PRICE float, " +
"SALES int, " +
"TOTAL int)";
Statement stmt;

try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}

try {
con = DriverManager.getConnection(url, "", "" );

stmt = con.createStatement();
stmt.executeUpdate(createString);
stmt.close();
con.close();
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
}
}
</code>
Good-Luck...
Hope This Helps
Monty6

------------------
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Basic Doubt