Thanks for all the suggestions, I think after much fiddling, my conclusion is
there is no "proper" way this can be done.
I can setup a dsn no problem through the administrator, but dynamic JNDI
datasources through the AdminAPI seems unsupported.
Here is the code I'm using that seems close but does not cut it (cf8):
<cfset
createObject("component","cfide.adminapi.administrator").login(#password#)>
<cfset dsManager=createObject("component","CFIDE.adminapi.datasource")>
<cfinvoke component="#dsManager#" method="setOther">
<cfinvokeargument name="name" value="jndidatasource">
<cfinvokeargument name="URL" value="#JNDIURL#">
<cfinvokeargument name="class" value="jndi"><!--- have also tried ""
--->
<cfinvokeargument name="driver" value="jndi">
</cfinvoke>
Here is the stack trace I get:
java.lang.NullPointerException at
javax.naming.InitialContext.getURLScheme(InitialContext.java:228) at
javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:277) at
javax.naming.InitialContext.lookup(InitialContext.java:351) at
coldfusion.sql.JNDIUtils.lookup(JNDIUtils.java:46) at
coldfusion.sql.JNDIUtils.getJNDIDataSource(JNDIUtils.java:51) at
coldfusion.sql.J2EEDataSource.newDataSource(J2EEDataSource.java:68) at
coldfusion.sql.DataSourceFactory.createDataSource(DataSourceFactory.java:108)
at coldfusion.sql.DataSourceFactory.setDataSource(DataSourceFactory.java:134)
at coldfusion.sql.Executive.mapModified(Executive.java:272) at
coldfusion.server.ConfigMap.setChanged(ConfigMap.java:68) at
coldfusion.server.ConfigMap.put(ConfigMap.java:247) at
coldfusion.runtime.Struct.StructInsert(Struct.java:535) at
coldfusion.runtime.CFPage.StructInsert(CFPage.java:3461) at
cfsetdsn2ecfm495245500.runPage(E:\cf8_updates\cfusion\wwwroot\CFIDE\adminapi\_datasource\setdsn.cfm:392)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:196) at
coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:370) at
coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2661) at
cfdatasource2ecfc498810217$funcSETOTHER.runFunction(E:\cf8_updates\cfusion\wwwroot\CFIDE\adminapi\datasource.cfc:865)
I understand this isn't exactly a common case, so I'm just going through the
unofficial classes, when I get a solution I'll post it here.
If anyone else has any suggestions I'd appreciate it!
>> One trick I found that is getting me close is setting the
>> driver name to "jndi" (got that from the neo-datasource.xml),
>> but I am still getting an error. My next strategy is to just
>> directly call the java classes coldfusion uses internally.
>> Surely prone to problems down the line but I believe it is my
>> best bet.
>
>Try setting the JDBC URL to the name of the JNDI datasource.
>
>Dave Watts, CTO, Fig Leaf Software
>http://www.figleaf.com/
>
>Fig Leaf Software provides the highest caliber vendor-authorized
>instruction at our training centers in Washington DC, Atlanta,
>Chicago, Baltimore, Northern Virginia, or on-site at your location.
>Visit http://training.figleaf.com/ for more information!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307470
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4