Hi,

I am using HTML, Servlets and Jdbc. I was able to send a query constructed
from HTML form to a servlet, was able to connect to the database, and
retrieve the results.
The strange part comes now..
My code works perfectly fine if i consider all columns as a string and
retrieve result as

rs.getString(col);

But if i try to retieve the data by checking its datatype , its not
displaying data with Date , Decimal or Numeric type.

and one more problem is how do i display the date along with time.
My database is in Oracle . The column datatype is Date. (includes time also)

switch(type) {
        case DATE:
          java.sql.Date date = rs.getDate(col);
           out.println("<td>" + date.toString() + "</td>");
          break;
        case Types.TIME:
          java.sql.Time time = rs.getTime(col);
          out.println("<td>" + time.toString() + "</td>");
          break;
        case Types.CHAR:
        case Types.VARCHAR:
        case Types.LONGVARCHAR:
          String str = rs.getString(col);
          out.println("<td>" + str + "</td>");
          break;
        case NUMERIC:
        case DECIMAL:
          java.math.BigDecimal numeric = rs.getBigDecimal(col, 5);
          out.println("<td>" + numeric.toString() + "</td>");
          break;

        }

Thanks
Srikanth Patibanda
IT Specialist
Entergy Corporation
Ph: (W)504-576-5444

___________________________________________________________________________
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