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