Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Uploading and querying an mdb file

Explorer ,
Nov 29, 2012 Nov 29, 2012

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 :

No suitable driver found for Driver={Microsoft Access Driver (*.mdb)};Dbq=stockwagen15.mdb;Uid=Admin;Pwd=somepwd;

If i change jdbc:odbc:DRIVER to Driver , I get

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified


I also tried using a complete path to the file, same error ...

TOPICS
Database access
3.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Dec 02, 2012 Dec 02, 2012

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 ...

Translate
LEGEND ,
Nov 29, 2012 Nov 29, 2012

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 29, 2012 Nov 29, 2012

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 30, 2012 Nov 30, 2012

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 01, 2012 Dec 01, 2012

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 29, 2012 Nov 29, 2012

You might be interested in this previous thread on using ACCDB files in ColdFusion.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 29, 2012 Nov 29, 2012

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 29, 2012 Nov 29, 2012

i'm interested in how to install that jackcess-1.2.9.jar file though and maybe some tips how to handle it

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 02, 2012 Dec 02, 2012
LATEST

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 ...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources