Solved

I want to get 16 digit number from Oracle but I get error

Posted on 2006-06-22
64
351 Views
Last Modified: 2008-01-09
I am using tomcat/JDBC to access Oracle.  

public int getNumber()
        throws MyException
    {
        Connection connection = null;
        MyException exception = null;
        Statement statement = null;
        ResultSet rs = null;
        long CustNum = 0;
       
        try
        {
            connection = DBConnection.getConnection();
            statement = connection.createStatement();
            String CardNum = "select CustID from evisa where ACCOUNT=208487";
                  rs = statement.executeQuery(CardNum);
            if(rs.next())
            {
               CustNum = rs.getLong("CustID");
                System.out.println(CustNum);
            }
            }
        catch(SQLException sqle)
        {
            exception = new MyException(HBError.get("DatabaseFailure.exCode"), HBError.get("DatabaseFailure.exDescription"), HBError.get("DatabaseFailure.exRecovery"), sqle);
        }
        finally
        {
            DBConnection.freeConnection(connection, statement, null);
            if(exception != null)
                throw exception;
        }
      return CustNum;
    }

I am getting error:
java.sql.SQLException: Numeric Overflow

becuase the CustID  is long number (16 digits) and.  I chnage my test account to be # 10 then my code worked.  I know my problem is the lrage number.
I tried to make int to Long  I get an error:

found   : long
required: int
        return CustNum;
               ^
1 error

how can I solve this problem

thanks
0
Comment
Question by:salasadi
  • 28
  • 19
  • 6
  • +2
64 Comments
 
LVL 92

Expert Comment

by:objects
ID: 16964382
>      return CustNum;

try:

     return (int) CustNum;
0
 

Author Comment

by:salasadi
ID: 16964393
so leave everything as is but change this line or make the variable as long in my decalration?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16964421
Try


BigDecimal CustNum = rs.getBigDecimal("CustID");
0
 

Author Comment

by:salasadi
ID: 16964457
now I am getting this:

found   : java.math.BigDecimal
required: int
        return CCustNum;

Thanks
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16964468
Well, obviously you'd have to *return* BigInteger instead
0
 

Author Comment

by:salasadi
ID: 16964514
when I did that I get the following:

found   : java.math.BigDecimal
required: java.math.BigInteger
        return  (BigInteger) CustNum;
                             ^
when I remove the ()

I get the following:

C:\com\test\getNumber.java:51: ';' expected
        return  BigInteger CardAcctNum;

0
 

Author Comment

by:salasadi
ID: 16964525
woops
it retruns  return  BigInteger CustNum; sorry for the typo
0
 
LVL 92

Expert Comment

by:objects
ID: 16964527
> public int getNumber()

change that to

public BigInteger getNumber()
0
 

Author Comment

by:salasadi
ID: 16964532
I did that but still
0
 

Author Comment

by:salasadi
ID: 16964547
now I am getting this error:

C:\com\test\getNumber.java:52: inconvertible types
found   : java.math.BigDecimal
required: java.math.BigInteger
        return  (BigInteger) CustNum;
                             ^
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16964550
Don't forget

BigInteger CustNum = null;

as well
0
 

Author Comment

by:salasadi
ID: 16964566
some it compliants about coverting the variable! even after I intil the BigInteger CustNum = null;
C:\com\test\getNumber.java:52: inconvertible types

Thanks
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16964634
There should be no conversion. Get rid of int altogether
0
 
LVL 12

Expert Comment

by:Giant2
ID: 16966532
Try to cast to int:
public int getNumber(){
...
return CustNum.intValue();
}

Bye, Giant.
0
 
LVL 12

Expert Comment

by:Giant2
ID: 16966538
if you need you can even use:
CustNum.floatValue()
or
CustNum.longValue()
...
See http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigDecimal.html
0
 

Author Comment

by:salasadi
ID: 16968392
Giant,
Thanks the casting did it.  I still have 1 problem.  some time CustNum retrun more then one value, and I need to pass the values to JSP page:

 Myclass test  = new myclass();

String CustNum = String.valueOf(test.getCustNumber());

husband and wife can both have the same account but diffrent Custnum, I need to get both custnum and give them the option to select which account to view.

Thanks again
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16968457
>>Thanks the casting did it.

