473,722 Members | 2,468 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ODBC Connection to dbase IV?

I am trying to figure out how to query some data out of a dbase IV
(.dbf) file sitting on a remote server from my MySQL/PHP/Web Server.

Both servers are Windows Server 2003 SP2.

My MySQL/PHP/Web server is running PHP 4.3.11, MySQL 4.0.24, and IIS.

I have set a system DSN on the remote machine for the directory that
contains the dbase file. The DSN name is SASIxp, and the actual file
I'm trying to connect to is ADST.DBF.

I've found several examples of how to connect with other database
types, and have used those examples in an attempt to connect to my
dbase IV file, but so far, I'm not having any luck. Instead, I'm
getting errors like:

Expand|Select|Wrap|Line Numbers
  1. Warning: odbc_exec(): SQL error: [Microsoft][ODBC dBase Driver]
  2. The Microsoft Jet database engine could not find the object
  3. 'ADST.DBF'. Make sure the object exists and that you spell its name
  4. and the path name correctly., SQL state S0002 in SQLExecDirect in E:
  5. \InetPub\wwwroot\posa_test\includes\functions.inc on line 4952
I'm including my sandbox code below, which includes 4 different
versions of $connection_str ing, none of which have worked. :(

Does anybody know of a good tutorial, or have any suggestions? I know
I'm somewhat limited in what I can do with a dbase IV file (if
anything???), but all I really need is to do a simple lookup; no
adding, deleting or changing of any records.
Expand|Select|Wrap|Line Numbers
  1. //$connection_string = 'DRIVER={Microsoft dBase Driver
  2. (*.dbf)};SERVER=<10.112.139.230>;DATABASE=<ADST.DBF>';
  3. //$connection_string = 'DRIVER={Microsoft dBase Driver
  4. (*.dbf)};SERVER=<10.112.139.230>;DATABASE=<SASIxp>';
  5.  
  6. //$connection_string = 'DRIVER={Microsoft dBase Driver
  7. (*.dbf)};datasource=SASIxp;';
  8.  
  9. $connection_string = 'DRIVER={Microsoft dBase Driver (*.dbf)};
  10. datasource=\\\\sasi_main\\sasixp\\datafile\\ADST.DBF;';
  11.  
  12.  
  13. $user = '';
  14. $pass = '';
  15.  
  16. //$connection = odbc_connect( $connection_string, $user, $pass );
  17.  
  18. $odbc = odbc_connect ($connection_string, '', '') or die('Could Not
  19. Connect to ODBC Database!');
  20.  
  21. $strsql= 'SELECT * FROM ADST.DBF';
  22.  
  23. $query = odbc_exec($odbc, $strsql) or die (odbc_errormsg());
Thanks in advance for your assistance!: :)
Jan 15 '08 #1
2 11154

<bc*****@gmail. comwrote in message
news:24******** *************** ***********@u10 g2000prn.google groups.com...
>I am trying to figure out how to query some data out of a dbase IV
(.dbf) file sitting on a remote server from my MySQL/PHP/Web Server.

Both servers are Windows Server 2003 SP2.

My MySQL/PHP/Web server is running PHP 4.3.11, MySQL 4.0.24, and
IIS.

I have set a system DSN on the remote machine for the directory that
contains the dbase file. The DSN name is SASIxp, and the actual
file
I'm trying to connect to is ADST.DBF.

I've found several examples of how to connect with other database
types, and have used those examples in an attempt to connect to my
dbase IV file, but so far, I'm not having any luck. Instead, I'm
getting errors like:

Expand|Select|Wrap|Line Numbers
  1. Warning: odbc_exec(): SQL error: [Microsoft][ODBC dBase
  2. Driver]
  3. The Microsoft Jet database engine could not find the object
  4. 'ADST.DBF'. Make sure the object exists and that you spell its name
  5. and the path name correctly., SQL state S0002 in SQLExecDirect in E:
  6. \InetPub\wwwroot\posa_test\includes\functions.inc on line
  7. 4952

