How to set JNDI datasources in lucee?

Here is the ACF code that I am trying to convert to lucee. Does anyone know how this could be accomplished? ( Among other things, it seems coldfusion.sql.DataSourceFactory does not exist in lucee. ) Thanks in advance !!!

<cfscript>
  dsService   = createObject('java','coldfusion.server.ServiceFactory').getDataSourceService();
  datasourceFactory = createObject("java", "coldfusion.sql.DataSourceFactory").getInstance();
  extraParams = {
    maxBufferSize="",
    spyLogFile="",
    logintimeout=0,
    _logintimeout=0,
    args="",
    sendStringParametersAsUnicode=true,
    port='',
    JNDINAME=jndiName,
    supportLinks=true,
    pageTimeout="",
    host="",
    database="",
    isj2ee=true,
    informixServer="",
    port="",
    defaultusername="",
    maxPooledStatements=1000,
    TimeStampAsString="no",
    datasource="",
    defaultpassword="",
    SID="",
    systemDatabaseFile="",
    isnewdb="",
    UseTrustedConnection="false",
    databaseFile="",
    CONNECTIONPROPS=structNew(),
    selectMethod="direct"
    };
  dsnMap = {
    name=dsnName,
    password='',
    isj2ee=true,
    driver='jndi',
    url=jndiName,
    class="",
    type="jndi",
    urlmap=extraParams,
    timeout=javacast("float",1200),
    interval=javacast("float",420),
    type="J2EE",
    disable=false,
    disable_blob=true,
    disable_clob=true,
    pooling=false,
    create=true,
    alter=false,
    select=true,
    update=true,
    insert=true,
    delete=true,
    blob_buffer=524288000,
    buffer=524288000,
    storedproc=true
  };
  datasourceFactory.setDataSource(dsnName,createObject("java", "coldfusion.sql.DataSourceDef").init(dsnMap));
</cfscript>

I believe coldfusion.sql.DataSourceFactory is an undocumented feature of ACF and unlikely to replicated within Lucee engine.

I’m not all that familiar with JNDI datasources, but you might lend your support to this proposed change:

Thanks Geoff!

– Arthur