JDBC ODBC related problem

Ads
 

JDBC ODBC related problem

i WANT HELP RELATED TO JDBC CONNECTIVITY WITH MS ACCESS.. HERE IS MY FULL CODE... import java.awt.Container; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemListener; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import javax.swing.*; public abstract class New_Customer extends JFrame implements ActionListener,ItemListner { JTextField textFieldId; JTextField textFieldName; JTextField textFieldContactNo;
JLabel l1; JLabel l2; JLabel l3; JLabel l4; JLabel l5; JLabel l6;
JComboBox combo; ComboBox b = new ComboBox(); String course[] = {"Navakal","SandhyaKal","Pudhari","MidDay","Inqlab","BusinessLine","Mumbai Samachar","Gujraj Samachar","Karnatak Malla","Vartahar","PunyaNagari"};
JButton b1; JButton b2; PreparedStatement ps; Container c = getContentPane(); New_Customer() { super("Shree DattaDigambar Samarth"); setBounds(140,250,777,555); c.setLayout(null); textFieldId = new JTextField(); textFieldName = new JTextField(); textFieldContactNo = new JTextField(); l1 = new JLabel("New Customer Entry"); l2 = new JLabel("Building No"); l3 = new JLabel("Customer Name"); l4 = new JLabel("Contact No"); l5 = new JLabel("Paper");
combo = new JComboBox(course); l1.setBounds(10,10,340,20); l2.setBounds(10,20,140,70); l3.setBounds(110,20,140,70); l4.setBounds(300,50,140,20); l5.setBounds(400,50,140,20); textFieldId.setBounds(10,70,70,20); textFieldName.setBounds(110,70,180,20); textFieldContactNo.setBounds(300,70,90,20); combo.setBounds(400,70,130,20); b1 = new JButton("Add paper"); b2 = new JButton("Ok"); b1.setBounds(10,100,100,20); b2.setBounds(10,160,50,20);
c.add(combo);
c.add(b1); c.add(b2); c.add(l1); c.add(l2); c.add(l3); c.add(l4); c.add(l5); c.add(textFieldId); c.add(textFieldName); c.add(textFieldContactNo);
setVisible(true); setDefaultCloseOperation(EXITONCLOSE);
b1.addActionListener(this); b2.addActionListener(this); combo.addItemListener(null);

    }
    public void actionPerformed(ActionEvent ae)
    {
        if(ae.getSource()==b2)
        {
            try
            {
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                Connection con;
                con = DriverManager.getConnection("jdbc:odbc:Digambar_Dalvi");
                ps=con.prepareStatement("insert into Customer(Building_No,Customer_Name,Contact_No,Paper_Name)values(?,?,?,?)");


            ps.setString(1,textFieldId.getText());
            ps.setString(2,textFieldName.getText());
            ps.setString(3,textFieldContactNo.getText());                           
            ERROR{                String str = (String)combo.getSelectedItem();
            ERROR           ps.setString(4,combo.getText());
            ERROR           //ps.setString(4,str.getText());
            ERROR           ps.executeUpdate();
                }
                con.close();  

            }
            catch(Exception ex)
        {
            System.out.println("Error 1:"+ex);
        }
        }
    }
    public static void main(String args[])
{

    New_Customer v = new New_Customer() {};



}

}

AS I SHOW IN CODE THE ERROR PART...... THE QUESTION N PROBLEM IS I WANT TO SELECTE PERTICULAR PAPER FROM COMBOBOX AND THOSE SELECTED PAPER TEXT I WANT TO PRINT IN MS ACESS DATABASE..MEANS FROM THAT I COME TO KNOW THAT WHICH CUSTOMER HAVING WHICH PAPER........... HELP ME PLZ THANKS IN ADVANCED

View Answers

Ads









