jdbc front end

jdbc front end

a code written using JDBC,ODBC,SQL and swing only that allows the user to select the required driver related to a specific database that can execute the SQL queries related to that database.
View Answers

June 10, 2010 at 1:10 PM

Hi Friend,

Try the following code:

import java.awt.*;
import java.sql.*;
import javax.swing.*;
import java.awt.event.*;

class FormDemo extends JFrame {
JButton ADD;
JPanel panel;
JFrame f;

FormDemo(){
JLabel label1,label2;
final JTextField text1,text2;
label1 = new JLabel();
label1.setText("Name:");
text1 = new JTextField(20);

label2 = new JLabel();
label2.setText("Address:");
text2 = new JTextField(20);

ADD=new JButton("Insert");
ADD.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
String v1=text1.getText();
String v2=text2.getText();
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection connect =DriverManager.getConnection("jdbc:odbc:access","","");
Statement st=connect.createStatement();
int i=st.executeUpdate("insert into data(name,address) values('"+v1+"','"+v2+"')");
JOptionPane.showMessageDialog(null,"Inserted Successfully");
}
catch(Exception ex){
JOptionPane.showMessageDialog(null,"Error");
}

}
});
f=new JFrame();
panel=new JPanel(new GridLayout(3,2));
panel.add(label1);
panel.add(text1);
panel.add(label2);
panel.add(text2);
panel.add(ADD);
f.add(panel,BorderLayout.CENTER);
f.setTitle("FORM");
f.setVisible(true);
f.pack();
}
public static void main(String[]args){
FormDemo ff=new FormDemo();
}
}

If you haven't created DSN connection then follw these steps:

