Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JDBC Accessing Ms access data in JAVA GUI Envi.

Have Programming Question? Ask it here!
 
 
 


Shashi Bhusan Pandit
Accessing Ms access data in JAVA GUI Envi.
1 Answer(s)      2 years ago
Posted in : JDBC


Q.How to insert data into ms access data in java using swing ? Q.How to slove (access denided ("java.lang.RuntimePermission" "accessClassInPackage.sun.jdbc.odbc")" these exception ?


Advertisement
View Answers

August 28, 2012 at 1:05 PM


Here is an example that connect MS Access database with java swing. But first of all you need to set the connection.

Follow these steps:

1)Go to the start->Control Panel->Administrative Tools-> data sources.

2)Click Add button and select the driver Microsoft Access Driver(*.mdb).

3)After selecting the driver, click finish button.

4)Then give Data Source Name and click ok button.

5)Your DSN will get created.

6) Restart your compiler and compile your java code.

import java.sql.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class  InsertData{
    public static void main(String[] args){
        JFrame f=new JFrame();
        f.setLayout(null);
        JLabel lab1=new JLabel("Name : ");
        JLabel lab2=new JLabel("Address: ");

        final JTextField text=new JTextField(20);
        final JTextArea area=new JTextArea(5,20);
        JScrollPane pane=new JScrollPane(area);
        JButton b=new JButton();

        lab1.setBounds(10,10,100,20);
        text.setBounds(120,10,150,20);

        lab2.setBounds(10,40,100,20);
        area.setBounds(120,40,150,60);

        b.setBounds(120,110,100,20);
        b.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent e){
                String st1=text.getText();
                String st2=area.getText();
             try{
             Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
             Connection con = DriverManager.getConnection("jdbc:odbc:roseindia");
             PreparedStatement pstmt = conn.prepareStatement("insert into data(name,address) values(?,?)");

             pstmt.setString(1, st1);
             pstmt.setString(2, st2 );
             pstmt.executeUpdate();

             JOptionPane.showMessageDialog(null,"Inserted Successfully!");
             }
             catch(Exception ex){}
            }
        });
        f.add(lab1);
        f.add(text);
        f.add(lab2);
        f.add(area);
        f.add(b);
        f.setVisible(true);
        f.setSize(350,200);
    }
}


