This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes JDBC and the fly likes Unsupported Data Conversion - How to solve? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Unsupported Data Conversion - How to solve?" Watch "Unsupported Data Conversion - How to solve?" New topic
Author

Unsupported Data Conversion - How to solve?

Fergus Red
Ranch Hand

Joined: Apr 25, 2002
Posts: 42
Hi,
I am trying to change from a jdbc-odbc driver to a jdbc driver for a web sire which is created using EJB architecture.
I am changing to a SQLServer jdbc driver and as my web site is running and deployed off a JRUN 3.1 application server, I am moving to use a jdbc:jrun:sqlserver jdbc driver.
I have created a datasource using this driver and deployed my changes to the server.
My web site seems to run fine in reading data from the database but I get an error when i try to connect from a session bean to a create method in one of my entity beans. The error I get is an "[JRun][SQLServer JDBC]Unsupported Data Conversion error"

My error occurs at the following code:

try {
contactEvent = contactEventHome.create(sessionKey, sessionKey, interactiveItemKey, zccountKey, treatKey,
methodOfContact, promoCode, direction);
return ((ContactEventPK)contactEvent.getPrimaryKey()).contactEventKey;
}
catch (CreateException ce) {
throw new EJBException("ContactSys - failed to create new ContactEvent");
}
}catch (java.rmi.RemoteException re) {
throw new javax.ejb.EJBException(re);
}
The error is thrown within the "catch (java.rmi.RemoteException re) {" statement.

DO you know why my error is occuring, and how I can solve this?
Cheers in Advance.
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2771
    
  10

When you create an entity bean, you create an equivalent record in your database. I think what your error means is you have defined one of the fields in that object to have a type that is incompatible with the type of the corresponding database field. For example, you have a customerID field in the entity bean defined as an integer, but you map it to CUST_ID in the database, which is a String.
Fergus Red
Ranch Hand

Joined: Apr 25, 2002
Posts: 42
Cheers for the help. I'll try and determine compatibality between my database and driver now.
Fergus Red
Ranch Hand

Joined: Apr 25, 2002
Posts: 42
I found out that my unsupported Data Conversion occurs as a result of trying to return an integer from my Create ststement.
I am trying to reurn the key from the database but cannot seem to do so without recieving an error.
Does anyone have any more suggestions on why thiw may be occuring and how to solve it?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unsupported Data Conversion - How to solve?
 
Similar Threads
Remote Exception in EJB with MySQL
getting re-read error
(JTA) UserTransaction not working w JRUN 3.1, JRun JTS Driver question
JRun Servlet using UserTransaction
How to convert Blob Type back to File