Skip to main content
August 24, 2008
Question

DSN connection string problems

  • August 24, 2008
  • 1 reply
  • 604 views
my hosting service provided me with this connection string.

DRIVER={MySQL ODBC 3.51 Driver}; SERVER=p50mysql231.secureserver.net; PORT=3306; DATABASE=mgidata; USER=mgidata; PASSWORD='your password'; OPTION=0;

i can fill in all the blanks but i don't know how to us it in cfquery.
as best i can guess conectstring=" ...." no longer exesitis in cf8 . Can anyone help me with how to code this string in a cfquery.

I have tried the following but get no results.

<cfset Request.DSN = "mgidata"

<cfparam name="URL.TypeID" default="1">

<cfquery name="rsProducts" datasource="#Request.DSN#">

DRIVER={MySQL ODBC 3.51 Driver}; SERVER=p50mysql231.secureserver.net; PORT=3306; DATABASE=mgidata; USER=mgidata; PASSWORD='mypassword '; OPTION=0;



SELECT ProductID, ProductName, Pcode, Price, Summary, Description, Smallimage, Online
FROM products
WHERE Online = 1
AND products.TypeID = <cfqueryparam value="#URL.TypeID#" cfsqltype="cf_sql_numeric">
ORDER BY ProductName ASC

</cfquery>

Thank you for your help
This topic has been closed for replies.

1 reply

Inspiring
August 24, 2008
Never tried it but you might try this:

http://www.hostmysite.com/support/cfusion/dsnless/

<cfscript>

classLoader = createObject("java", "java.lang.Class");
classLoader.forName("sun.jdbc.odbc.JdbcOdbcDriver");
dm = createObject("java","java.sql.DriverManager");

con = dm.getConnection("DRIVER={MySQL ODBC 3.51 Driver};
SERVER=p50mysql231.secureserver.net; PORT=3306; DATABASE=mgidata;
USER=mgidata; PASSWORD='mypassword'; OPTION=0;");

st = con.createStatement();
rs = st.ExecuteQuery('SELECT ProductID, ProductName, Pcode, Price, Summary,
Description, Smallimage, Online FROM products WHERE Online = 1 AND
products.TypeID = <cfqueryparam value="#URL.TypeID#"
cfsqltype="cf_sql_numeric"> ORDER BY ProductName ASC');
q = createObject("java", "coldfusion.sql.QueryTable").init(rs);

</cfscript>


--
Ken Ford
Adobe Community Expert Dreamweaver/ColdFusion
Fordwebs, LLC
http://www.fordwebs.com


"mgiprofx" <webforumsuser@macromedia.com> wrote in message
news:g8rvul$ihg$1@forums.macromedia.com...
> my hosting service provided me with this connection string.
>
> DRIVER={MySQL ODBC 3.51 Driver}; SERVER=p50mysql231.secureserver.net;
> PORT=3306; DATABASE=mgidata; USER=mgidata; PASSWORD='your password';
> OPTION=0;
>
> i can fill in all the blanks but i don't know how to us it in cfquery.
> as best i can guess conectstring=" ...." no longer exesitis in cf8 . Can
> anyone help me with how to code this string in a cfquery.
>
> I have tried the following but get no results.
>
> <cfset Request.DSN = "mgidata"
>
> <cfparam name="URL.TypeID" default="1">
>
> <cfquery name="rsProducts" datasource="#Request.DSN#">
>
> DRIVER={MySQL ODBC 3.51 Driver}; SERVER=p50mysql231.secureserver.net;
> PORT=3306; DATABASE=mgidata; USER=mgidata; PASSWORD='mypassword ';
> OPTION=0;
>
>
>
> SELECT ProductID, ProductName, Pcode, Price, Summary, Description,
> Smallimage,
> Online
> FROM products
> WHERE Online = 1
> AND products.TypeID = <cfqueryparam value="#URL.TypeID#"
> cfsqltype="cf_sql_numeric">
> ORDER BY ProductName ASC
>
> </cfquery>
>
> Thank you for your help
>
>