jdbc program not working

I am trying to make a table in ms access through java and im able to compile this program also but i am not able to get its output.........................

import java.sql.*;

class databconnection1

{

public static void main(String args[])

{

try

{

String n;

int sal;

String url="Jdbc:odbc:SS";

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

Connection con=DriverManager.getConnection(url);

Statement stmt=con.createStatement();

String sel="CREATE TABLE Teach (Name Text(20),Salary Number)";

stmt.executeUpdate(sel);

stmt.executeUpdate("INSERT INTO Teach VALUES ('namrata',900)");

ResultSet rs=stmt.executeQuery("SELECT Name,Salary FROM Teach WHERE Salary>100");

//System.out.println("NameRollMarks");

while(rs.next())

{

n=rs.getString("Name");

sal=rs.getInt("Salary");

System.out.println(n+""+sal);

System.out.println("Name:"+n);

System.out.println("Salary:"+sal);

}

}

catch(Exception e)

{

}

}

}

[1100 byte] By [a_k_h_i_la] at [2007-11-27 5:09:30]
# 1
Stop just silenty eating the exception and print the stack trace and tell us what it says.You should NEVER EVER by just silently eating exceptions like that. As you can see it is totally useless to do so.
cotton.ma at 2007-7-12 10:29:15 > top of Java-index,Java Essentials,Java Programming...
# 2

1) Post the code again in [code][/code] tags.

2) Post the error message and stack trace if you get one, or the output if not.

3) Never suppress exceptions:

catch(Exception e) {

}

When you do that, you have no way of knowing if something went wrong, and what it was. Do this:

catch(Exception e) {

e.printStackTrace();

}

hunter9000a at 2007-7-12 10:29:15 > top of Java-index,Java Essentials,Java Programming...
# 3
When you create a table, it contains zero rows.Thus, it's not surprising that your output here would be nothing.
kevjavaa at 2007-7-12 10:29:15 > top of Java-index,Java Essentials,Java Programming...
# 4
> When you create a table, it contains zero rows.> > Thus, it's not surprising that your output here would> be nothing.Well he's doing an insert right after the create
cotton.ma at 2007-7-12 10:29:15 > top of Java-index,Java Essentials,Java Programming...
# 5
> Well he's doing an insert right after the createYes, missed that. Thanks cotton, you're correct.Nothing to see here, citizens, back to your lives :).
kevjavaa at 2007-7-12 10:29:15 > top of Java-index,Java Essentials,Java Programming...
# 6
> > Well he's doing an insert right after the create> > Yes, missed that. Thanks cotton, you're correct.> > Nothing to see here, citizens, back to your lives :).We'll just blame that one on the lack of formatting ;)
hunter9000a at 2007-7-12 10:29:15 > top of Java-index,Java Essentials,Java Programming...
# 7
> We'll just blame that one on the lack of formatting ;)Yeah, that's it... :)
kevjavaa at 2007-7-12 10:29:15 > top of Java-index,Java Essentials,Java Programming...
# 8
> //Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");Are the two slashes at the beginning of this line of code meant to do anything in particular?
DrClapa at 2007-7-12 10:29:15 > top of Java-index,Java Essentials,Java Programming...
# 9

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

>

> Are the two slashes at the beginning of this line of

> code meant to do anything in particular?

They're italics, for emphasis. They tell the compiler that this line is //really// important.

kevjavaa at 2007-7-12 10:29:15 > top of Java-index,Java Essentials,Java Programming...