cannot resolve symbol errors

Discussion in 'Java' started by Jody, Nov 11, 2004.

  1. Jody

    Jody Guest

    Hey, i'm having issues with the following code:
    package dbase;

    import java.util.Vector;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import java.sql.ResultSetMetaData;


    public class Register extends DataBase
    {
    public Register()
    {

    }

    public Vector getBookLoansColumnHeadings()
    {
    Vector headings = new Vector();
    this.setConnection();
    try
    {
    Statement st = conn.createStatement();
    String sql = "Select * from library where BorrowerID < 1";

    // get the meta data from the ResultSet
    ResultSet rs = st.executeQuery(sql);

    ResultSetMetaData rsmd = rs.getMetaData();
    for (int x= 1 ; x <= rsmd.getColumnCount(); x++)
    {
    headings.addElement(rsmd.getColumnName(x));
    }
    rs.close();
    st.close();
    this.closeConnection();
    }
    catch (Exception ex)
    {
    System.out.println(ex.getMessage());
    }
    return headings;
    }
    public Vector getBookLoansData()
    {
    Vector BookLoansData = new Vector();
    this.setConnection();
    try
    {
    Statement st = conn.createStatement();
    String sql = "Select * from library"; // get all the records
    ResultSet rs = st.executeQuery(sql);
    ResultSetMetaData rsmd = rs.getMetaData();
    while (rs.next()) // loop through all the records
    {
    Vector myrow = new Vector(); // create a vector for each row
    // Note: indexed from 1 to N not 0 to N-1
    for (int x= 1 ; x <= rsmd.getColumnCount(); x++)
    {
    myrow.addElement(rs.getString(x));
    }
    // add vector to overall vector
    BookLoansData.addElement(myrow);
    }
    rs.close();
    st.close();
    this.closeConnection();
    }
    catch(Exception ex)
    {
    System.out.println(ex.getMessage());
    }
    return BookLoansData;
    }
    }

    The errors i get are as follows:

    cannot resolve symbol
    symbol : class DataBase
    location: class dbase.Register
    public class Register extends DataBase
    ^
    cannot resolve symbol
    symbol : method setConnection ()
    location: class dbase.Register
    this.setConnection();
    ^
    cannot resolve symbol
    symbol : variable conn
    location: class dbase.Register
    Statement st = conn.createStatement();
    ^
    cannot resolve symbol
    symbol : method closeConnection ()
    location: class dbase.Register
    this.closeConnection();
    ^
    cannot resolve symbol
    symbol : method setConnection ()
    location: class dbase.Register
    this.setConnection();
    ^
    cannot resolve symbol
    symbol : variable conn
    location: class dbase.Register
    Statement st = conn.createStatement();
    ^
    cannot resolve symbol
    symbol : method closeConnection ()
    location: class dbase.Register
    this.closeConnection();
    ^
    Has this got something to do with packages, or is it something really
    obvious?
     
    Jody, Nov 11, 2004
    #1
    1. Advertising

  2. On Thu, 11 Nov 2004 17:23:49 -0000, Jody wrote:

    > Hey, i'm having issues with the following code:


    > package dbase;


    > Has this got something to do with packages, or is it something really
    > obvious?


    Everything to do with packages.

    I take it you have the DataBase.java source in the
    same directory (package) as Register.java?

    > import java.util.Vector;
    > import java.sql.Statement;
    > import java.sql.ResultSet;
    > import java.sql.ResultSetMetaData;
    >
    > public class Register extends DataBase
    > {


    (big snip..)
    > cannot resolve symbol
    > symbol : class DataBase


    First stop for the basic errors
    <http://mindprod.com/jgloss/compileerrormessages.html>
    <http://mindprod.com/jgloss/runerrormessages.html>

    Or, in this specific case,
    <http://mindprod.com/jgloss/compileerrormessages.html#CANNOTRESOLVESYMBOL>
    point four.

    You do not import 'DataBase', are they in the same package?

    --
    Andrew Thompson
    http://www.PhySci.org/codes/ Web & IT Help
    http://www.PhySci.org/ Open-source software suite
    http://www.1point1C.org/ Science & Technology
    http://www.LensEscapes.com/ Images that escape the mundane
     
    Andrew Thompson, Nov 11, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. @lex-kid
    Replies:
    2
    Views:
    2,395
    @lex-kid
    Jul 7, 2003
  2. sufia
    Replies:
    1
    Views:
    3,039
    @lex-kid
    Jul 6, 2003
  3. Jo

    Cannot resolve symbol

    Jo, Apr 9, 2004, in forum: Java
    Replies:
    3
    Views:
    2,724
    Roedy Green
    Apr 10, 2004
  4. Jody
    Replies:
    1
    Views:
    1,350
    Andrew Thompson
    Nov 15, 2004
  5. Replies:
    1
    Views:
    10,170
Loading...

Share This Page