0
//java program  to insert a row into a table using Statement![the output of the program is shown in the image provided by the link given at the bottom

import java.io.*;
import java.lang.*;
import java.sql.*;

class stmtinserts
{

    public static void main(String a[])throws Exception
    {
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        Connection con=DriverManager.getConnection("jdbc:odbc:test");
        String s = "insert into cricket values(10, 'name1', 10000)";
        Statement st=con.createStatement();
        int i = st.executeUpdate(s);

        if(i > 0)
            System.out.println("data inserted ");
        else
            System.out.println("data is not inserted");

        st.close();
        con.close();

    }
}

Click this link to view the image

My operating system is windows 7 ,32 bit system. java version is 1.8.0_05.

also give me suggestions about error "mapping_data_source ::init error : file not found". when ever i type java or javac, i find this error.

Help from any one is appreciated.thanks in advance.

Ashot Karakhanyan
  • 2,804
  • 3
  • 23
  • 28
SachinFederer
  • 41
  • 1
  • 4
  • 2
    please check this answer http://stackoverflow.com/a/23360455/1012575, java 1.8 doesn't have sun.jdbc.odbc.JdbcOdbcDriver class. You should find another driver – Vassilis Blazos May 06 '14 at 14:04
  • 1
    @SachinFederer Next time please include the Exception as text into your question and do not use external image hosters. – Robert May 06 '14 at 14:25

0 Answers0