Solved

My mdb database does not work when i upload it?

Posted on 2009-05-02
9
359 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
The viewer will learn how to count occurrences of each item in an array.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

737 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