dbTalk Databases Forums  

perl foxpro on Windows xp

comp.databases.xbase.fox comp.databases.xbase.fox


Discuss perl foxpro on Windows xp in the comp.databases.xbase.fox forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Fred
 
Posts: n/a

Default perl foxpro on Windows xp - 11-03-2004 , 10:59 AM






Hi world,

I use to connect to fox pro using perl
very easyly with the odbc drivers on
win 98. However it seems to be very different
on an XP box. I lost many hours trying to find
how to, a faq or an example without luck.

Anyone out there could tell me how to do it?

Respect,

Fred Andre

Reply With Quote
  #2  
Old   
Rick Bean
 
Posts: n/a

Default Re: perl foxpro on Windows xp - 11-03-2004 , 01:26 PM






Fred,
Are you trying to connect to a VFP COM DLL, or are you just trying to access VFP data? Is the data in a table that is free or part of a database? What version of VFP created the table and what are the field types in use? The last ODBC driver came with VFP 6.0, and the new fields types introduced in VFP 7, 8 and 9 (beta) aren't handled by this old ODBC client. You'll need to connect to the data with the VFP OLE DB provider if you have any of the new field types or you need to access the stored procedures.

Rick

"Fred" <flyingwords (AT) hotmail (DOT) com> wrote

Quote:
Hi world,

I use to connect to fox pro using perl
very easyly with the odbc drivers on
win 98. However it seems to be very different
on an XP box. I lost many hours trying to find
how to, a faq or an example without luck.

Anyone out there could tell me how to do it?

Respect,

Fred Andre

Reply With Quote
  #3  
Old   
Fred
 
Posts: n/a

Default Re: perl foxpro on Windows xp - 11-04-2004 , 10:46 AM



First of all thanks for your time Rick.

Below I tried to answer the questions you raised and I give you a
basic snipet of code to show you what we use to do with odbc and win
98 (see below) and try to do under xp.

Would you have a basic perl example that works under xp with
the ole drivers and / or a basic guide to what as to be done
to set the ole stuff.




Quote:
Are you trying to connect to a VFP COM DLL, or are you just trying to
access VFP data?
not shure maybe the code can answer that querstion.

Quote:
What version of VFP created the table
Version 6

Quote:
Is the data in a table that is free or part of a
database?
we can access the diferent files representing tables
but they are part of a relational database







------------------- code snipet start ----------------------
use strict;
use DBI();


my $dbh = DBI->connect("dbi:ODBC:EnyoLiveOpera", "logon","password" ,
{ RaiseError => 1, odbc_cursortype => 2});

# Now retrieve data from the table.

