can't see the error
Compiling the following code:
--
import java.sql.*;
publicclass JDBC2Mods
{
staticprivate Connection link;
staticprivate Statement statement;
staticprivate ResultSet results;
publicstaticvoid main(String[] args)
{
try
{
//Step 1...
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
//Step 2...
link = DriverManager.getConnection(
"jdbc:odbc:Vrienden","","");
}
catch(ClassNotFoundException cnfEx)
{
System.out.println ("* Unable to load driver! *");
System.exit(1);
}
//For any of a number of reasons, it may not be
//possible to establish a connection...
catch(SQLException sqlEx)
{
System.out.println("* Cannot connect to database! *");
System.exit(1);
}
try
{
//Step 3...
statement = link.createStatement(
ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
System.out.println("\nInitial contents of table:\n");
//Steps 4 and 5...
displayTable();
//Start of step 6...
//First the update...
results.absolute(2);//Move to row 2 of ResultSet.
results.updateString("City","Hoofdorp");
results.updateRow();
//Now the insertion...
results.moveToInsertRow();
results.updateInt("Address no.");
results.updateString("First Name","Nathalia");
results.updateString("Last Name","Lopez");
results.updateString("Nickname","Talia");
results.updateString("City","Leiden");
results.insertRow();
//Finally, the deletion...
results.absolute(3);//Move to row 3.
results.deleteRow();
System.out.println("\nNew contents of table:\n");
displayTable();
link.close();
}
catch(SQLException sqlEx)
{
System.out.println("* SQL or connection error! *");
sqlEx.printStackTrace();
System.exit(1);
}
}
publicstaticvoid displayTable()throws SQLException
{
String select ="SELECT * FROM Addresses";
results = statement.executeQuery(select);
System.out.println();
while (results.next())
{
System.out.println("Address no. "
+ results.getInt(1));
System.out.println("Vriendin: "
+ results.getString(3)
+" " + results.getString(2));
System.out.println("Nickname: "
+ results.getString(4));
System.out.println("City: "
+ results.getString(5));
}
}
}
I get the following error:
D:\JavaApplicatie\JDBC2Mods.java:51: cannot find symbol
symbol : method updateInt(java.lang.String)
location: interface java.sql.ResultSet
results.updateInt("Address no.");
^
1 error
--
But I don't see what the problem is, since the results.updateInt is an original code piece...
The column (Address no) is the primary key of the 'Vrienden' database...could the problem be there?
How do I solve this.....

