Hi,

        Although it's very late to answer your query. I also don't know whether you
still know the solution or not. But this part of a big program will answer
all your queries. This is within a switch of type of a column.



case Types.LONGVARCHAR:
{
        if (isPrimaryKey[j])
                throw new Exception("case Types.LONGVARCHAR:    {...\nCan't handle 
primary
key of datatype LONG (ORACLE) or TEXT (SQL Server).");
        BufferedReader br = new BufferedReader(new
InputStreamReader(rs.getAsciiStream(j)));
        String columnValue = br.readLine();
        if (columnValue != null)
        {
                while (true)


                        String s = br.readLine();

                        if (s == null)
                                break;

                        if (dest == Oracle)
                                columnValue += "' || CHR(10) || '"+toString(s);
                        else if (dest == SQLServer)
                                columnValue += "' + CHAR(13) + CHAR(10) + \n           
         '"+toString(s);
                        else
                                throw new Exception("\ncase Types.LONGVARCHAR: 
{...\n\"dest\" neither
Oracle nor SQLServer.");

                        if (s.trim().equals(""))
                                columnValue += " ";
                        }
                }

        if (columnValue == null)
                valuesString += "NULL";
        else
                valuesString += "'"+columnValue+"'";
                                                                                       
                                         break;
                                                                                       
                                 }

Regards,
A_S_H_U_T_O_S_H     P_U_N_H_A_N_I
KLG Systel Ltd., Electronic City, Gurgaon.
Ph: 0124-345962/63, 346886/87, 347573/74
Fax: 91-124-346355
E-Mail: [EMAIL PROTECTED]
<http://www.klgsystel.com>


-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Hitesh panchal
Sent: Thursday, June 15, 2000 8:36 PM
To: [EMAIL PROTECTED]
Subject: Re: [SQL question for long data type]


helen ge <[EMAIL PROTECTED]> wrote:
Hi,
may be this is a simple question, but I stucked here.

I have an oracle table which has a long data type field named body.
in my java code I created a SQL and try to get that long field througn
ResultSet and print it out as a String.


String body = rs.getString("body");--- does not work.
long body = rs.getLong("body");--- does not work.
String body = (String) rs.getObject("body");-- not work.

How can I correctly doing that?

someone help me?

Thanks in advance

Helen

 if it is in jsp
  <%= rs.getLong("body")%>
 or   long lb =  rs.getLong(int columnIndex)
      long lb =  rs.getLong(String columnName)


   and then also it wont works the take resultsetmetadat object
 by  take the datatype by it and pass it to switch case having diff get
statemets




________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to