Solved

My mdb database does not work when i upload it?

Posted on 2009-05-02
9
358 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 

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
 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article discusses how to create an extensible mechanism for linked drop downs.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
The viewer will learn how to count occurrences of each item in an array.

828 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