Copy link to clipboard
Copied
Hi , I was wondering if it was possible uploading an mdb file and parsing it to output a pdf file through cf...
I know I have therefor need to have a dsn-less connection to that file to start with.
I tried :
<cfif isdefined("form.fileData")>
<cfscript>
hello = FileUpload("C:\inetpub\wwwroot\cvt\","form.fileData","application/msaccess","MakeUnique");
</cfscript>
<cfdump var="#hello#">
<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)};Dbq=#hello.serverfile#;Uid=Admin;Pwd=somepwd;");
st = con.createStatement();
rs = st.ExecuteQuery("Select * FROM tblbarcode");
q = createObject("java", "coldfusion.sql.QueryTable").init(rs);
//the query is stored in the variable q
</cfscript>
<cfquery name="GetExample" datasource="q" dbtype="query">
Select *
From tblbarcode
</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>
and i get :
If i change jdbc:odbc:DRIVER to Driver , I get
I also tried using a complete path to the file, same error ...
Found out after a heck of a search ... comes out that access driver is otherwise spelled ...
{Microsoft Access Driver (*.mdb)} needs to be
{Microsoft Access Driver (*.mdb, *.accdb)}
And you need to mind the SPACE after the comma, otherwise it's a no-go ...
Copy link to clipboard
Copied
If your plan is to continually upload new mdb files you need a better plan. Consider:
Using db software designed for client server on your server. There are choices, some free, some not so free.
Designing your database and writing a front end for writing data.
Import your data from access.
Upload the new db to the server and use it in your coldfusion apps.
Even if you want to continue to use access, you want to write data to the db that's on your server.
Copy link to clipboard
Copied
The main purpose of this script is to make a printable version of an mdb file that is used on multiple field terminals, representing the stock of materials of that technician
Copy link to clipboard
Copied
If every person has their own access file, could you not generate a report inside access that makes a printable version and then distribute it?
Copy link to clipboard
Copied
i don't want to / can't contact everybody everytime the content changes. this is a spare time project to help some of my collegues.
Copy link to clipboard
Copied
You might be interested in this previous thread on using ACCDB files in ColdFusion.
Copy link to clipboard
Copied
Can't, that describes how to connect to a accdb file , using a datasource.
what i need is to be able to connect to a MDB file that is random by name . which you can't define as a datasource.
Copy link to clipboard
Copied
i'm interested in how to install that jackcess-1.2.9.jar file though and maybe some tips how to handle it
Copy link to clipboard
Copied
Found out after a heck of a search ... comes out that access driver is otherwise spelled ...
{Microsoft Access Driver (*.mdb)} needs to be
{Microsoft Access Driver (*.mdb, *.accdb)}
And you need to mind the SPACE after the comma, otherwise it's a no-go ...