web_toes said:
I'm trying to access the Cold Fusion DSN from Java in MX 6.1. I've done it in 6.0 before by using the InitialContext object and doing a lookup on the DSN name...but it's not able to find the binding in 6.1. Has anyone else done this?
--Michael
DSNs are only for people who are new to CFMX. Since CFMX is now a J2EE app they stopped using them. The DSNs inside the Admin are just a easier way the edit an XML file and makes it fool proof.
Without downloading anything try to follow the example given
http://www.geocities.com/empiricallyspeaking/MySQL.html
the Object:
<cfset Object_test = CreateObject("java", "mySQL_connection_test")>
the connection:
<cfset connected_I_hope = Object_test.connect
("mysql.jodoshared.com", <!--- host --->
"3306", <!--- port --->
"helloworld_db", <!--- database --->
"your_user", <!--- user_name ---->
"your_password" <!--- password ---->)>
myData now has your data
<cfset myData = connected_I_hope.executeQuery("Select * from this_table")>
You need next() because the first row is metadata
<cfset myData.next()>
<cfset Data = myData.getString("ColumnName")>
Done. Of course you can use getInt(1) or any of the other
50 methods.