I'm including my sandbox code below, which includes 4 different
versions of $connection_str ing, none of which have worked. :(

Does anybody know of a good tutorial, or have any suggestions? I
know
I'm somewhat limited in what I can do with a dbase IV file (if
anything???), but all I really need is to do a simple lookup; no
adding, deleting or changing of any records.
Expand|Select|Wrap|Line Numbers
  1. //$connection_string = 'DRIVER={Microsoft dBase Driver
  2. (*.dbf)};SERVER=<10.112.139.230>;DATABASE=<ADST.DBF>';
  3. //$connection_string = 'DRIVER={Microsoft dBase Driver
  4. (*.dbf)};SERVER=<10.112.139.230>;DATABASE=<SASIxp>';
  5. //$connection_string = 'DRIVER={Microsoft dBase Driver
  6. (*.dbf)};datasource=SASIxp;';
  7. $connection_string = 'DRIVER={Microsoft dBase Driver (*.dbf)};
  8. datasource=\\\\sasi_main\\sasixp\\datafile\\ADST.DBF;';
  9. $user = '';
  10. $pass = '';
  11. //$connection = odbc_connect( $connection_string, $user, $pass );
  12. $odbc = odbc_connect ($connection_string, '', '') or die('Could Not
  13. Connect to ODBC Database!');
  14. $strsql= 'SELECT * FROM ADST.DBF';
  15. $query = odbc_exec($odbc, $strsql) or die (odbc_errormsg());

Thanks in advance for your assistance!: :)
The ODBC driver probably doesnt like the UNC path, and wants a local
file.
Check google for this.

Richard.
Jan 15 '08 #2

"Richard" <root@localhost wrote in message
news:47******** *************** @news.euronet.n l...
>
<bc*****@gmail. comwrote in message
news:24******** *************** ***********@u10 g2000prn.google groups.com...
>>I am trying to figure out how to query some data out of a dbase IV
(.dbf) file sitting on a remote server from my MySQL/PHP/Web
Server.

Both servers are Windows Server 2003 SP2.

My MySQL/PHP/Web server is running PHP 4.3.11, MySQL 4.0.24, and
IIS.

I have set a system DSN on the remote machine for the directory
that
contains the dbase file. The DSN name is SASIxp, and the actual
file
I'm trying to connect to is ADST.DBF.

I've found several examples of how to connect with other database
types, and have used those examples in an attempt to connect to my
dbase IV file, but so far, I'm not having any luck. Instead, I'm
getting errors like:

Expand|Select|Wrap|Line Numbers
  1. Warning: odbc_exec(): SQL error: [Microsoft][ODBC dBase
  2. Driver]
  3. The Microsoft Jet database engine could not find the object
  4. 'ADST.DBF'. Make sure the object exists and that you spell its name
  5. and the path name correctly., SQL state S0002 in SQLExecDirect in
  6. E:
  7. \InetPub\wwwroot\posa_test\includes\functions.inc on line
  8. 4952

I'm including my sandbox code below, which includes 4 different
versions of $connection_str ing, none of which have worked. :(

Does anybody know of a good tutorial, or have any suggestions? I
know
I'm somewhat limited in what I can do with a dbase IV file (if
anything???) , but all I really need is to do a simple lookup; no
adding, deleting or changing of any records.
Expand|Select|Wrap|Line Numbers
  1. //$connection_string = 'DRIVER={Microsoft dBase Driver
  2. (*.dbf)};SERVER=<10.112.139.230>;DATABASE=<ADST.DBF>';
  3. //$connection_string = 'DRIVER={Microsoft dBase Driver
  4. (*.dbf)};SERVER=<10.112.139.230>;DATABASE=<SASIxp>';
  5. //$connection_string = 'DRIVER={Microsoft dBase Driver
  6. (*.dbf)};datasource=SASIxp;';
  7. $connection_string = 'DRIVER={Microsoft dBase Driver (*.dbf)};
  8. datasource=\\\\sasi_main\\sasixp\\datafile\\ADST.DBF;';
  9. $user = '';
  10. $pass = '';
  11. //$connection = odbc_connect( $connection_string, $user, $pass );
  12. $odbc = odbc_connect ($connection_string, '', '') or die('Could Not
  13. Connect to ODBC Database!');
  14. $strsql= 'SELECT * FROM ADST.DBF';
  15. $query = odbc_exec($odbc, $strsql) or die (odbc_errormsg());

Thanks in advance for your assistance!: :)

