Wednesday, November 26, 2025

.::: Testing Script Lucee using Driver PostgreSQL, EDB, Oracle, MSSQL SQL Server Database :::.

 


1. run mssql

http://10.10.10.90:8888/belimssql.cfm
 

2. run edb

http://10.10.10.90:8888/beliedb.cfm
 

3. run oracle

http://10.10.10.90:8888/belioracle.cfm
 

4. script lucee for mssql sql server

[root@teguhth ROOT]# pwd
/opt/lucee/tomcat/webapps/ROOT
[root@teguhth ROOT]#
[root@teguhth ROOT]# cat belimssql.cfm
<cfsetting showdebugoutput="true">

<cftry>

    <!-- Tes koneksi -->

<cfquery name="testKoneksi" datasource="mssqltest">
    SELECT
        SYSDATETIME() AS waktuServer,
        @@servername AS hostname,
        @@version AS version;
</cfquery>

<cfoutput>
    <h2>Koneksi SQL Server via Lucee: BERHASIL</h2>
    <p>Waktu Server SQL Server: #DateTimeFormat(testKoneksi.waktuServer, "yyyy-MM-dd HH:mm:ss")#</p>
    <p>Hostname SQL Server: #testKoneksi.hostname#</p>
    <p>Version SQL Server:<br>#testKoneksi.version#</p>
</cfoutput>

    <!-- Query pembelian -->
    <cfquery name="data" datasource="mssqlTest">
        SELECT
            KODE_PEMBELIAN,
            KODE_BARANG,
            KODE_CUSTOMER,
            TANGGAL_PEMBELIAN,
            JUMLAH_PEMBELIAN
        FROM pembelian;
    </cfquery>

    <h3>Data Pembelian:</h3>

    <table border="1" cellpadding="6" cellspacing="0" style="border-collapse:collapse;">
        <tr>
            <th>KODE_PEMBELIAN</th>
            <th>KODE_BARANG</th>
            <th>KODE_CUSTOMER</th>
            <th>TANGGAL_PEMBELIAN</th>
            <th>JUMLAH_PEMBELIAN</th>
        </tr>

        <cfoutput query="data">
            <tr>
                <td>#KODE_PEMBELIAN#</td>
                <td>#KODE_BARANG#</td>
                <td>#KODE_CUSTOMER#</td>
                <td>#DateTimeFormat(data.TANGGAL_PEMBELIAN, "yyyy-mm-dd HH:mm:ss")#</td>
                <td>#JUMLAH_PEMBELIAN#</td>
            </tr>
        </cfoutput>
    </table>

            <!-- Tes koneksi -->
    <cfquery name="testKoneksiend" datasource="mssqlTest">
        SELECT SYSDATETIME() AS waktuServer;
    </cfquery>

    <cfoutput>
        <h2>Koneksi MSSQL via Lucee: BERHASIL - End </h2>
        <p>Waktu Server MSSQL: #DateTimeFormat(testKoneksiend.waktuServer, "yyyy-mm-dd HH:mm:ss")#</p>
    </cfoutput>

    <!-- Error handler -->
    <cfcatch type="any">
        <h2 style="color:red;">ERROR</h2>
        <cfdump var="#cfcatch#">
    </cfcatch>

</cftry>

[root@teguhth ROOT]#


5. script lucee for postgresql edb 

[root@teguhth ROOT]# pwd
/opt/lucee/tomcat/webapps/ROOT
[root@teguhth ROOT]#
[root@teguhth ROOT]# cat beliedb.cfm
<cfsetting showdebugoutput="true">

<cftry>

    <!-- Tes koneksi -->

<cfquery name="testKoneksi" datasource="edbtest">
    SELECT
        NOW() AS waktuServer,
        version() AS version;
</cfquery>

<cfoutput>
    <h2>Koneksi PostgreSQL via Lucee: BERHASIL - Start</h2>
    <p>Waktu Server PostgreSQL: #DateTimeFormat(testKoneksi.waktuServer, "yyyy-MM-dd HH:mm:ss")#</p>
    <p>Version PostgreSQL: #testKoneksi.version#</p>
