how to implements jdbc connections using awt

how to implements jdbc connections using awt

sir, My name is subbareddy vajrala.I want to implement small project on awt.so please give me your valuable information about how to implements jdbc connections in awt.please give me sample example awt with jdbc.

                 Thanking you sir.
View Answers

August 18, 2011 at 3:06 PM

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

class  FormData{
    public static void main(String[] args){
    Frame f=new Frame();
    Label label1=new Label("First Name: ");
    Label label2=new Label("Last Name: ");
    Label label3=new Label("Email: ");
    Label label4=new Label("Address: ");
    Label label5=new Label("Contact No: ");
    final TextField text1=new TextField(20);
    final TextField text2=new TextField(20);
    final TextField text3=new TextField(20);
    final TextField text4=new TextField(20);
    final TextField text5=new TextField(20);
    Button b=new Button("Save");
    b.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent e){
        String v1=text1.getText();
        String v2=text2.getText();
        String v3=text3.getText();
        String v4=text4.getText();
        String v5=text5.getText();
        try{
           Class.forName("com.mysql.jdbc.Driver");
           Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/roseindia", "root", "root");
           Statement st=con.createStatement();
           int i=st.executeUpdate("insert into student(firstname,lastname,email,address,telephone) values('"+v1+"','"+v2+"','"+v3+"','"+v4+"','"+v5+"')");
           JOptionPane.showMessageDialog(null,"Data is inserted successfully");
        }
        catch(Exception ex){
        System.out.println(ex);
         }
       }
        });
        Panel p=new Panel(new GridLayout(6,2));
        p.add(label1);
        p.add(text1);
        p.add(label2);
        p.add(text2);
        p.add(label3);
        p.add(text3);
        p.add(label4);
        p.add(text4);
        p.add(label5);
        p.add(text5);
        p.add(b);
        f.add(p);
        f.setVisible(true);
        f.pack();
    }
}

For more information, please go through the following link:

AWT Examples









