Yo Jennifer,
Ur problem is that u are returning the result set instead of a specific
field.Hence the return value is the internal Result set referential code of
Java. Try rs.getString("Field name in your table") and get it.
Alternatively u can also get the integer value with the position of the ID
field in your table (as u are doing "get *" op) . What i mean is if u have 3
fields being returned and ID is the second field, try rs.getString(2);
Eg. If ur table column name is ID,
Use:
output.print("<H2>Your Id that you need for future
logins is " + rs.getString(ID) + "<BR> Please keep it safely</H2>");
or
output.print("<H2>Your Id that you need for future
logins is " + rs .getString(2)+ "<BR> Please keep it safely</H2>");
Hope this solves your problem. !!!!
Regards,
V.Vijayaraghavan
Satyam Computers Services Limited,
Financial Services Division,
If at first you don't succeed, destroy all evidence that you tried.
-----Original Message-----
From: Jennifer Feeney [SMTP:[EMAIL PROTECTED]]
Sent: Monday, February 05, 2001 12:51 AM
To: [EMAIL PROTECTED]
Subject: sun.jdbc.odbc.JdbcOdbcResultSet@4cd80046 ERROR!
Hi all,
I would really appreciate any help with this problem,
so thanks to anyone that responds to this question in advance..Thank
you!
Description:
----------------------------------------------------------
I have build a servlet that allows people to register themselves
so that they can enter my site to download an application(to their
PDA) that will allow them to do their shopping via their PDA.....
That part works fine....JDBC_ODBC bridge, establishing a connectin
with the darabase etc, and generating an ID number for each person
that registers, all works fine.
Problem:
-----------------------------------------------------------------
When they register, my servlet responds with a thank you messgae if
registration was successful, HOWEVER, I also want the servlet to
return to them, their uniques ID number, that they will need for
login, this number is contained in an "Id" field in my database, and
I want they servlet to pass this back to the user when i pass back
the thank you message.
BUT, what actuall comes back is the following.
"Your Id that you need for future logins is
sun.jdbc.odbc.JdbcOdbcResultSet@4cd80046
Please keep it safely
Thank you Tom for registering."
so it is returning "sun.jdbc.odbc.JdbcOdbcResultSet@4cd80046" instead
of the actual Id number. The "@4cd80046" changes every time.
I get no error during compilation or during the connection to the
database......
Could anybody please explain what I am doing wrong?
Or could anyone pass on a snippet of code that they use to return
info from a database and display it on a html page to the user, I
have seen code that returns the infor to a Java GUI, but not to a
html page.
Below Is the code that I am using in my servlet, that causes the
problem I have explained above.
boolean success = insertIntoDB(
"'" + email + "','" + firstName + "','" + lastName + "','" +
telNo + "','" + address1 + "','" + address2 +
"','" + county + "','" + country + "','" +
(String.valueOf(IdNo)) + "','" + password + "'");
if ( success ){
try{
Statement statement =
connection.createStatement();
String query = "SELECT * FROM Details ";
output.print("\nSending Query: " +
connection.nativeSQL( query ) + "\n" );
ResultSet rs = statement.executeQuery(
query );
output.print("<H2>Your Id that you need for future
logins is " + rs + "<BR> Please keep it safely</H2>");
statement.close();
}
catch ( SQLException sqlex ){
sqlex.printStackTrace();
//output.append( sqlex.toString() );
}
output.print( "<H2>Thank you " + firstName +
" for registering.<BR><BR> <A
Href = Login.html> Login In </A></H2>");
}
else
output.print( "<H2>An error occurred. " +
"Please try again later.</H2>" );
output.close();
I would greatly appreciate any help on this one!
Regards.
Jennifer
_____________________________________
Get your free E-mail at http://www.ireland.com
___________________________________________________________________________
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