Problems Inserting Via DB Link
Problems Inserting Via DB Link
- Subject: Problems Inserting Via DB Link
- From: "Shelli D. Orton" <email@hidden>
- Date: Tue, 12 Oct 2004 16:23:16 -0600
- Importance: Normal
Hi,
I'm having a weird problem using Oracle db links and synonyms in WO. Please
bear with the long post, but I wanted to make sure all the pieces were here.
I have multiple schemas across multiple dbs which all have a common table
definition. The table is set up as such:
CREATE TABLE log
(log_id NUMBER(12,0) NOT NULL,
log_control_number NUMBER(12,0) NOT NULL,
date DATE)
I need one application to administer the tables across all schemas/dbs. I
created a schema which has a synonym to each of the other schemas/dbs
logging tables set up on. For the synonyms which refer to a schema in a
different db, a db link was required. The others just had privileges to the
schema granted to this table. I created an eomodel in which each of the
synonyms is an entity. The index.emodeld is:
{
EOModelVersion = 2.1;
adaptorName = JDBC;
connectionDictionary = {
URL = "";
driver = oracle.jdbc.driver.OracleDriver;
password = "";
plugin = com.webobjects.jdbcadaptor.OraclePlugIn;
username = "";
};
entities = (
{className = DBOneLog; name = DBOneLog; },
{className = DBTwoLog; name = DBTwoLog; },
... etc ...
);
internalInfo = {};
}
and all the log table plist files look like (except for the className,
externalName and name attributes):
{
attributes = (
{columnName = DATE_APPLIED; name = dateApplied; prototypeName =
date; },
{columnName = LOG_ID; name = logId; prototypeName = id; },
{columnName = LOG_CONTORL_NUMBER; name = logControlNumber;
prototypeName = id; }
);
className = DBOneLog;
classProperties = (logId, logControlNumber, dateApplied, comments,
appliedBy);
externalName = DB_ONE_LOG;
internalInfo = {_nameInObjectStore = DB_ONE_LOG; };
name = DBOneLog;
primaryKeyAttributes = (logId);
}
We're using prototypes and they are set up as:
{
attributes = (
{
allowsNull = Y;
externalType = DATE;
name = date;
valueClassName = NSCalendarDate;
},
{
columnName = "";
externalType = NUMBER;
name = id;
precision = 12;
scale = 20;
valueClassName = NSNumber;
valueType = l;
},
);
className = EOGenericRecord;
classProperties = (
id,
date
);
externalName = EOPrototypes;
fetchSpecificationDictionary = {};
name = EOPrototypes;
primaryKeyAttributes = (id);
}
I can retrieve/view data from each of the tables without problem. However,
for the schemas/tables located in one of the dbs which uses a db link, I
cannot insert new records, instead I get the following exceptions:
EvaluateExpression failed: : Next exception:SQL State:72000 -- error code:
1461 -- msg: ORA-01461: can bind a LONG value only for insert into a LONG
column ORA-02063: preceding line from <DB_LINK_NAME>
So it looks like when inserting, the EOModel is changing either the datatype
of the log_id or the log_control_number to a LONG datatype. I don't know
why/how it would do this, especially since it doesn't it do it to any of the
other tables in the other schemas/dbs, including those that use a db link.
If I grab the sql from the logs and run it in a sql script, it works fine.
I created a little java function that inserted a record into one of the
"broken" dbs by using the java.sql package classes and was able to insert
without problems from the same WO component. The Oracle versions on the
machines are the same. I can find no property differences between how the
links, synonyms, eomodel entities etc. are set up.
Has anyone ever come across anything similar to this? Any suggestions?
Thanks for all help!
Shelli
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden