I am kind of surprised that lower case would work.
Databases like Oracle and DB2 seem to upper case names.
Brendan
Prabhudeva Chethan <[EMAIL PROTECTED]> on 08/31/99 02:52:46 AM
To: [EMAIL PROTECTED]
cc: (bcc: Brendan Johnston/Contractor/CF/CCI)
Subject: Re: Servlet / JDBC question
Hi,
Instead of using ....
if (rs.next()) {
returnValue = rs.getString("password");
}
use ..
while(rs.next()){
returnValue = rs.getString("password");
}
it should work...
all the best
cheers
chethan
"Campbell, Sean" <[EMAIL PROTECTED]> on 08/31/99 01:46:56 AM
Please respond to "A mailing list for discussion about Sun Microsystem's
Java
Servlet API Technology." <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
cc: (bcc: Prabhudeva Chethan/MLs/TCSBLORE/TCS)
Subject: Servlet / JDBC question
I have a Servlet / JDBC question.
I have a servlet that needs to retrieve data from an Oracle database using
Oracle version 8. I have debugged through and confirmed that I'm making the
connection - my problem is that when I try and retrieve records, I
consistently get an empty recordset, although I can confirm that the
recordset structure being returned is the correct structure of the table
I'm
querying. ( i.e. I query a 'Users' table, and when I create a
ResultSetMetaData object 'rsm' from the ResultSet 'rs' object and use the
rsm.getColumnName() method, I get the correct column names. I'm just not
sure why I'm not getting any data back.
I've inserted my test function below - any help would be greatly
apprectiated.
Connection con = null;
// this is the constructor of the class my servlet is
calling
public Data()
{
try{
DriverManager.registerDriver(new
oracle.jdbc.driver.OracleDriver() );
con =
DriverManager.getConnection("jdbc:oracle:thin:@ccdev:1521:ccct", "ccc",
"ccc");
//log.logError("got here", "Constructor", "");
System.out.println("got here");
System.out.println(testFunc());
}
catch(SQLException sqlErr)
{
//log.logError("Data Class", "Constructor",
sqlErr.getMessage());
System.out.println("error occurred");
}
// point class Data's ErrorLog object to the passed
object reference
//this.log = passedLog;
}
// the test function to test data retrieval
public String testFunc()
{
Statement stmt ;
ResultSet rs ;
String returnValue = "no records returned";
try
{
stmt = con.createStatement();
rs = stmt.executeQuery("select * from USERS");
ResultSetMetaData rsm = rs.getMetaData();
System.out.println(rsm.getColumnName(1) +' ' +
rsm.getColumnName(2) +' '+ rsm.getColumnName(3));
if (rs.next()) {
returnValue = rs.getString("password");
}
stmt.close();
con.close();
}
catch(SQLException sqlErr)
{
System.out.println("sql error");
System.out.println(sqlErr.getMessage());
//log.logError("Data Class", "validateUser",
sqlErr.getMessage());
}
return returnValue;
}
___________________________________________________________________________
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
___________________________________________________________________________
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
___________________________________________________________________________
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