The ODBC driver probably doesnt like the UNC path, and wants a local
file.
Check google for this.

Richard.
BTW,
if you have setup the datasource correctly, you only have to use its
name in PHP, and user and pass if needed.
The data directory etc. you specify in the DSN.

I found this in the archives here, maybe good starting point:
Datasource name= 'Packlists' , user = '', pass = ''
----------------------------------

$odbc=odbc_conn ect('Packlists' ,'','');
$q="select * from packlist01;";
$odbcset=odbc_e xec($odbc,$q);

odbc_fetch_into ($odbcset,$row) ;
for ($i=1; $i<=odbc_num_fi elds($odbcset); $i++)
{
$field[odbc_field_name ($odbcset,$i)] = $row[($i-1)];
}
odbc_close($odb c);
----------------------------------

Good luck
Richard.
Jan 15 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
8735
by: MLH | last post by:
I'm running XP. Is it required that a given ODBC driver be selected or set somehow as a default driver? Look at this... Here's the error: Error: ODBC call failed... Datasource not found and no default ODBC driver specified. I think I can work my way around the Datasource, but the default driver thing (#0) - dunno?
1
5260
by: Derek Griffiths | last post by:
Most of the complicated programs I write are boring applications that manipulate databases associated with the medical billing program where I work. The program uses foxpro dbases (version 3) for all of its' data. I'm running into a strange problem that I believe has something to do with the actual dbase file, but I couldn't find anything on google. Each group of doctors has its' own patient and billing tables. I can read the billing...
5
7355
by: Zlatko Matiĉ | last post by:
Hello. In ODBC Data Source Administrator, there is a tab "Connection Pooling" and option "PerfMon" Enable/Disable. Could someone explain the meaning of the option and how it reflects to Access when having ODBC linked tables, JET queries on linked tables and pass-through queries? Thanks,
1
1960
by: Durumdara | last post by:
Hi ! I have a text processor code and I want to put the results to standard files. HTML, XML, SQLite - they are ok. But I want to put these datas to DBF too, because when records are many, does not fit in Excel table (load from HTML). XML and SQLite need some development to get datas.
0
988
by: yefei | last post by:
it is very weird I set the same connection string for ODBC connect to dBase file in asp.net and the file is the same, just copied from one PC to another PC but what happens is that it runs well on two Desktops for the connection to get the table but when I tried to open the connection on the Labtop, the VWD closes automatically seems it have problem retrieving the data from the table
0
2830
by: colmkav | last post by:
HI, anyone know why this code doesnt work? I am trying to set up the connect property of a tabledef so that it uses a given login and password. however once I run it I still need to login when I open the table Function SetConnections() Dim strTableName, strSourceTableName As String Dim objTableDef As TableDef Dim strConnect As String '= "Set your connection string here" Dim rs As Recordset
4
8451
by: Robert Hooker | last post by:
I have installed our .NET application on a system running Microsoft Windows Vista operating system. When I run our application, I receive the following error message whenever it tries to create a DBF file using VFPODBC: "ERROR Driver does not support this function" I am using a connection string that I have used for many years with no problems, here is some sample C# code:
7
3059
by: Salad | last post by:
I am converting an application from A97 to A2003. I have 2 tables created by another application as a Foxpro.dbf. The table has no index. The connect string in A97 is FoxPro 2.0;HDR=NO;IMEX=2;DATABASE=C:\Test It's really easy to connect to those tables in A97. I'm having difficulties in A2003. I'm trying to follow the instructions in http://support.microsoft.com/kb/824264/.
0
1103
by: Artem | last post by:
I'm using dbase MySql with character encoding utf-8. The program is written on C#. IDE - SharpDevelop. I use odbc to get some string data from dbase, but I get: either symbols '?' if I don't set the charset to utf8 in my program via connection string or 'SET NAMES 'utf8'' or just strange symbols if I set the charset using one of the ways written above. I looked in msdn, but I didn't find anything more about how I can set character set for...
0
8740
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9386
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9239
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9158
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9090
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6685
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4503
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2606
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2148
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.