Antonio,

Try this it works for me. I have always referenced the resultset by it's
indexed position rather than name.


   while(rs.next())
   {
        out.print("System ID:"+vm.getString(1)+"<BR>");
   }

or

      while (rs.next()) {
      testvalue = rs.getString(1);
      out.println ("System ID: " + testvalue + "<BR>");
      }

----------------------------------------------------------------------------
--------------------------------------

-----Original Message-----
From: Antonio Villafana [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 22, 1999 9:43 AM
To: [EMAIL PROTECTED]
Subject: ResultSet not giving up data


Firstly, let me show my code snippet:
----------------------------------------------------------------------------
----------------------
try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con = DriverManager.getConnection("jdbc:odbc:msoracle", "vahps",
"manager");
    stmt = con.createStatement();
    PreparedStatement pstmt = con.prepareStatement("SELECT systemid FROM
user_pass WHERE username = ? AND password = ?");

    synchronized (pstmt)
    {
      pstmt.clearParameters();
      pstmt.setString(1, name);
      pstmt.setString(2, passwd);
      rs = pstmt.executeQuery();
      while (rs.next()) {
      testvalue = rs.getString("systemid");
      out.println ("System ID: " + testvalue + "<BR>");
      }
    }
  }
  catch (ClassNotFoundException e) {
      out.println ("Cannot connect to db<BR>");
      out.println (e.getMessage() + "<BR>");
  }
  catch (SQLException e) {
    out.println ("SQLException caught: " + e.getMessage());
  }
----------------------------------------------------------------------------
----------------------------------

The line in bold should display the variable 'testvalue', even if it's just
one row of data returned. And, as you may have guessed it's not
working........ Can anyone tell me what I can do to fix this. I am
connecting to an Oracle DB using the jdbc-odbc driver from Microsuck. Which
I think is the culprit....... What do you think?

Antonio

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to