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



Home Answers Viewqa JDBC jdbc front end
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


maria
jdbc front end
1 Answer(s)      4 years and 4 months ago
Posted in : JDBC


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.

Advertisement
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
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
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
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
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
JDBC access database
JDBC access database       JDBC is a Java Database Connectivity. The JDBC Connectivity provides API classes and interfaces for connecting the front end in Java application with database connections
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 batch
to interact your Java Application in your front end with the backend... Connection provides you to connect  the front end in java application... JDBC batch       JDBC is simply a Java
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
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 Page Web Hosting
Front Page Web Hosting Microsoft Front Page is leading WYSIWYG editor for the development of web site using HTML and DHTML. Front Page is used... providers provides Front Page Support on their web servers. Front Page extensions
endif to end the conditional statement.
endif to end the conditional statement.  When are you supposed to use endif to end the conditional statement
Remove Extra Space At End
Remove Extra Space At End  Remove Extra Space At End
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
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
Problem with appending data to the end of file
Problem with appending data to the end of file  MY JSP CODE WITH THE JAVA CLASS: JSP CODE: <html> <body> <%@ page language="java" import="java.io.*,data.*" %> <% String name=request.getParameter("name
jdbc
jdbc  Hai , Give a steps for jdbc connectivity
jdbc
jdbc  display the records using index in jdbc
JDBC
JDBC  why we use batch in jdbc
JDBC
JDBC  How to add set of queries in a single query in JDBC
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
JDBC
JDBC  can u send me the code of jdbc how to join two tables that are in relation
Jdbc
Jdbc  A java program with jdbc connectivity with insert,delete,update options for name,regno,mark1,mark2,total
jdbc
jdbc  is it possible to use doget & dopost method with jdbc to call in a servlet programe
JDBC
JDBC  in class.forname which driver name we are writing for the connection from jdbc to sqlserver 2008
 

 

 

DMCA.com