What I am trying to achieve.
I am uploading a .mdb
file. After uploading I want to read the data from the uploaded file.
What I have done so far.
After referring this(Uploading and querying an mdb file), I have written this code.
<cfif isdefined("form.fileData")>
<cffile action = "upload" destination = "D:\Experiments" fileField = "form.fileData" nameConflict = "MakeUnique" result ="hello" strict="false">
<cfdump var="#hello#">
<!--- The file upload is working fine --->
<cfscript>
classLoader = createObject("java", "java.lang.Class");
classLoader.forName("sun.jdbc.odbc.JdbcOdbcDriver");
dm = createObject("java","java.sql.DriverManager");
con = dm.getConnection("jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=#hello.serverfile#;");
st = con.createStatement();
rs = st.ExecuteQuery("Select * FROM Classes");
q = createObject("java", "coldfusion.sql.QueryTable").init(rs);
//the query is stored in the variable q
</cfscript>
<cfquery name="GetExample" dbtype="query">
SELECT *
FROM q
</cfquery>
<cfdump var="#GetExample#">
<cfelse>
<cfform name="myUpload" enctype="multipart/form-data">
<cfinput type="file" name="fileData"><br>
<cfinput type="submit" name="submit" value="Verzenden">
</cfform>
</cfif>
But I am getting an error
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
After referring this answer I have tried by giving absolute path. But it is also giving same error.
Error!!