This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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: 2849
    
  11

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?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Unsupported Data Conversion - How to solve?