multiple orm datasources - different database types

68 views
Skip to first unread message

Jeremy R. DeYoung

unread,
Feb 6, 2016, 7:49:12 PM2/6/16
to Lucee
How do I specify multiple orm dialects? I'm running two different kinds of database servers. One is mysql and the other is microsoft sql server. How do I get Lucee to read both database's dialects?

Jeremy R DeYoung

unread,
Feb 10, 2016, 1:47:04 PM2/10/16
to Lucee
anyone know how to handle multiple dialects in lucee for two database types? MySQL and Microsoft SQL Server.

I tried something like this in my application.cfc but it does not respect this.

this.datasources["a"] = {
 class: 'com.microsoft.jdbc.sqlserver.SQLServerDriver'
, connectionString: 'jdbc:sqlserver://0.0.0.0:1433;DATABASENAME=data;sendStringParametersAsUnicode=true;SelectMethod=direct;useUnicode=true;characterEncoding=UTF-8'
, connectionLimit:25 // default:-1
, connectionTimeout:1 // default: 1; unit: seconds
                        , dialect: "MicrosoftSQLServer"
};
        this.datasources["b"] = {
                  class: 'org.gjt.mm.mysql.Driver'
                , connectionString: 'jdbc:mysql://0.0.0.0:3306/data?useUnicode=true&characterEncoding=UTF-8&useLegacyDatetimeCode=true'
                , dialect: "MySQLwithInnoDB"
        };

It only understands this.ormSettings.dialect = "MicrosoftSQLServer" which creates a problem when having two database types.


I ask this question b/c I'm trying to fix another issue in a previous email i sent a few minutes ago with database driver returning random errors. So my thought was to upgrade the driver to the latest ODBC driver.

When I reference the new JDBC driver, and Lucee is unable to detect the dialect type automatically.

My hope is the error I was getting is caused by the driver and NOT lucee.

Chris Blackwell

unread,
Feb 12, 2016, 6:32:11 AM2/12/16
to Lucee
I'm guessing that Lucee will not support this. Its just going to get way too messy.  The ORM setup in lucee is going to create all the associated hibernate underpinnings for you, including things like the Transaction Manger. To use two different datasources you'd need two separate transaction managers, so when you wrap ORM calls in a transaction{} its going to get really messy.  

It may of been fixed, but Lucee did have issues using ORM and SQL inside the same transaction so doing multiple ORM dialects is likely never going to happen.


--
Love Lucee? Become a supporter and be part of the Lucee project today! - http://lucee.org/supporters/become-a-supporter.html
---
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/CAFy17u%3DdS%2BckoPOeJ%3DXAOLsRok6YfK0SDeiMXriuhx9-xh%3Dq8g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages