Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

access oracle database from FoxPro

Status
Not open for further replies.

hbk2

Programmer
Apr 9, 2016
16
TN
vfporacle_tlxsln.png

Hi, I already established a successful connection via ODBC connection to my oracle database but when i try via Fox pro I can't establish a connection. (gnConnHandle=-1)
I'm using win 7, oracle 11g and VFP 6.
This is my code :

vfpcon="DRIVER={Oracle dans OraDb11g_home1};UID=blabla;PWD=blabla;DATASOURCE =oraclevfp;Server=localhost;DRIVER ={Oracle dans OraDb11g_home1};PORT=1158;"
gnConnHandle= SQLSTRINGCONNECT(vfpcon)
IF gnConnHandle < 0
MESSAGEBOX("Cannot make connection")
ELSE
MESSAGEBOX(" connect to database")
endif

Please can you help me ?
 
VFP can only use 32 bit drivers.

So repeat creating a DSN with the 32bit ODBC Manager and then simply try [tt]gnConnHandle = SQLCONNECT("oraclevfp")
[/tt]

Bye, Olaf.
 
In addition to what Olaf mentioned, be sure you set up your ODBC connection with the version of Odbcad32.exe found in your SysWOW64 directory.

Good Luck,
JRB-Bldr
 
Well, yes, that just describes in detail, what the 32bit ODBC Manager is. And to conclude: There are 32bit ODBC drivers for Oracle: What version of Oracle do you have? the link I just gave lists drivers for 10-12 main versions, which covers database versions since 2006.

From Windows 8 onwards the control panel differentiates and lists 2 ODBC Managers, one for 32bit drivers and one for 64bit. In Windows 7 you go to the 64bit Manager and have to locate the 32bit Manager manually in the SysWOW64 folder.

Sidenote/rant: SysWOW64 in long means System Windows32 On Windows64 and is the system folder with all 32bit versions of tools. I previously said this misnaming annoyed me, final words on this: MS should have named a new folder System64 and stayed with System32 for the subsystem. The folder names would be concise. As 64bit code was new, it could work with a new system folder. No redirection would have been needed for 32bit software, for example for 32bit installers. The way it is, the names are always interpreted inverse. The System32 name is kept for the reasoning of downward compatibility, and that is just stupid. MS redirects calls of 32bit processes. If a 32bit process tries to access the System32 folder those file system access is routed to the SysWOW64 folder. That redirection could have instead been done for 64bit processes to help lazy developers not changing their code base and not using shell API about system folders, so that access to System32 of 64bit processes was rerouted to a System64 folder. Same priciple, just the right way.

Bye, Olaf.
 
Hi, It works for me !!!
You need a 32bit oracle version and win 32bit.
Thank you :)
 
No need for 32bit Windows, no, you need to use the C:\Windows\SysWOW64\ODBCad32.exe on a 64bit OS to see and maintain DSNs using 32bit drivers.
Maybe the 32bit ODBC drivers of Oracle don't install on a 64bit Windows? It should be possible, though, you just need to use the x86 driver even on a x64 System.
Some vendors also let their setups check the right OS bitness, but put 32bit drivers and 64bit drivers together in one x64 Setup, but mostly the setups are separated, as you might even just need the 32bit drivers despite working on a 64bit Windows. For example from a 32bit Office installation 64bit drivers also won't help.

Anyway, you found a way.

Bye, Olaf.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top