How are you casting? int cannot hold the maximum 16 digit number

int i = 9999999999999999; // Won't compile
0
 

Author Comment

by:salasadi
ID: 16968675
I left the BigDecimal when I get the rs:

CustNum = rs.getBigDecimal("CustNum");

I cheange the retrun value to :

return  CustNum.intValue();


the output:
5194820009999090
0
 
LVL 12

Expert Comment

by:Giant2
ID: 16968681
You must change this piece of code:
  if(rs.next())
            {
               CustNum = rs.getLong("CustID");
                System.out.println(CustNum);
            }
            }

make a while cycle. In this manner you read all the record from your ResultSet.
After this the return variable of your method must be an array or a collection (Vector).
0
 

Author Comment

by:salasadi
ID: 16968715
can you give anexample please.  I still have a hard time to understand OO
0
 
LVL 12

Expert Comment

by:Giant2
ID: 16968718
Example:
public Vector getNumber(){
Vector ret=new Vector();
...
while (rs.next()){
CustNum=rs.getBigDecimal("CustNum");
System.out.println(CustNum);
ret.addElement(CustNum);
}
return ret;
}

Be sure that when you call this method you must cast correctly the element of the Vector.
Example:
Vector numbers=getNumber();
int value0=((BigDecimal)numbers.elementAt(0)).intValue;
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16968731
>>
I cheange the retrun value to :

return  CustNum.intValue();
>>


But you can't do that - that number will not fit in an int. See the following:

                  BigInteger bi = new BigInteger("5194820009999090");
                  System.out.println(bi.intValue());
                  System.out.println(bi);
0
 
LVL 12

Expert Comment

by:Giant2
ID: 16968741
Or, example 2:
public int[] getNumber(){
Vector ret=new Vector();
..
while (rs.next()){
CustNum=rs.getBigDecimal("CustNum");
System.out.println(CustNum);
ret.addElement(CustNum);
}
int[] retint=int[ret.size()];
for (int i=0;i<ret.size();i++){
retint[i]=((BigDecimal)ret.elementAt(i)).intValue();
}
return retint;
}

In this manner you can manage the int value "directly".
int[] values=getNumber();

Is it clear now?
Hope this could help you.
Bye, Giant.
0
 

Author Comment

by:salasadi
ID: 16969212
C:\com\test\getnumber.java:15: illegal start of expression
         public int[] getNumber()
         ^
0
 
LVL 12

Expert Comment

by:Giant2
ID: 16969235
check the { } parentesis. Maybe someone is not closed.
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 16969246
It would be more helpful if you post your entire code.

>> illegal start of expression

You have probably written that outside a class or inside a method.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16969260
>>retint[i]=((BigDecimal)ret.elementAt(i)).intValue();

You *can't* do that, for the reason i stated
0
 

Author Comment

by:salasadi
ID: 16969735
public class getNumber
{

