utama.java:31: cannot resolve symbol
Dear my friends... Anybody would be so nice to tell me where the problem of script. I got this error message each time my code compiled: " patrixlinux@patrix:~/arsip/My/comadmin> javac utama.java utama.java:31: cannot resolve symbol symbol : method Int (java.lang.String) location: interface java.sql.ResultSet sCustomer = rs.Int("customerid"); ^ 1 error patrixlinux@patrix:~/arsip/My/comadmin> " Here is my code under below: ========= import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.*; public class utama { public static void main(String[] args){ System.out.println("Here is customer menu\n"); try { Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/amt?user=root&password=pandawa5"); System.out.println("Connection established\n"); // Do something with the Connection // assume conn is an already created JDBC connection Statement stmt = null; ResultSet rs = null; try { stmt = conn.createStatement(); rs = stmt.executeQuery("SELECT customerid FROM customer"); // or alternatively, if you don't know ahead of time that // the query will be a SELECT... if (stmt.execute("SELECT customerid FROM customer")) { rs = stmt.getResultSet(); int sCustomer; // Now do something with the ResultSet .... while(rs.next()) // for each row of data { sCustomer = rs.Int("customerid"); // Report each Customer System.out.println("Customer : " + sCustomer + "\n"); } } } finally { // it is a good idea to release // resources in a finally{} block // in reverse-order of their creation // if they are no-longer needed if (rs != null) { try { rs.close(); } catch (SQLException sqlEx) { // ignore } rs = null; } if (stmt != null) { try { stmt.close(); } catch (SQLException sqlEx) { // ignore } stmt = null; } } } } }catch (Exception e) { // handle any errors } } } ======== Thank alot in advance. __________________________________ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com/
Prabu Subroto wrote:
Dear my friends...
Anybody would be so nice to tell me where the problem of script. I got this error message each time my code compiled: " patrixlinux@patrix:~/arsip/My/comadmin> javac utama.java utama.java:31: cannot resolve symbol symbol : method Int (java.lang.String) location: interface java.sql.ResultSet
<snip> ResultSet rs = null; <snip>
sCustomer = rs.Int("customerid");
<snip> I don't see an "Int" method as part of the ResultSet interface. I have a link to http://java.sun.com/j2se/1.4.2/docs/api/index.html to see what the definitions are for all standard classes etc.
On Mon, Dec 08, 2003 at 09:38:26AM -0800, Prabu Subroto wrote:
Dear my friends...
Anybody would be so nice to tell me where the problem of script. I got this error message each time my code compiled: " patrixlinux@patrix:~/arsip/My/comadmin> javac utama.java utama.java:31: cannot resolve symbol symbol : method Int (java.lang.String) location: interface java.sql.ResultSet sCustomer = rs.Int("customerid");
^ 1 error patrixlinux@patrix:~/arsip/My/comadmin> "
Here is my code under below: ========= import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.*;
public class utama { public static void main(String[] args){ System.out.println("Here is customer menu\n"); try {
Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/amt?user=root&password=pandawa5"); System.out.println("Connection established\n"); // Do something with the Connection // assume conn is an already created JDBC connection Statement stmt = null; ResultSet rs = null; try { stmt = conn.createStatement(); rs = stmt.executeQuery("SELECT customerid FROM customer");
// or alternatively, if you don't know ahead of time that // the query will be a SELECT...
if (stmt.execute("SELECT customerid FROM customer")) { rs = stmt.getResultSet(); int sCustomer; // Now do something with the ResultSet .... while(rs.next()) // for each row of data { sCustomer = rs.Int("customerid");
This last line should read: sCustomer = rs.getInt("customerid"); Victor
participants (3)
-
expatriate
-
Prabu Subroto
-
Victor R. Cardona