Solved

My mdb database does not work when i upload it?

Posted on 2009-05-02
9
353 Views
Last Modified: 2012-05-06
when i am using mdb database and upload it , do i need to configure on the net from somewhere else like we do when we do on localhost?

my programs are working fine on localhost but not fine when i upload the database. it seems it is not picking up the database.

i have a very simple program which counts the total no. of rows in the database.
it it running on localhost but not on server when i upload it.
<?php

 

// it shows the total no. of records that are returned in the database.

 

$conn=odbc_connect('win','',''); //database name is win

$sql="select count(*) as cnt from customers";

$row=odbc_exec($conn, $sql);

if(odbc_fetch_row($row)){

        echo $cnt = odbc_result($row, 1);

}

 

?>

Open in new window

0
Comment
Question by:designersx
  • 7
  • 2
9 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 125 total points
ID: 24289474
If you're working with .mdb files, it would seem you'd need the full name, i.e. "win.mdb" ...

However: Can you verify whether your connection is actually made? After your odbc_connect call, can you then add a line that would show whether or not this connection is in fact valid?

"localhost" has no meaning to Access databases ... Access is a file-server type database, and requires no specific platform on which to run.

Are you sure your webserver has the correct permissions to run the database? The folder hosting the database will need at least Modify permissions in order to run it.
0
 

Author Comment

by:designersx
ID: 24289548
when i run any program related to the mdb database using odbc connection, we need to make a connection first. steps are as follows:-

1) we go to the control panel.
2) there we go the administrative tools.
3) after this there is a icon of odbc (Data Sources)
4) we double click on it and window of data source administrator opens and then going in the system dsn tab , we click on add button and add the databases here, then we enable to make a interaction with mdb database using odbc connection.

but when i am uploading all my files, how do i be able to make a connection with database. this i smy problem, please help me out. i am just sending u the snapshots of how we do in the localhost but how should we do on the server.
0
 

Author Comment

by:designersx
ID: 24289641
1) when i am running on the localhost, then i wrote only win and not win.mdb, so that means u wanna say when i write win.mdb and try , i will through.

2) sir how can i check whether a connection is valid?

3) my other projects are running here but for them i have used mysql database ofr them , so i have not used before. this thing i wll ask from my boss.

just once please clear my first point.
 
0
 

Author Comment

by:designersx
ID: 24292420
sir i have used win.mdb but this i m not able to do make interaction with mdb. please help.
0
Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

 

Author Comment

by:designersx
ID: 24292431
when i run this code on localhost, msg comes connection is valid
but on server msg comes, error in the connection.

why is this so? there comes problem in making the connection?
<?php
 

// it shows the total no. of records that are returned in the database.
 

echo $conn=odbc_connect('win','','');

if($conn)

	echo "connection is valid";

else	

	echo "error in the connection".odbc_error();

exit;

$sql="select count(*) as cnt from customers";

$row=odbc_exec($conn, $sql);

if(odbc_fetch_row($row)){

	echo $cnt = odbc_result($row, 1);

}
 

?>

Open in new window

0
 

Author Comment

by:designersx
ID: 24292500
error in the connectionIM002

this is the exact error msg coming. what is IM002??
0
 

Author Comment

by:designersx
ID: 24292527
the problem is because i have not entered the username and password.

please tell me in odbc_connect(), what username and password we fill?

odbc_connect('database name','username of mdb database','password of mdb database')

am i right???
0
 
LVL 84
ID: 24293837
You've opened several other questions for this issue ... EE guidelines allow only one question per issue.

0
 

Author Comment

by:designersx
ID: 24294158
ok fine, sry
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now