Related Tutorials/Questions & Answers:
how to implements jdbc connections using awt
how to implements jdbc connections using awt  sir, My name... valuable information about how to implements jdbc connections in awt.please give me sample example awt with jdbc. Thanking you sir.  
how to implements jdbc connections using awt?
how to implements jdbc connections using awt?   My name is Aditya... information about how to implements jdbc connections in awt.please give me sample example awt with jdbc.   We are proving you a simple application
Advertisements
jdbc connections
jdbc connections  How can I coonect with oracle9i with java program using both thin driver and sun driver. plz send sample code for both the drivers... oracle.sql.*; 2) Load and Register the JDBC driver: DriverManager.registerDriver
Connections with MicroSoft SQL - JDBC
Connections with MicroSoft SQL  How to Connect Java and MS SQL?? Actually i used below code i got SQLException and class not found... import...; Statement st = null; ResultSet rs = null; String url = "jdbc
how to print all colors using awt
how to print all colors using awt  how to print all colors using awt
awt jdbc
awt jdbc  programm in java to accept the details of doctor (dno,dname,salary)user & insert it into the database(use prerparedstatement class&awt
awt
JDBC in awt  how to display data using JDBC in awt/applet
awt
JDBC and AWT to display data  how to display data using JDBC in awt/applet
awt
JDBC in awt applet  how to display data using JDBC in awt/applet
how to create a text box using awt
how to create a text box using awt  give an example how creat multi buttons & text boxes
JDBC-AWT
JDBC-AWT  I can not able to capture the data in an applet which contains the components like text fields,check box etc.. and i am trying to save the data in sql+. When i run the code in netbeans, i can abe to store successfully
awt
Java AWT Applet example  how to display data using JDBC in awt/applet
another frame by using awt or swings
another frame by using awt or swings  how to connect one frame to another frame by using awt or swings
How to put the logo in login form using swings/awt?
How to put the logo in login form using swings/awt?  Hi, How to put the logo in login form using swings/awt? I write the login form is working..."); Connection con = DriverManager.getConnection("jdbc:mysql://localhost
how to backup and restore database using java - Swing AWT
how to backup and restore database using java  sir my project is to backup and restore my datas using java so i want to know how to backup and restore databases using java give ur ideas and suggestions to me immediately  
how to set image in button using swing? - Swing AWT
how to set image in button using swing?  how to set the image in button using swing?  Hi friend, import java.awt.*; import java.awt.event.*; import com.sun.java.swing.*; public class ImageButton extends JFrame
How to set the border in header and footer from login page using swings/awt
How to set the border in header and footer from login page using swings/awt  Hi, How to set the border in header and footer from login page using swings/awt
how to insert data into databasse by using jdbc
how to insert data into databasse by using jdbc  ? Create a Registration Form with 10 input fields using HTML and get those inputs using JSP and insert those inputs into database using JDBC.   Here is a jsp code
how to insert data into databasse by using jdbc
how to insert data into databasse by using jdbc  ? Create a Registration Form with 10 input fields using HTML and get those inputs using JSP and insert those inputs into database using JDBC.   Here is a jsp code
how to insert data into databasse by using jdbc
how to insert data into databasse by using jdbc  ? Create a Registration Form with 10 input fields using HTML and get those inputs using JSP and insert those inputs into database using JDBC.   Here is a jsp code
how to insert data into databasse by using jdbc
how to insert data into databasse by using jdbc  ? Create a Registration Form with 10 input fields using HTML and get those inputs using JSP and insert those inputs into database using JDBC.   Here is a jsp code
swing with jdbc - Swing AWT
have some problems with swing using jdbc. 1. the values entered in table are not stored in DB. 2. is there is any solution that uses jtable with JDBC? kindly...swing with jdbc  Hi, i m developing the desktop application using
how to create a databaseconnectvity using SQLSERVER2005 in J2ME - JDBC
how to create a databaseconnectvity using SQLSERVER2005 in J2ME  hi , iam new to J2ME,i want to know, How to create a data base connectivity using sqlserver through J2ME. Currently we are working on a Mobile Applicayion
how to connection jsp to oracle database connections in netbeans ide
how to connection jsp to oracle database connections in netbeans ide  how to connect jsp to oracle database connections in netbeans ide?pls provide screenshots if possible
how to connection jsp to oracle database connections in netbeans ide
how to connection jsp to oracle database connections in netbeans ide  how to connect jsp to oracle database connections in netbeans ide?pls provide screenshots if possible
How to passed the ID's in MAP how to stored whaterver select the name that only ID should store in db using SWING/AWT?
How to passed the ID's in MAP how to stored whaterver select the name that only ID should store in db using SWING/AWT?  Hi, I am working on SWING/AWT application,I write select box programs in swings. my proble is what
using Blob in jdbc - JDBC
using Blob in jdbc  Hi, I got an Exception when i was trying to insert one image into oracle 10g database the exception is Exception in thread..."); Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost
JDBC using Spring framework - JDBC
JDBC using Spring framework  Hi, I am using Spring framework in my project. I am making a call to the DB2 procedure using datasource and it returns... the code i'm using... HashMap params = new HashMap(); params.put("Username
AWT
AWT  How to set size of button in awt
database entry using jdbc
database entry using jdbc  Give me a program to enter records in table using jdbc in java.   Hi Friend, Please visit the following link:ADS_TO_REPLACE_1 Insert data into database Thanks
multiple JComboBoxes using with JDBC
multiple JComboBoxes using with JDBC  how to use JComboBoxes with JDBC in java  Hi Friend,Try the following code:import java.awt.*;import... =DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","root"
ModuleNotFoundError: No module named 'connections'
'connections' How to remove the ModuleNotFoundError: No module named 'connections' error? Thanks   Hi, In your python environment...ModuleNotFoundError: No module named 'connections'  Hi, My Python
how to make a radiobutton selected when retrieving data from database using struts framework and spring jdbc
how to make a radiobutton selected when retrieving data from database using struts framework and spring jdbc  how to make a radio button selected when retrieving data from database using struts framework and spring jdbc
How sql Queries possible in DAO without creating Database connections - Java Beginners
How sql Queries possible in DAO without creating Database connections  In DAO we are writting sql queries , how it is possible without creating and closing database connections
Graphical calculator using AWT - Java Beginners
Graphical calculator using AWT  Hi Sir, Thanks for the reply.....and is it the same code we need implement on Graphical Calc using Swing? Here is the prg code... OpListener implements ActionListener { public void actionPerformed(ActionEvent e
Graphical calculator using AWT - Java Beginners
Graphical calculator using AWT  hi Sir, I need a source code for the following prgm...pls help me.. Implement a simple graphical calculator using..._logic.setTotal("0"); } class OpListener implements ActionListener
awt in java
awt in java  using awt in java gui programming how to false the maximization property of a frame
Connecting to remote mysql server using jdbc.
Connecting to remote mysql server using jdbc.  How to Connect to remote mysql server using jdbc
compareing images using java - Swing AWT
compareing images using java  hi can u please give me the code in java to compare imges..i have the program to get the pixel values using pixel... with another image,i.e,program to compare two images using the pixel values.. thank
How to Retrieve Excel data into mysql using type 2 JDBC-ODBC driver
How to Retrieve Excel data into mysql using type 2 JDBC-ODBC driver  Can any please help it is very urgent. I tried to read excel sheet using ODBC... using ODBC.plz help me guys..........   Follow these steps
not able to connect to mysql using.. jdbc
not able to connect to mysql using.. jdbc   i am not able to connect to mysql using jdbc .. is there any classpath that i need to set..because i am using mysql-connector-java jar file..to connect to mysql.. Pls provide the steps
using pb datawindow activex with jdbc for mysql - JDBC
using pb datawindow activex with jdbc for mysql  Hi, I am trying to use datawindow activex in a web page. I need to connect to mysql database located on the server. I have downloaded the connectj for mysql. What should
how to connect mysql with JDBC - JDBC
in the database MYsql, i have to connect them now using JDBC, can u please suggest me...(); } } Thanks Rajanikant  Hi friend, To mysql connect using JDBC... database using Jdbc: import java.sql.*; public class GetAllRows{ public
Which JDBC Type Using - Java Beginners
Which JDBC Type Using  As there are 4 types of JDBC driver. I wanted to know: How would one come to know that which jdbc type any web application is using (if Db is oracle or mysql or MSSQL)? Thanks, Sushma  Hi
excel file using JDBC java.?
excel file using JDBC java.?  hey, i am a telecomm. engineer , and i am try to develop a tool which reads from a excel file and then appends the same... used JDBC ODBC to read from excel file. i am not able to append it using
JDBC Versions
and passing data using Rowset technology. Features of the JDBC 2.1 core... JDBC Versions       1). The JDBC 1.0 API. 2). The JDBC 1.2
How to save data - Swing AWT
How to save data  Hi, I have a problem about how to save data ,but first before data save to dababase, data must view in jLisit or Jtable then in jList or or Jtable many data viewer in one button,then another button must
ModuleNotFoundError: No module named 'implements'
'implements' How to remove the ModuleNotFoundError: No module named 'implements' error? Thanks   Hi, In your python environment you...ModuleNotFoundError: No module named 'implements'  Hi, My Python
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 create a data base connectivity using sqlserver or Mydql through J2ME - JDBC
How to create a data base connectivity using sqlserver or Mydql through J2ME   hi , iam new to J2ME,i want to know, How to create a data base connectivity using sqlserver through J2ME. Currently we are working

Ads