Step by step guide:
1.Create a database in ms access and add a table
2.Add columns to the table.
3.Go to control panel->Administrative Tools
->JDBC-> System DSN
4.In System DSN tab click on add ,choose
Microsoft access driver ,then you will get a
dialog box opened ODBC Microsoft access setup
mention the data source name in it and in
databases click on select button and choose
your .mdb file that is created in step1.
5.Register the driver using
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
6.Connect to the database
Connection con = DriverManager.getConnection
(URL,userid,password);
url=” Jdbc:Odbc:”
userid and password are empty in case of MS access.if it oracle default userid is “scott” password is “tiger”.
Ex: Connection con = DriverManager.getConnection
( "Jdbc:Odbc:msac", "","");
Source Code
import java.sql.*;
import java.io.*;
class JdbcDemo1
{
Connection con;
Statement stmt;
ResultSet rs;
JdbcDemo1(){
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection( "Jdbc:Odbc:msac", "","");
stmt = con.createStatement();
rs = stmt.executeQuery("SELECT * FROM Table1");
while (rs.next()) {
String x = rs.getString("name");
int s = rs.getInt("age");
System.out.println("x:"+x+"s"+s);
}
}catch(SQLException e){
System.out.println("Hello World!"+e);
}catch(ClassNotFoundException e){
System.out.println("purni"+e);
}
}
}
class JdbcDemo
{
public static void main(String args[]){
new JdbcDemo1();
}
}
Related Articles
How Long Should You Keep Marketing Prospects In The Data Base?
By: Mac H McIntosh | 05/06/2008 | Marketing
So, how long should a smart marketer keep their contacts in the data base? Many marketers remove people and records from the data base too soon, especially when considering the overall potential lifetime value of both the prospect and the company they represent.
Consider this: even if a single customer only...
Aghreni Technologies Educational Services - Trainings on Open Source Technologies ( Perl, Php, Java, Ruby, Linux, Mysql)
By: aghreni | 04/11/2008 | Training
Aghreni offers skill enhancement programs in all its technology capability areas for:
Fresh students (finishing school model) and
Experienced professionals (Corporate training model)
Using Your it to Excel in Tough Times
By: Robin George | 24/09/2008 | Databases
Find out how to beat the current difficult financial climate, using the software on your computer.
Why Ebooks are Promotional Powerhouses
By: Karen Martin | 29/09/2005 | EBooks
Ebooks are part of the new frontier of cyberspace. They are an entirely new medium for sharing marketing information, ideas, techniques, and expert knowledge. Each day the number of people accessing the Internet grows, c...
Comprehensive Web Design Checklist
By: Michael Cordova | 19/11/2006 | Communication
Your Web site needs to do more than make your company look good. It has to support your overall business operations – customer service, sales and marketing and collaboration.
Phipe: Automatic Dialer for Skype
By: Alfred Anderson | 14/09/2007 | VoIP
Phipe is easy to use automatic dialer for Skype that can make the call processes of an organization a lot faster and simpler.
Automatic Dialer – Taking Telecalling to the Next Level!
By: Simon Churchgate | 26/11/2007 | VoIP
Automate your dialing procedure and head for a richer Skype experience with an automatic dialer. Internet telephony was never so convenient.
Website Design Reflects Your Organisation
By: Angela Rogers | 23/04/2008 | Graphic Design
Website design is a true reflection of any organisation. When you surf through different websites in a day, what makes you stick to a website, is it the flashy or jazzy part?, is it the simplicity through which you are able to reach to the desired information without getting confused or lost?, is it because it loads quickly and you do not have to wait for long, which saves your time?
Got a Question? Ask.
Ask the community a question about this article:
Frequently Asked Questions
Do laptops have built-in surge suppressors in ...
By: drabsv | 01-11-2008
Do laptops have built-in surge suppressors in their charging devices?
Defrag Programs
By: kody | 01-11-2008
Does anyone know anything about Iobit Smart Defrag? I have heard that the windows vista defrag causes long term issues with some ppl's hard drive. I have used Iobit Advanced Windows care and it seems good, however im not too sure about the smart defrag program. Any comments greatly appreciated! Also let me kno of any other good free defrag programs. tnks!
Permanently deleting photos on Sony digital camera (cyber shot)
By: Veronica Zinkham | 31-10-2008
Can you list the steps to permanently delete photos on a Sony digital camera (cyber shot)?
I want to upgrade a hp 743c
By: chryssa | 31-10-2008
what processor to buy for hp 743c
Acer x221w were can i buy one
By: Lost something | 30-10-2008
acer x221w were can i buy one
Superbluetooth Us Cellular
By: Le0nel | 30-10-2008
is there any way that I can install superbluetooth in my LG Glimmer from US Cellular?
Q&A Powered by:
Latest Programming Articles
Cool Desktop Wallpapers
By: Danny | 18/11/2008
Cool desktop wallpaper is accomplishments arrangement that displayed in the computer operating system. The wallpapers usually be acclimated in JPEG, BMP and GIF book formats. That wallpaper can be acclimated with Microsoft Windows, Linux and Macintosh Mac OS. Each adviser can be altered requirements, alike admitting wallpaper images advised for accepted monitors can be scaled up or bottomward to the fit size. Those are accessible on the internet for free. Some categories of wallpapers are a
Tips for Buying Software Online
By: Daniel Jowssey | 17/11/2008
Buying software online not only helps save the planet, it also has other benefits, including:
* Ease and Simplicity. You can purchase software in your underwear at 4am if you really want to. Shopping online doesn’t have to be done within regular business hours, nor do you need to look your best to do it. It’s also easy to shop around for the best prices and takes less time than driving to the shops.
Mvc Design Pattern
By: TuVinhSoft .,JSC | 14/11/2008
Model-view-controller (MVC) is an architectural pattern used in software engineering. In complex computer applications that present a large amount of data to the user, a developer often wishes to separate data (model) and user interface (View) concerns, so that changes to the user interface will not affect data handling, and that the data can be reorganized without changing the user interface.
Advantages of Low Cost Contract Programmers in Freelance Programming
By: Joanna Gadel | 12/11/2008
It observed that web industry is getting tougher thus the necessity of freelance contract programmer is required for developing more effective website with flexible features. This article states the fruitful advantages of freelance programmers in contract programming.
A Guide to Cnc Kits
By: Martin Applebaum | 09/11/2008
CNC kits are a way in which to construct your CNC machine. This article will provide some information on these machines.
A Guide to Cnc Tube Bending Machines
By: Martin Applebaum | 08/11/2008
Are you familiar with a CNC tube bending machine? This article will shed some light on the main function and components of this machine.
Ways to Hire Dedicated Php Programmers
By: Jucick | 08/11/2008
It’s not at all easy to hire dedicated PHP programmers unless you know where and how to find them. Whether you need to fix, update or enhance your website you naturally want the job done quick and right.
Top 4 Reasons Why Addressing Web Accessibility is Important
By: Matt Cave | 05/11/2008
There are very high chances that web accessibility is more important to the performance of your web site than you realize. Article takes a look at the top 4 reasons why it would be important to address the issue of web accessibility.