jump to navigation

JDBC Connection Strings for Coldfusion 6.1 / CFMX April 14, 2009

Posted by scoopseven in ColdFusion, Database, MySQL.
add a comment

If you’re trying to setup ColdFusion MX 6 with MySQL here’s how you setup the MySQL datasources.  In CF Administrator go to Datasources and Add a New datasource of type “Other”.  Enter your datasource name, username and password and the following fields like this:

JDBC URL: jdbc:mysql://192.168.1.100/DatabaseName
Driver Class: com.mysql.jdbc.Driver
Driver Name:MySQL Connector/J

Make sure you have the latest MySQL drivers installed too.

MySQL Reusing/Cached Connection Problem June 16, 2008

Posted by scoopseven in Database, MySQL.
add a comment

Problem with connecting to multiple databases within the same server is that every time you do:

mysql_connect(host, username, passwd);

it will reuse 'Resource id' for every connection, which means you will end with only one connection reference to avoid that do:

mysql_connect(host, username, passwd, true);

keeps all connections separate.

SQL Fun October 19, 2006

Posted by scoopseven in Database, MySQL.
add a comment

select a.*, ba.column1, bb.column1
from tablea a
join tableb ba on a.column1 = ba.column1 and ba.column2 = ’string’
join tableb bb on a.column1 = bb.column1 and bb.column2 = ’string’ and a.column2 = bb.column3
where a.column3 = ’string’

A couple of interesting things about this query. We’re matching up 1 row in table a with 2 rows in table b by aliasing table b in two different ways. We’re also using the “and” statement in our join, which is a neat trick.