my $sth = $dbh->prepare("select IT_DOC from itran where IT_DOC like
'%12%';");


$sth->execute();

while (my $ref = $sth->fetchrow_hashref()) {

print "Found a row: IT_DOC = $ref->{'IT_DOC'}";
}
$sth->finish();


# Disconnect from the database.
$dbh->disconnect();



------------------- code snipet end ----------------------

thanks again,

Fred


Reply With Quote
  #4  
Old   
Rick Bean
 
Posts: n/a

Default Re: perl foxpro on Windows xp - 11-04-2004 , 01:02 PM



Fred,
If your data is from VFP 6.0, then the current ODBC driver should work, but make sure it's the latest version - 6.1.8629.1. It came in MDAC 2.6, or you can get it at this link http://msdn.microsoft.com/vfoxpro/do...c/default.aspx.

I'm afraid I've never worked with PERL, but the one thing that concerns me is the SQL Prepare statement. Since this is going to FoxPro you don't need the terminating semi-colon on the SELECT - unlike most SQL data sources. . i.e. Instead of:
.... ("select IT_DOC from itran where IT_DOC like '%12%';");
try:
.... ("select IT_DOC from itran where IT_DOC like'%12%'");

Rick

"Fred" <flyingwords (AT) hotmail (DOT) com> wrote

Quote:
First of all thanks for your time Rick.

Below I tried to answer the questions you raised and I give you a
basic snipet of code to show you what we use to do with odbc and win
98 (see below) and try to do under xp.

Would you have a basic perl example that works under xp with
the ole drivers and / or a basic guide to what as to be done
to set the ole stuff.




Are you trying to connect to a VFP COM DLL, or are you just trying to
access VFP data?

not shure maybe the code can answer that querstion.

What version of VFP created the table

Version 6

Is the data in a table that is free or part of a
database?

we can access the diferent files representing tables
but they are part of a relational database







------------------- code snipet start ----------------------
use strict;
use DBI();


my $dbh = DBI->connect("dbi:ODBC:EnyoLiveOpera", "logon","password" ,
{ RaiseError => 1, odbc_cursortype => 2});

# Now retrieve data from the table.

my $sth = $dbh->prepare("select IT_DOC from itran where IT_DOC like
'%12%';");


$sth->execute();

while (my $ref = $sth->fetchrow_hashref()) {

print "Found a row: IT_DOC = $ref->{'IT_DOC'}";
}
$sth->finish();


# Disconnect from the database.
$dbh->disconnect();



------------------- code snipet end ----------------------

thanks again,

Fred

Reply With Quote
  #5  
Old   
Fred
 
Posts: n/a

Default Re: perl foxpro on Windows xp - 11-05-2004 , 03:55 AM



Hi again Rick,

yes the odbc drivers work very well under 98. We have been using
them for years but are not supported (and don't work under xp)
this is why we need the ole stuff. Do you have any code (in any
language) that access vfp through the ole stuff.

Thanks,

Fred

ps: the select syntax is corect for perl.

Reply With Quote
  #6  
Old   
Rick Bean
 
Posts: n/a

Default Re: perl foxpro on Windows xp - 11-05-2004 , 08:35 AM



Fred,
I'm using VFP 9.0 (beta) under XP Pro SP2 and I just ran this program using VFP ODBC. (Note: I also tried it in VFP 5.0 SP3, 6.0 SP5, 7.0 SP1 and 8.0 SP1, and it seems to work just fine!)

CONNECT_STR = ;
"Driver={Microsoft Visual FoxPro Driver};SourceType=DBC;" ;
+ "SourceDB=F:\Melange\Expireup8\epiccust.dbc;" ;
+ "Exclusive=No;NULL=NO;Collate=Machine;BACKGROUNDFE TCH=NO;DELETED=NO"

lnConn = SQLSTRINGCONNECT(CONNECT_STR)
IF m.lnConn > 0 && Success.

* Execute SELECT statement from a specific table in the DBC.
SQLEXEC(m.lnConn, 'SELECT * FROM editors', 'Editors')
BROWSE
USE IN Editors

* Disconnect.
SQLDISCONNECT(m.lnConn)
ELSE
? "Unable to connect to VFP DATABASE"
ENDIF

Rick

"Fred" <flyingwords (AT) hotmail (DOT) com> wrote

Quote:
Hi again Rick,

yes the odbc drivers work very well under 98. We have been using
them for years but are not supported (and don't work under xp)
this is why we need the ole stuff. Do you have any code (in any
language) that access vfp through the ole stuff.

Thanks,

Fred

ps: the select syntax is corect for perl.

Reply With Quote
  #7  
Old   
Fred
 
Posts: n/a

Default Re: perl foxpro on Windows xp - 11-08-2004 , 05:53 AM



Rick,

Thanks for the code bit. We couldn't find the odbc driver for xp
as microsoft says openly that they don't support odbc on xp.
We found some for 98 NT and 2000 but none for xp. Are those the one
you are using on xp ? If yes did you set them up with no problems ?

Once again, Thanks for your time.

Fred

Reply With Quote
  #8  
Old   
Rick Bean
 
Posts: n/a

Default Re: perl foxpro on Windows xp - 11-08-2004 , 08:56 AM



Fred,
While http://msdn.microsoft.com/vfoxpro/do...c/default.aspx doesn't list XP, 2000 or 2003, it's only because this page hasn't been updated since the driver itself hasn't been update since 1999! I had it installed since XP was first released back in 2001 and the ODBC driver has contined to work through upgrades to XP SP1 and recently SP2.

Since the code I posted works fine on my system, I can't see why it wouldn't work for you!

Note: ODBC hasn't stopped being supported, just VFP's - the ODBC driver for SQL Server was last updated in August of 2004! I use that one most every day!

Rick

"Fred" <flyingwords (AT) hotmail (DOT) com> wrote

Quote:
Rick,

Thanks for the code bit. We couldn't find the odbc driver for xp
as microsoft says openly that they don't support odbc on xp.
We found some for 98 NT and 2000 but none for xp. Are those the one
you are using on xp ? If yes did you set them up with no problems ?

Once again, Thanks for your time.

Fred

Reply With Quote
  #9  
Old   
Fred
 
Posts: n/a

Default Re: perl foxpro on Windows xp - 11-10-2004 , 02:48 AM



Rick,

Thanks for all your input. I will try therefore to
install the odbc driver on xp in a litle while.
I will also try to post any further comment on
the install in case it becomes usefull to someone else.

You are a Gentleman

Fred

Reply With Quote
  #10  
Old   
swdev2
 
Posts: n/a

Default Re: perl foxpro on Windows xp - 11-11-2004 , 11:49 AM



Fred -

'EnyoLiveOpera' is a named system DSN on your windows 98 box.
Take a look at it, and see which drivers it uses [name of driver, date/time
stamp, any version info]
then make sure:
1. you have the same drivers on your other boxes [installed properly, of
course]
2. you recreate the same 'named' system dsn on your other boxes.
3. got any pathing issues ? fix em to match whats on the working system ,
or repoint the sysem dsn to the 'newer' folder location.

hth - mondo regards [Bill]

--
William Sanders / Electronic Filing Group Remove the DOT BOB to reply via
email.
Mondo Cool TeleCom -> http://www.efgroup.net/efgcog.html
Mondo Cool WebHosting -> http://www.efgroup.net/efglunar.html
Mondo Cool Satellites -> http://www.efgroup.net/sat
VFP Webhosting? You BET! -> http://efgroup.net/vfpwebhosting
mySql / VFP / MS-SQL

"Fred" <flyingwords (AT) hotmail (DOT) com> wrote

Quote:
First of all thanks for your time Rick.

Below I tried to answer the questions you raised and I give you a
basic snipet of code to show you what we use to do with odbc and win
98 (see below) and try to do under xp.

Would you have a basic perl example that works under xp with
the ole drivers and / or a basic guide to what as to be done
to set the ole stuff.




Are you trying to connect to a VFP COM DLL, or are you just trying to
access VFP data?

not shure maybe the code can answer that querstion.

What version of VFP created the table

Version 6

Is the data in a table that is free or part of a
database?

we can access the diferent files representing tables
but they are part of a relational database







------------------- code snipet start ----------------------
use strict;
use DBI();


my $dbh = DBI->connect("dbi:ODBC:EnyoLiveOpera", "logon","password" ,
{ RaiseError => 1, odbc_cursortype => 2});

# Now retrieve data from the table.

my $sth = $dbh->prepare("select IT_DOC from itran where IT_DOC like
'%12%';");


$sth->execute();

while (my $ref = $sth->fetchrow_hashref()) {

print "Found a row: IT_DOC = $ref->{'IT_DOC'}";
}
$sth->finish();


# Disconnect from the database.
$dbh->disconnect();



------------------- code snipet end ----------------------

thanks again,

Fred



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.