Related Tutorials/Questions & Answers:
Accessing Ms access data in JAVA GUI Envi.
Accessing Ms access data in JAVA GUI Envi.  Q.How to insert data into ms access data in java using swing ? Q.How to slove (access denided ("java.lang.RuntimePermission" "accessClassInPackage.sun.jdbc.odbc")" these exception
accessing ms access through jsp
accessing ms access through jsp  i have 3 tables in my database employee,project,task if i put employee id the search field .i should get details from other table what all queries should i use in servlet file and i am using
Advertisements
Accessing MS ACCESS databse using a HTML webpage [created using Javascript]
Accessing MS ACCESS databse using a HTML webpage [created using Javascript]  HI team, This is Srinivas, and I have a query and i explained here... I have to save some datas in an MS ACCESS database file [*.mdb], after
cannot insert data into ms access database - Java Server Faces Questions
cannot insert data into ms access database   go back... connection: 1. Open Data Sources (Start->Control Panel->Administrative Tool->Data Sources(ODBC) 2. Open User DSN tab 3. Add a user DSN 4. Select
java &ms access - JDBC
java &ms access  Seasons Greetings, Am, creating an application for a food festival using Java swing as front end and MS access as Backend... ve managed to populate the JComboBox using MS Access. The problem is only 8 per
how to access the MS ACCESS database with java
how to access the MS ACCESS database with java   how to access the MS ACCESS database with java how can we insert,delete,update,search records of ms access with java   Java MS Access database connectivity Follow
How To Insert A New Record to MS Access table database in GUI
How To Insert A New Record to MS Access table database in GUI  Hello, I've been working on the actionPerformed part of my java application that involves inserting a record into a 6-column table in my MS Access database table. I'm
MS Access connct using flex with java
MS Access connct using flex with java  Hi All, Can anybody help me how to connect to the MS access database and getting the data using flex in java technology with tomcat server
ms access
ms access  how to delete the autonumber from ms access using java delete code
how to access the MS ACCESS database with java - Java Beginners
how to access the MS ACCESS database with java  how can we insert,delete,update,search records of ms access with java
How to Validate JRadioButton and How to Save data from JRadioButton to MS Access Database - Java Beginners
How to Validate JRadioButton and How to Save data from JRadioButton to MS Access Database  Hello Sir I want Store Corse Type that contains Two JRadioButton I want Store Information from JRadioButton to MS Access Database, and I
Ms Access
Ms Access   How to get query for Primary key from MsAccess?  ... = 'data';   SELECT column_name FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE table_name = 'data'; In the above query, data is our table name
MS-Access
MS-Access  I am trying to upload a image to ms-acess using jsp,and my...: [Microsoft][ODBC Microsoft Access Driver]COUNT field incorrect ".I think i set... the data type as OLE Object. Is there any suggestion? my code was.. <%@page
MS access
MS access  how do i access my Ms-Access file placed in the same jar file where my application code/class file r present??? Want to access it via Code. Can anyone help me ? Please give reply urgent...   give me reply
ms access
has to login . i already created ms access page and inserted values throught... and password" from my ms access............and detail in register(table in my ms... and password " he has to login . i already created ms access page and inserted values
ms access
has to login . i already created ms access page and inserted values throught... and password" from my ms access............and detail in register(table in my ms... and password " he has to login . i already created ms access page and inserted values
ms access
has to login . i already created ms access page and inserted values throught... and password" from my ms access............and detail in register(table in my ms... and password " he has to login . i already created ms access page and inserted values
ms access
has to login . i already created ms access page and inserted values throught... and password" from my ms access............and detail in register(table in my ms... and password " he has to login . i already created ms access page and inserted values
MS ACCESS
MS ACCESS  i have done : Insert form data into MS database...-> data sources. 2)Click Add button and select the driver Microsoft Access...)Then give Data Source Name and click ok button. 5)Your DSN will get created. 6
MS ACCESS
MS ACCESS  i have done : Insert form data into MS database...-> data sources. 2)Click Add button and select the driver Microsoft Access...)Then give Data Source Name and click ok button. 5)Your DSN will get created. 6
MS ACCESS
MS ACCESS  i have done : Insert form data into MS database Follow...-> data sources. 2)Click Add button and select the driver Microsoft Access...)Then give Data Source Name and click ok button. 5)Your DSN will get created. 6
java to MS Access conectivity - Swing AWT
java to MS Access conectivity  give me source code to stored... database on the ACCESS.  Hi Friend, Follow these steps: 1. Open Data Sources (Start->Control Panel->Administrative Tool->Data Sources
Jdbc MS-Access question
Jdbc MS-Access question  How to delete records from the three table in MS-Access? They are in relationship with each other regarding to data field
Jdbc MS-Access question
Jdbc MS-Access question  How to delete records from the three table in MS-Access? They are in relationship with each other regarding to data field
excel to ms access
excel to ms access  hello sir i am developing a application which requires extracting data from excel sheet and place in the ms access database using java programming for example: in excel sheet i have 2 columns and more than
How to Access MS Access in jar.
How to Access MS Access in jar.  how do i access my Ms-Access file... to access it via Code or is their any alter-native?? Do i need any Driver to do this ... i m able to access a Ms-access via JDBC but cant find the file wen
Problem in accessing data from Database
Problem in accessing data from Database  hi..... i'm making a project on servlet and jsp with ms access 2007 at the backend. One field in my database is text and all others are of currency data type. If i enter 0 or null value
J2ME connectivity to ms access
J2ME connectivity to ms access  How to establish client server connectivity to access ms access database on the server side? I have made the odbc connection. Plz help me in the coding part.. Dont know how to start
MS Access` - IDE Questions
MS Access`  hello sir, how to configure MS Access database in Net Beans5.5... and i have a doubt, where should we run the below code...either in IDE or in any editor like EDITPLUS. waitin for your reply.... thank you
How to Open Picture From M.S. Access Database using Java Servlet ?
How to Open Picture From M.S. Access Database using Java Servlet ?  Hi all my Friends I have below code which insert a picture into M.S. Access Database But i m still not able to open this picture through Java using M.S. Access
MS Access - JDBC
information about MS access database...but still i am having doubt in that topic. My problem is : Is there any jar to connect MS Access and java ... because... to be remember 1.to configure the ms access database to your system control
How To Display MS Access Table into Swing JTable - Java Beginners
How To Display MS Access Table into Swing JTable  How to Display Records From MS Access Database To JTable. Plz Help Me  Hi Friend...) { Vector columnNames = new Vector(); Vector data = new Vector(); JPanel p=new
how to connect java with ms access using odbc in eclipse
how to connect java with ms access using odbc in eclipse  import java.sql.*; class AccessDatabase{ public static void main(String[] args... Access Driver (*.accdb)};DBQ=student.accdb","",""); Connection con
MS Access - WebSevices
MS Access  hello sir, i am trying to write a code which should take images from a particular folder and data from MSAccess..please help me..thank..." which have access database and for images we have created a field in the table
How to store JComboBox selected Item into Ms Access Database - Java Beginners
How to store JComboBox selected Item into Ms Access Database  How to store JComboBox selected Item into Ms Access Database.  Hi Friend...(); } public SwingFrame(){ JFrame f = new JFrame("Frame in Java Swing
MS ACCESS - JDBC
MS ACCESS  java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'origin='src' destination='dest''. THAT MY PROBLEM
MS Access` - JDBC
MS Access`  Hello Sir, Thank you very much for your valuable information. Actually i am doin a project to generate Hall tickets.So, I need to insert image into MS Access Database. Now the task is how to retrieve the image
How to create and Attach MS Access Reports and Crystal Reorts in Java. - Java Beginners
How to create and Attach MS Access Reports and Crystal Reorts in Java.  How to create and Attach MS Access Reports and Crystal Reorts in Java WITH MS Access 2007 Database, plz Help Me Sir
MS Access - JSP-Servlet
stepts 1.to configure the ms access database to your system control panel... in Connectivity in MS Access : import java.sql.*; public class...MS Access  hello sir, i want to use MS.Access as my database..so my
inserting picture in ms access
inserting picture in ms access  hi i am sanatan, how to insert picture in ms access by jsp.   <%@page import="java.sql.*,java.io.*"%> <% try{ InputStream sImage; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver
How To Display both image and data into Swing JTable which is retrieved from ms access database
How To Display both image and data into Swing JTable which is retrieved from ms access database  So far this is my code how can i display both image and data from database.. while (rs.next()) { Vector row = new Vector(columns
link hibernate to MS ACCESS database
link hibernate to MS ACCESS database  how to link hibernate to ms access database instead of sql database
Migrating from mysql to MS Access
Migrating from mysql to MS Access  Hi I am hoping for some help I need to write a conversion program (SQL statements) to import existing data in a MYSQL database to a MS Access database. any suggestions would be appreciated
Dialect for MS Access - Hibernate
Dialect for MS Access  Can someone tell the Dialect for MSAccess.I need it urgently Thanks in advance
Upload file to MS Access
Upload file to MS Access  Iam beginner and need to upload file to msaccess using jsp . Iam using netbeans platform. Kindly explain do I need to mention Attachment format in the table
how to store image file and videofile in ms access database using java? - JDBC
how to store image file and videofile in ms access database using java?  how to store image file and video file in ms access database using java
How to use JTable with MS-Access
.   Here is an example that retrieves the data from MS Access database... (MS-Access). 1. Name 2. City 3. Contact I want to Display... = DriverManager.getConnection("jdbc:odbc:access"); String sql = "Select * from data"; Statement
How to use JTable with MS-Access
.   Here is an example that retrieves the data from MS Access database... (MS-Access). 1. Name 2. City 3. Contact I want to Display... = DriverManager.getConnection("jdbc:odbc:access"); String sql = "Select * from data"; Statement
show null point Exception """ while trying 2 load a JComboBox"" data is fetch from database ms-access
show null point Exception """ while trying 2 load a JComboBox"" data is fetch from database ms-access  import javax.swing.*; import java.awt....,"connected to database"); stat=con.createStatement(); String ss="select name from data
show null point Exception """ while trying 2 load a JComboBox"" data is fetch from database ms-access
show null point Exception """ while trying 2 load a JComboBox"" data is fetch from database ms-access  import javax.swing.*; import java.awt....,"connected to database"); stat=con.createStatement(); String ss="select name from data
 

 

 

DMCA.com