Solved

My mdb database does not work when i upload it?

Posted on 2009-05-02
9
356 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

863 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

26 Experts available now in Live!

Get 1:1 Help Now