Hi,

here is the query mechanism

ps = conn.prepareStatement("select * from pubs.dbo.authors");
rsQ = ps.executeQuery();

query = CreateObject("java", "coldfusion.sql.QueryTable");
query = query.init(rsQ);
dump(query);


you have to know what drivers are installed (or distribute the jars) and you
can't use the cf ones directly from cf there is some sort of licensing
restriction.

Elliot



"Steve Onnis" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> Where do you pass the query into it?
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Elliot Russo
> Sent: Tuesday, January 25, 2005 6:23 PM
> To: CFAussie Mailing List
> Subject: [cfaussie] Re: Dynamic DB connections
>
> Hi steve,
>
> here is some code i have used from cfmx to get a connection to a database
>
> <cffunction name="dump">
>  <cfargument name="var">
>  <cfdump var="#var#">
> </cffunction>
>
> <cfscript>
>
> DriverManager = CreateObject("java",
> "com.microsoft.jdbc.sqlserver.SQLServerDriver");
> DriverManager.init();
>
> conn = DriverManager.connect(javacast("string",
>
"jdbc:microsoft:sqlserver://my_server_name:1433;User=sa;Password=my_password
> "), CreateObject("java", "java.util.Properties").init());
>
> //example
> mdata = conn.getMetaData();
> rsCatalog = mdata.getCatalogs();
>
> query = CreateObject("java", "coldfusion.sql.QueryTable");
> query = query.init(rsCatalog);
>
> dump(query);
> </cfscript>
>
>
> "Steve Onnis" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> >
> > Ello ello ello
> >
> > Is there any way at all to create a dynamic connection to a database?  I
> know you can't use the connection string attribute now so
> > was wondering if anyone knows of another way.
> >
> > I guess you could create a datasource on the fly using the connection
> string but there must be an easier way
> >
> > Steve
> >
> >
> >
>
>
>
> ---
> You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to [EMAIL PROTECTED]
> Aussie Macromedia Developers: http://lists.daemon.com.au/
>
>
>



---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to