CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Script to Create an .mdb File

Print topic Send  topic

Author Message
datadoit
Posted: 08/08/2008, 8:07 AM

CCS3.2; PHP5; MySQL5

Does anyone know how to -create- an MS Access database on-the-fly via
PHP script? Not talking about connecting to an existing Access
database, but rather creating a non-existing database and shoving
tables, fields and rows of data into it.

Not looking to export to CSV, then opening Access and importing the
files. Looking for 100% automation on the back-end in a script, and
when done the user gets presented the file for download.

Thanks.
wkempees


Posts: 1679
Posted: 08/08/2008, 9:42 AM

I as well as you know the Content-Type: application/vnd.msaccess or application/x--msaccess, so that is not your question.
I just pumped Excel ready data through that content-type and was offered a msacces db for download, however the data was not the right type.
Have googled several combinations but not come up wit solution other than xml +dtd.

Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
View profile  Send private message
datadoit
Posted: 08/08/2008, 10:47 AM

Here's a thought....

* Create an Access database and place it on the webserver.

* In the online form where the user specifies their Access filename,
change the name of the existing file to the new filename.

* Have CodeCharge use a DSN'less connection string to use the datafile,
and dynamically update the name of the database based on the above filename.

* All other database operations would be normal CodeCharge connect stuff.

Could this work?
wkempees


Posts: 1679
Posted: 08/08/2008, 11:37 AM

Would take a lot of testing to answer that, my friend.
I would not know the answer to this (yet), and have never tried it before.
Interesting though.

Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
View profile  Send private message
datadoit
Posted: 08/08/2008, 3:35 PM

Well, to get this started I need to connect to my Access database. This
is my first stab at fiddling with Access and CCS. I've scoured the
forums and it -looks- like I've set things right, but apparently not.
Here's what I have:

The data file is located on my local development machine at
c:\wamp\www\myweb.com\myfile.mdb.

I've set up an ODBC connection to it, and in design mode in CCS I can
connect to it and design on it no problems. However, when the project
is published to my local development environment
(c:\wamp\www\myweb.com), I get the error:

------------------------------------------
Warning: odbc_connect() [function.odbc-connect]: SQL error:
[Microsoft][ODBC Driver Manager] Data source name not found and no
default driver specified, SQL state IM002 in SQLConnect in
C:\wamp\www\myweb.com\db_odbc.php on line 58
Database error: Cannot connect ot Database: [Microsoft][ODBC Driver
Manager] Data source name not found and no default driver specified
ODBC Error
Session halted.
------------------------------------------

My local development environment is WAMP (Windows/Apache/MySQL/PHP).
What have I missed?

Secondly, when it goes live, it'll be on a LAMP system located at
/var/www/myweb.com. How can I make this work on both local and remote
(using two versions of the file of course)?
wkempees


Posts: 1679
Posted: 08/08/2008, 4:15 PM

Have you copied/created a msacces db for the Connection Server part.
Meaning: In Connections you must have told CCS where to find the .mdb.
You will have to put one at the designated place.

From the error I suspect either not a mdb present or connection parms wrong, and/of write lock.

Walter

_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
View profile  Send private message
JimmyCrackedCorn

Posts: 583
Posted: 08/08/2008, 7:08 PM

my understanding is Access won't work on LAMP. can someone verify?
_________________
Walter Kempees...you are dearly missed.
View profile  Send private message
datadoit
Posted: 08/08/2008, 7:22 PM

Well, on the Modify Connection -> Server tab, the Database or ODBC
connection name field is a little confusing. I've always just used the
ODBC connection name for MySQL databases, or in this case it's called
'myfile'. So I changed that value to actually point to the data file,
which makes my Common.php entry now look like this:

"myfile" => array(
"Type" => "MSAccess",
"DBLib" => "ODBC",
"Database" => "c:\\wamp\\www\\myweb.com\\myfile.mdb",
"Host" => "",
"Port" => "",
"User" => "",
"Password" => "",
"UseODBCCursor" => "",
"Persistent" => false,
"DateFormat" => array("yyyy", "-", "mm", "-", "dd", " ", "HH", ":",
"nn", ":", "ss"),
"BooleanFormat" => array(1, 0, ""),
"Uppercase" => false

When published, I get this new error message:

Warning: odbc_connect() [function.odbc-connect]: SQL error:
[Microsoft][ODBC Driver Manager] Invalid string or buffer length, SQL
state S1090 in SQLConnect in C:\wamp\www\myweb.com\db_odbc.php on line 58
Database error: Cannot connect ot Database: [Microsoft][ODBC Driver
Manager] Invalid string or buffer length
ODBC Error
Session halted.
datadoit
Posted: 08/08/2008, 7:41 PM

JimmyCrackedCorn wrote:
> my understanding is Access won't work on LAMP. can someone verify?
> ---------------------------------------

Using MS Access database files (mdb's) on LAMP is quite common. Now
actually running MS Access on a Linux desktop is a different issue -
perhaps it could work under wine.
JimmyCrackedCorn

Posts: 583
Posted: 08/08/2008, 8:36 PM

interesting.

I guess my next question would be...why would you want to! :-D If I was on LAMP (or WAMP) I'd probably be looking at MySQL (isn't that what the 'M' stands for?)

Don't know if this is helpful as it is probably targetted at IIS but,

http://classicasp.aspfaq.com/general/how-do-i-create-a-...e-from-asp.html
_________________
Walter Kempees...you are dearly missed.
View profile  Send private message
datadoit
Posted: 08/10/2008, 8:29 PM

The ODBC errors were related to the DSN. Switched to using a System DSN
versus a User DSN. Works great on local WAMP.

For working with an Access database on Linux using PHP, I've found that
using unixODBC along with MDBTools works:

http://bryanmills.net/archives/2003/11/microsoft-access...-linux-and-php/

However, so far I'm having to build the connection and appropriate SQL
manually. CodeCharge appears to be mucking up the SQL in some manner
that doesn't play nicely with unixODBC. Anyone out there with
experience using unixODBC/M$ Access/CodeCharge?



Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.