• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Database Independent

New Here ,
May 30, 2007 May 30, 2007

Copy link to clipboard

Copied

I have created a Coldfusion application. I need for the users to use different database connections besides just SQL Server(our database at the office where I work). Can you configure Coldfusion to use any other database besides just SQL Server. We need to tell Coldfusion which database the user is using, and program ahead.

Thank you in advance.
TOPICS
Advanced techniques

Views

718

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
May 30, 2007 May 30, 2007

Copy link to clipboard

Copied

It's not as simple as changing the datasource. SQL, while a standard, is implemented and supported differently by different database servers.

Your best bet is to use an ORM framework that supports the different database servers you envision your users wanting to use.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
May 31, 2007 May 31, 2007

Copy link to clipboard

Copied

You could design your application around an ODBC connection. You will take a slight performance hit when using OBDC vs a database specific driver.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
May 31, 2007 May 31, 2007

Copy link to clipboard

Copied

quote:

You could design your application around an ODBC connection.
Not so much really. The "connection" isn't really the issue but, as Kronin555 pointed out, there are different "flavors" of SQL, so you would have to make your code as vanilla as possible, which would mean that you would not be able to take any advantage of your particular DBMS and its built in functions. Things like string and date functions differ widely between databases, and you would have a very hard time making your CF code portable.

The only practical way that you might be able to make your CF code more portable would be to strictly use stored procedures instead of imbedded SQL so that all of your SQL would be contained in your particular database, and you would create "standard" procedure calls in CF with cfstoredproc, cfprocparam, and cfprocresult tags. In other words, your proc calls would just need to pass parameters to and from your stored procedures, and possibly return result sets, and these proc calls could be standard in your CF code, with the stored procedures behind the scenes designed for the applicable DBMS. T-SQL in SQL Server and PL/SQL in Oracle are very robust and even MySQL has stored procedure capability (depending on the version).

Phil

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 31, 2007 May 31, 2007

Copy link to clipboard

Copied

quote:

Originally posted by: tapping
I have created a Coldfusion application. I need for the users to use different database connections besides just SQL Server(our database at the office where I work). Can you configure Coldfusion to use any other database besides just SQL Server. We need to tell Coldfusion which database the user is using, and program ahead.

Thank you in advance.

Are you talking about a general situation where you want to be able to connect to more than one database server, or are you talking about a specific situation where you have similar databases using different db software, such as oracle, sybase, etc?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 01, 2007 Jun 01, 2007

Copy link to clipboard

Copied

We will have the following situation:

Standard configuration is Coldfusion accessing SQL Server via DSN setup in Coldfusion.
We need to support users who may want to use MySQL, SyBase AnyWhere, or Oracle.

Can we tell ColdFusion via a configuration item which database type to use? Or do we need to configure this when we install coldfusion at our customer’s location?



Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 01, 2007 Jun 01, 2007

Copy link to clipboard

Copied

LATEST
quote:

Originally posted by: tapping
We will have the following situation:

Standard configuration is Coldfusion accessing SQL Server via DSN setup in Coldfusion.
We need to support users who may want to use MySQL, SyBase AnyWhere, or Oracle.

Can we tell ColdFusion via a configuration item which database type to use? Or do we need to configure this when we install coldfusion at our customer’s location?


As long as you can connect to a db and have the appropriate permissions, you can have as many datasources on your server as you want, and have as many different types of databases as you want. We have 45 data sources on our server and at least 5 database types.


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 01, 2007 Jun 01, 2007

Copy link to clipboard

Copied

tapping wrote:
Can we tell ColdFusion via a configuration item which database type to
use? Or do we need to configure this when we install coldfusion at our
customer?s location?

Have you investigated the Administration API that allows one to
programmaticly control some of the cfide/Administrator settings. I have
not done this, but it is my understanding that it should allow the
programmatic setting of DSNs.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation