aspose file tools*
The moose likes JDBC and the fly likes ClassCastException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "ClassCastException" Watch "ClassCastException" New topic
Author

ClassCastException

Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
Aaaaagh! I don't know if it's just because it's 5:00 on a Friday, or if I really have a problem, but I just can't seem to figure this out. I keep getting the ClassCastException: sun.jdbc.odbc.JdbcOdbcPreparedStatement cannot be cast to MVProductList whenever the following line of code runs:



Here's the code for the method that gets called to return the ArrayList as well as the class I created that I'm trying to cast the object to:



What in the heck have I done wrong? Thanks for any help anyone can give me!
Let me know if any further information is needed.


[ February 22, 2008: Message edited by: Jennifer Sohl ]

[ February 22, 2008: Message edited by: Jennifer Sohl ]

[ February 22, 2008: Message edited by: Jennifer Sohl ]
[ February 22, 2008: Message edited by: Jennifer Sohl ]
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
Your ArrayList contains a bunch of PreparedStatement objects, this is why the cast to MVProductList fails. You should be doing this instead.



SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
Oooooo boy..... I'm so sorry! I see what I did wrong now! I'm using the excuse that it was 5:00 on a Friday and I wasn't in my right mind!
Thanks for straightening me out!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ClassCastException