//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.