Hi Jacopo,
I saw this note before, but I don't want to install a trigger on the client
database. I would like
to fix the cause and not the problem!!
I implemented a solution based on the design hibernate is using. In
hibernate you have to define
in a xml file wich dialect you're using. We don't have this definition, but
I'm using the drivername
declared in the entityengine.xml to find the dialect to use.
In GenericDAO I read the corresponding dialect instance and every value is
passed through this dialect
instance (every dialect implements a method "toSqlString(Object value)").
The where string values are build in the SqlJdbcUtil class, so that's the
point where I finally use my
dialect class.
If you look at SqlJdbcUtil.addValueSingle(..):
buffer.append('\'').append(value).append('\'');
is now:
Object sqlValue = value;
if (dialect != null) {
sqlValue = dialect.toSqlString(value);
}
buffer.append(sqlValue);
The instance dialect is passed as a parameter to the method. At the moment I
only implemented a
OracleDialect class. All the other drivers are using the default dialect
wich is returning:
return '\'' +value '\'';
Seems to work fine...
Michael
Jacopo Cappellato wrote:
>
> Michael,
>
> have a look at these notes:
>
> http://docs.ofbiz.org/x/gAI
>
> let me know if they help you and if you have additional suggestions for
> OFBiz&Oracle
>
> Jacopo
>
> Michael Imhof wrote:
>> We developed our OfBiz application on a mysql database and all works
>> fine.
>> Deploying the application on the client server with Oracle database I got
>> exceptions with
>> the sandbox:
>> "ORA-01861: literal does not match format string"
>>
>> This is a problem with the date conversion.
>> On MySql, the following SQL Statement is used
>> SELECT .... WHERE RUN_TIME <= '2007-05-15 07:45:10.875' AND ....
>> Using an Oracle database, this statement is wrong and generates the
>> ORA-01861 error.
>> The statement should look like this:
>> SELECT .... WHERE RUN_TIME <= TO_DATE('2007-05-15 07:45:10',
>> 'YYYY-MM-DD HH:MI:SS') AND ....
>>
>> It works fine if the query is generated with the PreparedStatement of the
>> driver.
>> But why the hell is this not always the case???
>>
>> The call of
>> delegator.storeByCondition("JobSandbox", updateFields,
>> mainCondition);
>> is creating a where statement BY HAND!!! (And of course this statement is
>> not generic and does not
>> work with a oracle database).
>>
>> Michael
>>
>> PS: Probably I will fix this in my ofbiz version, but that will be a big
>> redesign (I don't think I can create a patch
>> out of this. It's a redesign!).
>
>
>
>
--
View this message in context:
http://www.nabble.com/Problems-with-Oracle-Database-tf3756432.html#a10618443
Sent from the OFBiz - User mailing list archive at Nabble.com.