Ram Drive Accessible to Queries/JDBC?

I was trying this into MySQL, which I knew probably wouldn’t work:

<cffile action="WRITE" file="ram://TheData.tab" output="#TheData#" addnewline="No" fixnewline="No">

<cfquery name="InsertData" datasource="ds">
 LOAD DATA LOCAL INFILE 'ram://TheData.tab'
INTO TABLE tbname
 FIELDS TERMINATED BY '\t'
OPTIONALLY ENCLOSED BY '"'
 LINES TERMINATED BY '\n'
(field1, field2, field3)
</cfquery>

and as expected, it didn’t. (Unable to open file ‘ram://TheMajors.tab’ java.io.FileNotFoundException in ACF, and “Could not send file : ram:\TheMajors.tab” in Lucee)

Is there a way to make a ram drive accessible outside of CF tags which are obviously aware of and can access ram drives CFML creates? This would be access from within a JDBC driver I suppose?

From what I understand is, that the ram:// drive of CFML is a space in memory allocated as a physical file simulation (virtual ressource) by the JVM. Thus, it won’t exist anywhere outside of that, but only to the applications run by the JVM instance. Because you are just sending the SQL query through the JDBC client to MySQL, that won’t be accessible to that MySQL instance. MySQL runs outside, only being accessed through network access through port 3306(default). You may have more success if you use a RAM Disk supplied by the underlying OS as an alternative.

1 Like

Makes sense, thanks!