Sun's JDBC Tutorial. Need a Little Help

im learning about JBDC using suns tutorial but ive run into a problem. on this page here http://java.sun.com/docs/books/tutorial/jdbc/basics/retrieving.html about 1/7th of the way through they give u some code. but when i used it in my IDE (netbeans 5.5) i get 2 errors:

try{

Class.forName("org.apache.derby.jdbc.EmbeddedDriver");

Connection con = DriverManager.getConnection("jdbc.derby.COFFEES");

Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);

ResultSet srs = stmt.executeQuery("SELECT COF_NAME, PRICE FROM COFFEES");

}catch(ClassNotFoundException ex){

ex.printStackTrace();

}catch(SQLException ex){

ex.printStackTrace();

}

D:\Java\Java Phonebook\src\JavaPhonebook\JDBCTutorial.java:32: incompatible types

found: java.sql.Statement

required: java.beans.Statement

stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);

D:\Java\Java Phonebook\src\JavaPhonebook\JDBCTutorial.java:33: cannot find symbol

symbol : method executeQuery(java.lang.String)

location:class java.beans.Statement

srs = stmt.executeQuery("SELECT COF_NAME, PRICE FROM COFFEES");

2 errors

Message was edited by:

Alex1989

[1698 byte] By [Alex1989a] at [2007-11-27 4:12:17]
# 1

You should learn how to read and make sense of compiler error messages. This one is not hard to understand.

"found: java.sql.Statement

required: java.beans.Statement"

What does that suggest to you? Does it suggest that the compiler is getting confused between java.sql.Statement and java.beans.Statement? It should.

So how do you fix this? Two options

1) You can stop importing java.beans.Statement. I think you should explore this route first because it seems to me that you are importing packages and classes for which you have no need.

2) You can indicate specifically which Statement you want in your code.

cotton.ma at 2007-7-12 9:18:15 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...