I am simply inserting a row and it does nt even throw exception but the database is nt getting updated

please find out what is wrong with this code

import java.sql.*;

public class Check
{
 public static void main(String args[])
 {
 try{

 Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");


 String dataSourceName = "glad1";

 String dbURL = "jdbc:odbc:" + dataSourceName;

 Connection c= DriverManager.getConnection(dbURL, "","");





 Statement st=c.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);

 ResultSet rs=st.executeQuery("SELECT * FROM Table1");


 rs.moveToInsertRow(); 
    rs.updateString("Name", "AINSWORTH"); 

    rs.updateInt("Age",35); 
    rs.updateInt("Jug", 6);


    rs.insertRow();




 }

 catch(Exception er)
 {
 System.out.println("error"+er.getMessage());
 }
 }
 }

several things wrong there, some of the terribly wrong.
First, you don't properly close your database resources. That's the single greatest sin of anyone using JDBC and a major cause of application failure (even of multimillion Euro systems, I've seen it happen).
Second, you're using the JDBC-ODBC bridge driver which is to put it mildly no good at all.
Third, (and related) you are using a JDBC driver that doesn't support updatable resultsets, and apparently this one fails silently instead of yielding an error.
Fourth, you don't commit your transaction (and you can't know if you are using autocommit or not if you don't explicitly say so, in fact you should always assume you aren't unless you explicitly say you are).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.