</cfoutput>

    <!-- Query pembelian -->
    <cfquery name="data" datasource="edbTest">
        SELECT
            KODE_PEMBELIAN,
            KODE_BARANG,
            KODE_CUSTOMER,
            TANGGAL_PEMBELIAN,
            JUMLAH_PEMBELIAN
        FROM pembelian;
    </cfquery>

    <h3>Data Pembelian:</h3>

    <table border="1" cellpadding="6" cellspacing="0" style="border-collapse:collapse;">
        <tr>
            <th>KODE_PEMBELIAN</th>
            <th>KODE_BARANG</th>
            <th>KODE_CUSTOMER</th>
            <th>TANGGAL_PEMBELIAN</th>
            <th>JUMLAH_PEMBELIAN</th>
        </tr>

        <cfoutput query="data">
            <tr>
                <td>#KODE_PEMBELIAN#</td>
                <td>#KODE_BARANG#</td>
                <td>#KODE_CUSTOMER#</td>
                <td>#DateTimeFormat(data.TANGGAL_PEMBELIAN, "yyyy-mm-dd HH:mm:ss")#</td>
                <td>#JUMLAH_PEMBELIAN#</td>
            </tr>
        </cfoutput>
    </table>


            <!-- Tes koneksi -->
    <cfquery name="testKoneksiend" datasource="edbTest">
        SELECT NOW() AS waktuServer;
    </cfquery>

    <cfoutput>
        <h2>Koneksi PostgreSQL via Lucee: BERHASIL - End </h2>
        <p>Waktu Server PostgreSQL: #DateTimeFormat(testKoneksiend.waktuServer, "yyyy-mm-dd HH:mm:ss")#</p>
    </cfoutput>

    <!-- Error handler -->
    <cfcatch type="any">
        <h2 style="color:red;">ERROR</h2>
        <cfdump var="#cfcatch#">
    </cfcatch>

</cftry>

[root@teguhth ROOT]#


6. script lucee for oracle

[root@teguhth ROOT]# pwd
/opt/lucee/tomcat/webapps/ROOT
[root@teguhth ROOT]#
[root@teguhth ROOT]# cat belioracle.cfm
<cfsetting showdebugoutput="true">

<cftry>

    <!-- Tes koneksi -->

<cfquery name="testKoneksi" datasource="oracletest">
    SELECT
        SYSDATE AS waktuServer,
        SYS_CONTEXT('USERENV','SERVER_HOST') AS hostname,
        (SELECT banner
           FROM v$version
           WHERE banner LIKE 'Oracle%'
           FETCH FIRST 1 ROW ONLY) AS version
    FROM dual
</cfquery>

<cfoutput>
    <h2>Koneksi Oracle via Lucee: BERHASIL - Start</h2>
    <p>Waktu Server Oracle: #DateTimeFormat(testKoneksi.waktuServer, "yyyy-MM-dd HH:mm:ss")#</p>
    <p>Hostname Oracle: #testKoneksi.hostname#</p>
    <p>Version Oracle: #testKoneksi.version#</p>
</cfoutput>

    <!-- Query pembelian -->
    <cfquery name="data" datasource="oracleTest">
        SELECT
            KODE_PEMBELIAN,
            KODE_BARANG,
            KODE_CUSTOMER,
            TANGGAL_PEMBELIAN,
            JUMLAH_PEMBELIAN
        FROM pembelian
    </cfquery>

    <h3>Data Pembelian:</h3>

    <table border="1" cellpadding="6" cellspacing="0" style="border-collapse:collapse;">
        <tr>
            <th>KODE_PEMBELIAN</th>
            <th>KODE_BARANG</th>
            <th>KODE_CUSTOMER</th>
            <th>TANGGAL_PEMBELIAN</th>
            <th>JUMLAH_PEMBELIAN</th>
        </tr>

        <cfoutput query="data">
            <tr>
                <td>#KODE_PEMBELIAN#</td>
                <td>#KODE_BARANG#</td>
                <td>#KODE_CUSTOMER#</td>
                <td>#DateTimeFormat(data.TANGGAL_PEMBELIAN, "yyyy-mm-dd HH:mm:ss")#</td>
                <td>#JUMLAH_PEMBELIAN#</td>
            </tr>
        </cfoutput>
    </table>

            <!-- Tes koneksi -->
    <cfquery name="testKoneksiend" datasource="oracleTest">
    SELECT
        SYSDATE AS waktuServer
    FROM dual

</cfquery>

    <cfoutput>
        <h2>Koneksi Oracle via Lucee: BERHASIL - End </h2>
        <p>Waktu Server Oracle: #DateTimeFormat(testKoneksiend.waktuServer, "yyyy-mm-dd HH:mm:ss")#</p>
    </cfoutput>

    <!-- Error handler -->
    <cfcatch type="any">
        <h2 style="color:red;">ERROR</h2>
        <cfdump var="#cfcatch#">
    </cfcatch>

</cftry>

[root@teguhth ROOT]#

No comments:

Post a Comment

Popular Posts