cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aristedes Maniatis <...@maniatis.org>
Subject Re: Best practice to support multiple database vendors (DB2 or MSSQL Server)
Date Sat, 15 Oct 2011 00:28:50 GMT
On Sat Oct 15 11:21:59 2011, Aristedes Maniatis wrote:
> On Sat Oct 15 00:11:26 2011, Francois Eyl wrote:
>> Ok, that's what I was wondering, but wasn't sure because of all DBEntity attributes
that seem to be specific to database's vendor (CHAR vs NCHAR or DECIMAL vs NUMERIC).
>>
>> I'll try to connect to the MSSQL database using the appropriate JDBC driver and see.
>>
>> Thanks,
>> Francois
>>
>> On 14/10/2011 14:39, Aristedes Maniatis wrote:
>>> On Fri Oct 14 23:27:33 2011, Francois Eyl wrote:
>>>> Hi guys,
>>>>
>>>> I'm using Cayenne on my project in order to interface it with a third party
application through its database. Until now, the database was a DB2 (AS400), but the application
now supports MS SQL Server as well. So, I need to support both DB2 and MSSQL Server of course.
The databases schemas are stricly the same.
>>>>
>>>> I wonder what is the best way to achieve this, knowing that I already have
my datamap & datanode ready for DB2. I'd like to avoid redefining ObjectEntities by implementation
(one set of data for DB2 and another for SQLServer). How do you recommand me to proceed?
>>>>
>>>> Do I need to create an other DataDomain, and "duplicate" the definition stuff?
>>>>
>>>> Thanks in advance,
>>>> Francois
>>>>
>>>
>>> In most cases, there is absolutely nothing to do at all. Just connect to the
database of your choice and Cayenne will make it all work.
>>>
>
> They are the JDBC data types, not the SQL equivalents (often with the same name, but
not always).
>
>

Sorry, pressed send too quickly....

The best reference I've found is this one:

  
http://download.oracle.com/javase/1.3/docs/guide/jdbc/getstart/mapping.html

The main issues that I've found between databases have been around 
collation (case insensitive / sensitive makes a big difference to your 
queries). Timezones (for example mysql never stores them but defaults 
to a system timezone for the whole server). Indexing (eg. some 
databases let you have functional indices and others don't).

As for ongoing maintenance (upgrading the database, running scripts, 
etc) I've recently discovered liquibase and it is really rather nice 
for dealing with different databases without rewriting lots of SQL by 
hand.

Ari

-- 
-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

Mime
View raw message