1. Open Data Sources (Start->Control Panel->Administrative

Tool->Data Sources(ODBC)

2. Open User DSN tab
3. Add a user DSN
4. Select Microsoft Access Driver(*.mdb)
5. Select database name and Create the DSN name (e.g emp)
6. Click "Ok" and then restart your compiler.

Thanks









Related Tutorials/Questions & Answers:
jdbc front end - JDBC
jdbc front end  a code written using JDBC,ODBC,SQL and swing only that allows the user to select the required driver related to a specific database..."); Connection connect =DriverManager.getConnection("jdbc:odbc:access","",""); Statement st
CONNECT TO FRONT END - Hibernate
CONNECT TO FRONT END  HI HOW TO COONECT HIBERNET WITH STRUCT FRONT eND. PLEASE PROVIDE CODE AS SOON AS POSSIBLE. REGARDS DILEEP  Hi Friend, Please visit the following link: http://www.roseindia.net/struts
Advertisements
front-end validation based on the xml in validation.xml.
front-end validation based on the xml in validation.xml.  How you will enable front-end validation based on the xml in validation.xml
ModuleNotFoundError: No module named 'django-front-end-validators'
ModuleNotFoundError: No module named 'django-front-end-validators'  ...: No module named 'django-front-end-validators' How to remove the ModuleNotFoundError: No module named 'django-front-end-validators' error? Thanks
ModuleNotFoundError: No module named 'spinnaker_graph_front_end'
ModuleNotFoundError: No module named 'spinnaker_graph_front_end'  Hi...: No module named 'spinnaker_graph_front_end' How to remove the ModuleNotFoundError: No module named 'spinnaker_graph_front_end' error? Thanks  
ModuleNotFoundError: No module named 'spinnaker_graph_front_end'
ModuleNotFoundError: No module named 'spinnaker_graph_front_end'  Hi...: No module named 'spinnaker_graph_front_end' How to remove the ModuleNotFoundError: No module named 'spinnaker_graph_front_end' error? Thanks  
ModuleNotFoundError: No module named 'spynnaker_graph_front_end'
ModuleNotFoundError: No module named 'spynnaker_graph_front_end'  Hi...: No module named 'spynnaker_graph_front_end' How to remove the ModuleNotFoundError: No module named 'spynnaker_graph_front_end' error? Thanks  
ModuleNotFoundError: No module named 'django-front-end-validators'
ModuleNotFoundError: No module named 'django-front-end-validators'  ...: No module named 'django-front-end-validators' How to remove the ModuleNotFoundError: No module named 'django-front-end-validators' error? Thanks
How we delete a data of database from front end jsp page
How we delete a data of database from front end jsp page   I make a website and featch a data from data base and now i want that a delete button put in front of a featched data and when i clicked on this button then the data
extract data fom table when a button is clicked in front end page using mysql5.0 and tomcat6.0
extract data fom table when a button is clicked in front end page using... is stored in mysql5.0 databse, when a button is clicked in front end page using...://www.roseindia.net/jdbc/display-data-database.shtml Thanks
not picking request parameters from the front end - JSP-Servlet
you have enter in front end). but i am getting response as welcome to unicel...not picking request parameters from the front end  hi, This is venkatramana. I am writing one small basic program. I am not getting proper output
JDBC access database
and interfaces for connecting the front end in Java application with database connections... connect the front end of the Java application to the backend database. In case... JDBC access database       JDBC
JDBC batch
to interact your Java Application in your front end with the backend... as an argument. Driver Connection provides you to connect  the front end in java... JDBC batch       JDBC is simply a Java
How to get the data from the database (Oracle) in console or in ie using servlet or jsp as Front end
How to get the data from the database (Oracle) in console or in ie using servlet or jsp as Front end  hello i have a simple problem in jsp...("sun.jdbc.odbc.JdbcOdbcDriver"); con=DrivergetConnection("jdbc:odbc:DNSName","scott
i have developed the application in jsp(front-end -jsp,business logic-jsp).it is very slow when accessing the page - JSP-Servlet
i have developed the application in jsp(front-end -jsp,business logic-jsp).it is very slow when accessing the page  i have developed the application in jsp only.i did not use any classes.application is very slow when access
How Insert DateTime Vales into Mysql Databse from the front end application.But User Gives Date only from Datepicker,not Time
How Insert DateTime Vales into Mysql Databse from the front end application.But User Gives Date only from Datepicker,not Time  I am new developer in .net,I Have requirement..like this ,when user pick date from date picker
How Insert DateTime Vales into Mysql Databse from the front end application.But User Gives Date only from Datepicker,not Time
How Insert DateTime Vales into Mysql Databse from the front end application.But User Gives Date only from Datepicker,not Time  I am new developer in .net,I Have requirement..like this ,when user pick date from date picker
jdbc
is to reduce the network calls between the front end application and its database rather...jdbc define batch updates  define batch updates?exp   JDBC... links: http://www.roseindia.net/jdbc/Jdbc-batch-update.shtml http
front controller - JSP-Servlet
front controller  How to implement front controller in a web application
MySQL Front
with the MySQL database. Here is the list of MySQL Front end tools: What...    MySQL-Front is a front-end interface for the popular MySQL...-datasources.    Introducing SQLyog and a MySQL Front End
endif to end the conditional statement.
endif to end the conditional statement.  When are you supposed to use endif to end the conditional statement
ModuleNotFoundError: No module named 'end'
ModuleNotFoundError: No module named 'end'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'end' How to remove the ModuleNotFoundError: No module named 'end' error
ModuleNotFoundError: No module named 'end'
ModuleNotFoundError: No module named 'end'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'end' How to remove the ModuleNotFoundError: No module named 'end' error
jdbc - JDBC
jdbc  How can i store images in a database column without a front end...: http://www.roseindia.net/jdbc/save_image.shtml Retrieve Image using Java... = DriverManager.getConnection( "jdbc:mysql://localhost:3306/test", "root", "root
Remove Extra Space At End
Remove Extra Space At End  Remove Extra Space At End
jdbc,odbc,MySQL,swing - Java Beginners
to the selected database driver.It is very well known as jdbc front end of a database...jdbc,odbc,MySQL,swing  write a code that displays a menu list of all available database drivers in a window,and allows the user to select any driver
ModuleNotFoundError: No module named 'scheduler-front'
ModuleNotFoundError: No module named 'scheduler-front'  Hi, My... named 'scheduler-front' How to remove the ModuleNotFoundError: No module named 'scheduler-front' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'py-front'
ModuleNotFoundError: No module named 'py-front'  Hi, My Python...-front' How to remove the ModuleNotFoundError: No module named 'py-front... to install padas library. You can install py-front python with following
ModuleNotFoundError: No module named 'queue-front'
ModuleNotFoundError: No module named 'queue-front'  Hi, My Python... 'queue-front' How to remove the ModuleNotFoundError: No module named 'queue-front' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'django-front'
ModuleNotFoundError: No module named 'django-front'  Hi, My Python... 'django-front' How to remove the ModuleNotFoundError: No module named 'django-front' error? Thanks   Hi, In your python
Version of com.generallycloud>baseio-front dependency
List of Version of com.generallycloud>baseio-front dependency
Should I use Protractor or Karma for my end-to-end testing?
Should I use Protractor or Karma for my end-to-end testing?  Hi, What should I use for end-to-end testing of AngularJs application? Should I use Protractor or Karma for my end-to-end testing? Thanks   Hi, Jasmine
ModuleNotFoundError: No module named 'linkkt-end'
ModuleNotFoundError: No module named 'linkkt-end'  Hi, My Python... 'linkkt-end' How to remove the ModuleNotFoundError: No module named 'linkkt-end' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'when-will-it-end'
ModuleNotFoundError: No module named 'when-will-it-end'  Hi, My... named 'when-will-it-end' How to remove the ModuleNotFoundError: No module named 'when-will-it-end' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'coda-to-end'
ModuleNotFoundError: No module named 'coda-to-end'  Hi, My Python... 'coda-to-end' How to remove the ModuleNotFoundError: No module named 'coda-to-end' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'coda-to-end'
ModuleNotFoundError: No module named 'coda-to-end'  Hi, My Python... 'coda-to-end' How to remove the ModuleNotFoundError: No module named 'coda-to-end' error? Thanks   Hi, In your python environment
JDBC
JDBC  why we use batch in jdbc
jdbc
jdbc  Hai , Give a steps for jdbc connectivity
jdbc
jdbc  display the records using index in jdbc
how to write to file at the end of the line
how to write to file at the end of the line  Hi, Where do i learn how to write to file at the end of the line using Java program. Plz suggest... will help you for "How to write the file at the end of line using Java language
Help on JSP - JDBC
Help on JSP  Sir I am makeing a project name Online reservation and Enquiry system. I had completed the front end design with the help of html,delete...;jdbc:oracle:thin@localhost:1521:xe","scot","tiger"
JDBC
JDBC  How to add set of queries in a single query in JDBC
project - JDBC
project  code for front-end of any JDBC compatible database  Hi Friend, Try the following code: 1)register.jsp: Registration Form First Name: Last Name: User Name: Password: Address
jdbc
jdbc  please tell me sir.i dont know JDBC connection and how to create table in database
jdbc
jdbc   how to write program to save data and retrieve data from the form in Java
jdbc
jdbc  why do we need to load jdbc drivers before connecting to database
JDBC
JDBC  how to set classpath for eclipse, java, where to copy jdbc connector
JDBC
JDBC  in class.forname which driver name we are writing for the connection from jdbc to sqlserver 2008
jdbc
jdbc  is it possible to use doget & dopost method with jdbc to call in a servlet programe
Jdbc
Jdbc  A java program with jdbc connectivity with insert,delete,update options for name,regno,mark1,mark2,total

Ads