    public getNumber()
    {
       public int[] getNumber()
             {
            Vector ret=new Vector();
        throws MyException
            {
                  Connection connection = null;
                  MyException exception = null;
                  Statement statement = null;
                  ResultSet rs = null;
                  BigDecimal CardAcctNum= null;        
        try
        {
            connection = DBConnection.getConnection();
            statement = connection.createStatement();
            String CardNum = "select Custnum from evisa where ACCOUNT=208487";
                  rs = statement.executeQuery(CardNum);
                  while (rs.next())
                        {
                        CardAcctNum=rs.getBigDecimal("Custnum");
                        System.out.println(CardAcctNum);
                        ret.addElement(CardAcctNum);
                        }
         catch(SQLException sqle)
        {
            exception = new MyException(HBError.get("DatabaseFailure.exCode"), HBError.get("DatabaseFailure.exDescription"), HBError.get("DatabaseFailure.exRecovery"), sqle);
        }
        finally
        {
            DBConnection.freeConnection(connection, statement, null);
            if(exception != null)
                throw exception;
        }
      return ret;
      }
  }
}
0
 

Author Comment

by:salasadi
ID: 16969780
sorry guys, here is the correct code:

public class getNumber
{

    public getNumber()
    {
       public int[] getCustnum()
             {
            Vector ret=new Vector();
        throws MyException
            {
                  Connection connection = null;
                  MyException exception = null;
                  Statement statement = null;
                  ResultSet rs = null;
                  BigDecimal CardAcctNum= null;        
        try
        {
            connection = DBConnection.getConnection();
            statement = connection.createStatement();
            String CardNum = "select Custnum from evisa where ACCOUNT=208487";
                  rs = statement.executeQuery(CardNum);
                  while (rs.next())
                        {
                        CardAcctNum=rs.getBigDecimal("Custnum");
                        System.out.println(CardAcctNum);
                        ret.addElement(CardAcctNum);
                        }
         catch(SQLException sqle)
        {
            exception = new MyException(HBError.get("DatabaseFailure.exCode"), HBError.get("DatabaseFailure.exDescription"), HBError.get("DatabaseFailure.exRecovery"), sqle);
        }
        finally
        {
            DBConnection.freeConnection(connection, statement, null);
            if(exception != null)
                throw exception;
        }
      return ret;
      }
  }
}
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16969793
You need to declare your method as

public Vector getNumber()
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 16969821
>> public getNumber()
>>     {
>>       public int[] getCustnum()
>>           {

You cannot have a method inside a method like I said earlier. Perhaps just remove the public int[] getCustnum () and { after it, and also one } in the end. Plus make your method public getNumber () as public Vector getNumber ()
0
 

Author Comment

by:salasadi
ID: 16970056
I am getting the following error:

C:\com\test\getNumber.java:15: illegal start of expression
        throws MyException
        ^

here is my final version of the class

public class getNumber
{
           public Vector getCustNumber()
      {
            Vector ret=new Vector();
        throws MyException
            {
                  Connection connection = null;
                  MyException exception = null;
                  Statement statement = null;
                  ResultSet rs = null;
                  BigDecimal CardAcctNum= null;        
        try
        {
            connection = DBConnection.getConnection();
            statement = connection.createStatement();
            String CustNum = "select Custnum from evisa where ACCOUNT=208487";
                  rs = statement.executeQuery(CustNum);
                  while (rs.next())
                        {
                        CustNum=rs.getBigDecimal("Custnum");
                        System.out.println(CustNum);
                        ret.addElement(CustNum);
                        }
            }
         catch(SQLException sqle)
        {
            exception = new MyException(HBError.get("DatabaseFailure.exCode"), HBError.get("DatabaseFailure.exDescription"), HBError.get("DatabaseFailure.exRecovery"), sqle);
        }
        finally
        {
            DBConnection.freeConnection(connection, statement, null);
            if(exception != null)
                throw exception;
        }
            }
      return ret;
      }
}
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 86

Expert Comment

by:CEHJ
ID: 16970070
>>throws MyException

should come directly after

>>public Vector getCustNumber()
0
 

Author Comment

by:salasadi
ID: 16970097
you mean it should look like this:

public Vector getCustNumber()
        Vector ret=new Vector();
        throws MyException
         {
          {
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16970107
public Vector getCustNumber() throws MyException
0
 

Author Comment

by:salasadi
ID: 16973110
yaeeeeeeeeeee, the class is compiled successfully and ready to be test it. thank you guys for your help.

how can call vector from JSP?

before the vector I have the following:

Myclass test  = new myclass();
String CustNum = String.valueOf(test.getCustNumber());

now I changed this to be:

static Vector keyw = new Vector(number);

0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16974320
In your JSP you need to do

<%
    Vector v = new getNumber().getCustNumber();
    // Now use it
%>

Incidentally, class names should begin with a capital letter or your code gets hard to read
0
 

Author Comment

by:salasadi
ID: 16976936
you mean getNumber should be GetNumber?  This is how I design my code in VB and ASP, someone told me that in Java the standard is to use small letter for the first letter of variable and class, but the second word in the name should be Uppercase.  

0
 
LVL 30

Expert Comment

by:Mayank S
ID: 16978164
No. In Java it is usually uppercase for the first character of a class name.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16978208
>>in Java the standard is to use small letter for the first letter of variable and class

Only for variables
0
 

Author Comment

by:salasadi
ID: 16992876
I can loop through my record in JSP, however, I want to be able to check each record to identified the CustNum. I catigorized each CustNum as Gold(G), Silver(S). base on the first 6 difit of the Custnum I can detrmine whether this Cust is G or S.  

I tried  to do the following but faild:

int CardAcctNum=(linteger)e.nextElement();

however, in my JSP I am able to display it as <%= e.nextElement()%>.  what is the data type of the e.nextElement()? and how can I assign it variable and check the first 6 digit?

Thanks
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16996217
Where is the Enumeration coming from - on what collection is it called and what's in it?
0
 

Author Comment

by:salasadi
ID: 16996479
CEHJ,
as you see that I am learning my way to do this.   I find out that I have 2 type custmer, and each have the starting digit diffrent. I tried to do if statement in JSP to detrmine what type of customer. however, the type of custmer is exist in my database and I can pull it in.   so I did add the field the vector.


rs = statement.executeQuery(CustNum);
               while (rs.next())
                    {
                    CustNum=rs.getBigDecimal("Custnum");
                    CType = rs.getString("Type")
           
                    ret.addElement(CustNum);
                    ret.addElement(CType);
                    }

this is working, but is this correct?  when I do v.size() the size show 2 record.  I look at it as 1 record diffrent field but Vector see it as 2 record.

when I retrieve it in JSP I do:

Vector v = new getNumber().getCustNumber();
Enumeration e = v.elements();
while (e.hasMoreElements()) {

%>
<td>Cust Number:</td><td align=left><%= e.nextElement()%></td><td>Type: <%= e.nextElement()%></td>

<%
}
%>

the output is:
Cust Number: 1111111111111112222    Type G

Please let me know if I am doing this correctly.

Thanks

0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16996521
I would use an Iterator. You're right - it's two values in one row. You need


Vector row = new Vector(2);                  
row.addElement(CustNum);
row.addElement(CType);
ret.addElement(row);

0
 

Author Comment

by:salasadi
ID: 16996547
and how retrieve it? would that change?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16999064
You retrieve it thus


Iterator i = ret.iterator();
while (i.hasNext()) {
    Vector row = (Vector)i.next();
    BigInteger custNum = (BigInteger)row.get(0);
    String name = (String)row.get(1);
}
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 16999445
You can also loop through:

for ( int i = 0, count = ret.size () ; i < count ; i ++ )
{
  Vector row = ( Vector ) ret.get ( i ) ;
}
0
 

Author Comment

by:salasadi
ID: 17001919
CEHJ
I tried to use this:
Vector v = new getNumber().getCustNumber();
Iterator i = ret.iterator();
while (i.hasNext()) {
    Vector row = (Vector)i.next();
    BigInteger custNum = (BigInteger)row.get(0);
    String name = (String)row.get(1);
}

but I am getting error:

Undefined variable or class name: ret
                Iterator i = ret.iterator();
0
 

Author Comment

by:salasadi
ID: 17005316
I change the code to be:
Vector v = new getNumber().getCustNumber();
Iterator i = v.iterator();
while (i.hasNext()) {
    Vector row = (Vector)i.next();
    BigInteger CardAcctNum = (BigInteger)row.get(0);
    String name = (String)row.get(1);
.......

I am getting the following error stack..

java.lang.ClassCastException

======================================

Message:
======================================
null

======================================
      
Localized Message:
======================================
null

======================================

Stack Trace:
======================================
java.lang.ClassCastException
      at org.apache.jsp.eVisa$jsp._jspService(eVisa$jsp.java:662)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
      at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
      at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
      at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
      at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
      at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
      at java.lang.Thread.run(Thread.java:534)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 17005406
>>getNumber().getCustNumber()

I thought that returned BigInteger ..?
0
 
LVL 92

Expert Comment

by:objects
ID: 17005883
if you are just displaying them then you may not even need to cast:

Vector v = new getNumber().getCustNumber();
Iterator i = v.iterator();
while (i.hasNext()) {
    Vector row = (Vector)i.next();
    Object CardAcctNum = row.get(0);
    Object name = row.get(1);
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 17008408
>> Vector row = (Vector)i.next();

What does i.next () return? A Vector, or something else?
0
 

Author Comment

by:salasadi
ID: 17010099
Mayankeagle

it should retrun 2 values, here is the how they have been added to the vector:

row.addElement(AcctNum);
row.addElement(CType);
ret.addElement(row);

0
 

Author Comment

by:salasadi
ID: 17010151
CHEJ,
the value retrun from the vector to JSP working just fine with the following:

if you are just displaying them then you may not even need to cast:

Vector v = new getNumber().getCustNumber();
Iterator i = v.iterator();
while (i.hasNext()) {
    Vector row = (Vector)i.next();
    Object CardAcctNum = row.get(0);
    Object name = row.get(1);

But I need to convert them to String and Integer so I can do the following:

1-display the number on my JSP like Credit card like Cust Number: ************44445
2-before displaying them I need to be able to send them include an XML string to be encrypted 3DES.  I don't think I will be able to encrypt object.

Thanks
0
 

Author Comment

by:salasadi
ID: 17010530
I was able to convert the name to string but not the CustNum:

BigInteger CustNum = (BigInteger)row.get(0); <-- this is not working
String name = (String)row.get(1); <--- this is working fine
0
 

Author Comment

by:salasadi
ID: 17011521
in my class the vector use BigDecimal not bigInteger.  but my problem now is that my vector retruns the first value stored in vector until the loop completed.

the following is print statment while I add to the vector:

while (rs.next())
       {
      CustNum=rs.getBigDecimal("CustNum");
      CType = rs.getString("TYPE");
      row.addElement(CustNum);
      row.addElement(CType);
      ret.addElement(row);
      System.out.println(CustNum);
     }
***********1119
***********2220
***********3331

but in my JSP:

Vector v = new getNumber().getCustNumber();
Iterator i = v.iterator();
while (i.hasNext()) {
    Vector row = (Vector)i.next();
    Object CustNum = row.get(0);
    Object name = row.get(1);
system.out.println(CustNum);
}
that retrun the wrong result:

***********1119
***********1119
***********1119

0
 
LVL 86

Accepted Solution

by:
CEHJ earned 50 total points
ID: 17013750
>>
row.addElement(CustNum);
     row.addElement(CType);
>>

You're not *creating* a Vector row in each iteration of the loop. You should be
0
 
LVL 92

Expert Comment

by:objects
ID: 17013818
> But I need to convert them to String and Integer so I can do the following:

you can just use the toString() method, no need to cast to do that.

Vector v = new getNumber().getCustNumber();
Iterator i = v.iterator();
while (i.hasNext()) {
    Vector row = (Vector)i.next();
    Object CardAcctNum = row.get(0);
    Object name = row.get(1);


...
out.println("Card#: "+CardAcctNum);
0
 

Author Comment

by:salasadi
ID: 17013843
so you want me to do the following:



while (rs.next())
       {
    Vector row=new Vector(2);
     CustNum=rs.getBigDecimal("CustNum");
     CType = rs.getString("TYPE");
     row.addElement(CustNum);
     row.addElement(CType);
     ret.addElement(row);
     System.out.println(CustNum);
     }
0
 

Author Comment

by:salasadi
ID: 17013852
Vector ret=new Vector();
while (rs.next())
       {
    Vector row=new Vector(2);
     CustNum=rs.getBigDecimal("CustNum");
     CType = rs.getString("TYPE");
     row.addElement(CustNum);
     row.addElement(CType);
     ret.addElement(row);
     System.out.println(CustNum);
     }

0
 
LVL 86

Expert Comment

by:CEHJ
ID: 17013862
That looks OK
0
 
LVL 92

Expert Comment

by:objects
ID: 17013910
you'd be better off using an ArrayList instead of a Vector, it'll give you better performance.
In fact an array would probably be more suitable as you know tyhe required size

List ret=new ArrayList();
while (rs.next())
       {
    Object[] row=new Object[2];
     CustNum=rs.getBigDecimal("CustNum");
     CType = rs.getString("TYPE");
     row[0] = CustNum;
     row[1] CType;
     ret.add(row);
     System.out.println(CustNum);
     }
0
 
LVL 92

Expert Comment

by:objects
ID: 17013928
then to read it:

List v = new getNumber().getCustNumber();
Iterator i = v.iterator();
while (i.hasNext()) {
    Object[] row = (Object[])i.next();
    String CardAcctNum = row[0].toString();
    String name = row[1].toString();

0
 
LVL 86

Expert Comment

by:CEHJ
ID: 17051746
:-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now