Re: converting from openbase to oracle
Re: converting from openbase to oracle
- Subject: Re: converting from openbase to oracle
- From: wojingo <email@hidden>
- Date: Fri, 17 Mar 2006 18:30:58 +1030
Hi Dave,
On Mar 16, 2006, at 10:06 PM, Dave Elsner wrote:
Hi,
In the process of migrating all the data from one of our Openbase 8
DB to Oracle 9.
To do this I cloned the original EOModel and changed the cloned model
to point to the new Oracle 9 DB, and changed all the column data type
to the appropriate kind. e.g. char > VARCHAR2 , text > CLOB, etc
I then run my code
EOEnterpriseObject oldObject = (EOEnterpriseObject)
anEnumerator.nextElement();
EOEnterpriseObject newObject = EOUtilities.createAndInsertInstance
(anEditingContext, aNewEntityName);
newObject.takeValuesFromDictionary( (NSDictionary)
oldObject.valuesForKeys(oldObject.attributeKeys()) );
This works fine for all tables in the DB and all rows until it
reaches a CLOB item and I get the following error:
evaluateExpression: <com.webobjects.jdbcadaptor.OraclePlugIn
$OracleExpression: "INSERT INTO EXTERN_DTLS(personID,
currentPositions, biography, qualifications, awards,
professionalActivites, researchInterests) VALUES (?, EMPTY_CLOB(),
NULL, EMPTY_CLOB(), NULL, NULL, EMPTY_CLOB())" withBindings: 1:2020
(personID)>
<main> evaluateExpression:
<com.webobjects.jdbcadaptor.OraclePlugIn$OracleExpression: "SELECT
t0.currentPositions, t0.qualifications, t0.researchInterests FROM
EXTERN_DTLS t0 WHERE t0.personID = ? FOR UPDATE" withBindings:
1:2020(personID)>
Check that you have the correct version of the oracle drivers.
I think classes12.zip is ok but not 100% sure. I use oracle 8 but the
same frameworks and eomodels have been used on oracle 10 without any
problems AFAIK (and using the classes12.zip jdbc driver).
Also you might want to consider writing a small test app that just does
and insert and fetch of a binary object. Creating a brand new eomodel
with a binary and a single id field and work with that. Insert and fetch
in the application constructor or something so you dont have to hit the
applications first page to test it.
Just a thought, but it will probably make life easier.
I think Oracle recommends to use Blob instead of long raw. But I have
frameworks that use both. The only difference is the exteralType in the
plist file(and the attribute in the DB obviously).
Here are a couple of files from one of the models I have.
Comparing your eomodel files with these might help.
An eomodel plist file for a barcode image:
{
attributes = (
{
columnName = ID;
externalType = NUMBER;
name = id;
valueClassName = NSNumber;
valueType = i;
width = 10;
},
{
columnName = BINARY_DATA;
externalType = "LONG RAW";
name = binaryData;
valueClassName = NSData;
}
);
attributesUsedForLocking = (
id,
binaryData
);
className = BarcodeImage;
classProperties = (
id,
binaryData
);
externalName = BARCODE_IMAGE;
fetchSpecificationDictionary = {};
name = BarcodeImage;
primaryKeyAttributes = (id);
relationships = ();
}
the corresponding index.eomodeld file:
{
EOModelVersion = 2.1;
adaptorName = JDBC;
connectionDictionary = {
URL = "jdbc:oracle:thin:@internal.asdf.com:1521:dev";
driver = "";
jdbc2Info = {
ANSI92_CONFORMANCE = ANSI92EntryLevel;
DBMS_NAME = Oracle;
DRIVER_NAME = "Oracle JDBC driver";
DRIVER_VER = 8.1.7.0.0;
IDENTIFIER_QUOTE_STRING = "\"";
NON_NULLABLE_COLUMNS = T;
STRING_FUNCTIONS = "CHR, INITCAP, LOWER, LPAD, LTRIM,
NLS,_INITCAP, NLS,_LOWER, NLS,_UPPER, REPLACE, RPAD, RTRIM, SOUNDEX,
SUBSTR, SUBSTRB, TRANSLATE, UPPER, ASCII, INSTR, INSTRB, LENGTH,
LENGTHB, NLSSORT, CHARTOROWID, CONVERT, HEXTORAW, RAWTOHEX, ROWIDTOCHAR,
TO_CHAR, TO_DATE, TO_LABEL, TO_MULTI_BYTE, TO_NUMBER, TO_SINGLE_BYTE";
typeInfo = {
BLOB = {
createParams = 0;
defaultJDBCType = (BLOB);
isNullable = T;
isSearchable = F;
maxScale = 0;
minScale = 0;
precision = 2147483647;
};
CHAR = {
createParams = 1;
defaultJDBCType = (CHAR);
isNullable = T;
isSearchable = T;
maxScale = 0;
minScale = 0;
precision = 2000;
};
CLOB = {
createParams = 0;
defaultJDBCType = (CLOB);
isNullable = T;
isSearchable = F;
maxScale = 0;
minScale = 0;
precision = 2147483647;
};
DATE = {
createParams = 0;
defaultJDBCType = (TIMESTAMP);
isNullable = T;
isSearchable = T;
maxScale = 0;
minScale = 0;
precision = 7;
};
FLOAT = {
createParams = 0;
defaultJDBCType = (FLOAT);
isNullable = T;
isSearchable = T;
maxScale = 127;
minScale = "-84";
precision = 63;
};
LONG = {
createParams = 0;
defaultJDBCType = ("LONG VARCHAR");
isNullable = T;
isSearchable = F;
maxScale = 0;
minScale = 0;
precision = 2147483647;
};
"LONG RAW" = {
createParams = 0;
defaultJDBCType = ("LONG VARBINARY");
isNullable = T;
isSearchable = F;
maxScale = 0;
minScale = 0;
precision = 2147483647;
};
NUMBER = {
createParams = 2;
defaultJDBCType =
(BIT,TINYINT,BIGINT,NUMERIC,INTEGER,SMALLINT);
isNullable = T;
isSearchable = T;
maxScale = 127;
minScale = "-84";
precision = 38;
};
RAW = {
createParams = 1;
defaultJDBCType = (VARBINARY);
isNullable = T;
isSearchable = T;
maxScale = 0;
minScale = 0;
precision = 2000;
};
REAL = {
createParams = 0;
defaultJDBCType = (REAL);
isNullable = T;
isSearchable = T;
maxScale = 127;
minScale = "-84";
precision = 63;
};
VARCHAR2 = {
createParams = 1;
defaultJDBCType = (VARCHAR);
isNullable = T;
isSearchable = T;
maxScale = 0;
minScale = 0;
precision = 4000;
};
};
};
password = password;
plugin = "";
username = username;
};
entities = (
{className = BarcodeImage; name = BarcodeImage; }
);
}
HTH.
regards,
- shaun
_______________________________________________
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