Related Tutorials/Questions & Answers:
JDBC ODBC related problem
JDBC ODBC related problem  i WANT HELP RELATED TO JDBC CONNECTIVITY... con; con = DriverManager.getConnection("jdbc:odbc:Digambar... THE ERROR PART...... THE QUESTION N PROBLEM IS I WANT TO SELECTE PERTICULAR PAPER FROM
jdbc odbc
= DriverManager.getConnection("jdbc:odbc:swing"); String sql = "INSERT...jdbc odbc  Sir, i want to get the selected value from JCombobox to ms... problem. you can read this complete tutorial from the link given below http
Advertisements
jdbc odbc
jdbc odbc   i have two tables in database 1table's attribute is foreign key of another in this case how to retrive value from both table and show in a gridview combine using java code   Sql query to retrieve values
JDBC-ODBC
JDBC-ODBC  HI what should i give names for DNS and TNS in Administrative Tools so that there will be connection between Database (oracle) and java.Actually how to operate Administrative Tools
JDBC-ODBC
JDBC-ODBC  HI what should i give names for DNS and TNS in Administrative Tools so that there will be connection between Database (oracle) and java.Actually how to operate Administrative Tools
jdbc odbc
jdbc odbc  i want to fetch the data from the ms access and print on ms word for printing purpose?? the whole program is in swing to ms acess connectivity.. the whole set up is perform only printing part is remaining? so help me
jdbc odbc
jdbc odbc  i want to fetch the data from the ms access and print on ms word for printing purpose?? the whole program is in swing to ms acess connectivity.. the whole set up is perform only printing part is remaining? so help me
Java JDBC ODBC
Java JDBC ODBC  What is the difference between JDBC and ODBC
JDBC-Odbc Connection
JDBC-ODBC Connection       JDBC-ODBC Connection is a JDBC driver that translates the operation in  JDBC into ODBC. For ODBC,it is a normal java application program. This bridge
jdbc odbc sql server exception
jdbc odbc sql server exception  Hi, I am trying to use sql server with java jdbc odbc but I am getting this exception java.sql.SQLException: [Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax near '@P1
problem related to onSubmit() method
problem related to onSubmit() method  Hello, I am developing application.when i submit form at that time formBacking() method is call...Instead of that onSubmit() should have to call .... please help me
jdbc problem
jdbc problem   hi my name is mohit...i am making a project in java swings....pls help me how to check that the username and password are correct..."); con = DriverManager.getConnection("jdbc:odbc:mohit"); stmt
JDBC ODBC Connection In Java
JDBC ODBC Connection In Java In this section we will read about the various aspects of JDBC ODBC such as, JDBC-ODBC bridge, JDBC ODBC connection, how to create DSN etc. JDBC-ODBC Bridge As its name JDBC-ODBC bridge, it acts like
JDBC related query
JDBC related query  How to merge two resultset of two different queries, wherein both the resultset(after query execution)gives an integer value as its column
JDBC-Odbc Connectivity
JDBC-ODBC Connectivity       The code illustrates an example from JDBC-ODBC...;"jdbc:odbc:emp";   public 
code related problem
code related problem  this code is compiling but not running please help import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Mybutton11 extends JFrame { JTextField text1 = new JTextField(20
how to set fetch size for jdbc odbc driver
how to set fetch size for jdbc odbc driver  What is the default fetch size for the JDBC ODBC driver and how can i fetch a set of results for JDBC ODBC driver?   Fetching results JDBC ODBC Driver A. The default fetch
query related to jdbc
query related to jdbc  hello, i have done my database connection successfully ie db2 with RAD. but while running my application i am not able to fetch the data so please suggest and help me
jdbc and swing problem in netbeans
jdbc and swing problem in netbeans  i reteived the table from database in a jdbc program. next i want to do is place the table as it is in a jpanel.. i am using netbeans IDE can u tel me how to do that one?? urgent
jdbc and swing problem in netbeans
jdbc and swing problem in netbeans  i reteived the table from database in a jdbc program. next i want to do is place the table as it is in a jpanel.. i am using netbeans IDE can u tel me how to do that one?? urgent
problem in jdbc connection
problem in jdbc connection  when i am trying to insert into apache derby databse using java in netbeans an exceprion is thrown at run time like this:- java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver....what
jdbc oracle connectivity problem
jdbc oracle connectivity problem  Hi All, I am trying to connect my swing application to oracle DB . but class.forname is giving error. Please suggest me if there is some different way to connect swing application to oracle
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..."); Connection conn = DriverManager.getConnection("jdbc:odbc:excel
Problem to get connection from DAO class to JDBC
Problem to get connection from DAO class to JDBC  package controller; import java.sql.Connection; import java.sql.DriverManager; public class... { String DRIVER="oracle.jdbc.driver.OracleDriver"; String URL="jdbc:oracle
online quiz program coding using jsp, jdbc odbc connection with ms. access.. Thank you.
online quiz program coding using jsp, jdbc odbc connection with ms. access.. Thank you.  please provide online quiz program coding using jsp, jdbc odbc connection with ms. access.. Thank you.   Create table test
ODBC connection
ODBC connection   import java.sql.*; import java.util.*; public...)c.newInstance(); String s="jdbc:oracle:thin:@localhost:1521:ORCL... ODBC program,bt here I am getting error i.e Exception in Thread "main
ODBC connection
ODBC connection   import java.sql.*; import java.util.*; public...)c.newInstance(); String s="jdbc:oracle:thin:@localhost:1521:ORCL... ODBC program,bt here I am getting error i.e Exception in Thread "main
ODBC connection
ODBC connection   import java.sql.*; import java.util.*; public...)c.newInstance(); String s="jdbc:oracle:thin:@localhost:1521:ORCL... ODBC program,bt here I am getting error i.e Exception in Thread "main
problem in creating web application using servelet, jsp, jdbc and xml - JSP-Servlet
problem in creating web application using servelet, jsp, jdbc and xml  Using Servlet, JSP, JDBC and XML create a web application for a courrier...; Hi friend, For solving the problem visit to : http://www.roseindia.net
jdbc
= DriverManager.getConnection("jdbc:odbc:student"); Class.forName... using jdbc connection   import java.sql.*; public class CreateTable
jdbc
=DriverManager.getConnection("jdbc:odbc:access","",""); Statement st=null; st...jdbc  how to update int values of ms-access in jdbc program?   In MS Access database, use Number data type for int values. import

Ads