当前位置:网站首页>Problems and solutions of VFP accessing Oracle under 64 bit win10 environment
Problems and solutions of VFP accessing Oracle under 64 bit win10 environment
2022-06-09 20:31:00 【VFP of Garfield】
author : Green tea @ Fox Friends Association
Previously used VFP stay 64 position WIN7 Connect and access in the environment oracle, Whether it is a / C set setting 、 Or use code to access data remotely , There have been no problems , Recently, I changed a machine , Installed 64 position WIN10 System , Follow the old routine , When testing connections and accessing databases , But there are always problems , Tossed for days , Finally, the problem was solved .
Now the pit has been filled up , In order to avoid people suffering from similar problems , Now record the whole process and solution as follows , For your reference .
VFP The remote access oracle, I used to install oracle 9i Compact client , As the access driver , Because the client size of the thin version is only ten megabytes , Easy to install .
Follow the old routine , Installed and configured 9i After the client , Then use the A / C set setting tool , Make a test connection , Here's the picture , You can see , Test success .

then , As before , Start writing code to test :
ocon = NEWOBJECT(“qiyu_connection”,“qiyu Superclass ”,“”,“test”)
ncon = ocon.createcon()
?‘ncon=’,ncon
however , Something magical has happened ,ncon Unexpectedly return -1, in other words , Connection failed . This code has been written many times before , There will be no problem , Besides, , In a / C set settings , It clearly shows that the test is successful .
I'm a little confused , To Con_set See in the table , You can see that both servername,Uid, still Pwd, as well as port etc. , There's no problem .
Then think of ,VFP It's through ODBC To connect and access oracle Of , So I came to the control panel , Be careful ,64 There are two bit systems odbc, To use 32 Bit , Here's the picture :
Input various parameters , Test connection , You can see that the connection is successful , This explanation oracle There is no problem with the driver , adopt Oracle ODBC It can be connected and accessed normally oracle.


There is no problem with the driver , Using the A / C set setting tool can also test successfully , When it comes to using code testing, problems arise , This is not the ghost ?
here , Think of the previous articles in teacher cat's official account : No client installation configuration VFP Connect Oracle database , It's really just using oracle Lightweight client for instant client Methods , To connect and access oracle, in other words , use instant client To replace the previous oracle 9i Compact client .
uninstall oracle 9i, install and configure instant cliet, Be careful , Also needed 32 Bit version , After all environment variables are configured , Go to the... Of the control panel first ODBC Medium test , Same as above ,ODBC return Connection successful, explain instant client There is no problem with the configuration .
Re execute the above code :
ocon = NEWOBJECT(“qiyu_connection”,“qiyu Superclass ”,“”,“test”)
ncon = ocon.createcon()
?‘ncon=’,ncon
result , Still return to -1, This time, I was really cheated .
Last , Modify the connection string in the cat box , The original Driver={Microsoft ODBC for Oracle};server= Change it to Driver={Oracle in instantclient_12_2};dbq=, Execute the above code again , Finally, the connection is successful ,ncon You can return a positive number .
perhaps , Follow teacher cat's advice , Do not modify the frame , First create your own handle using the connection string :
m.lcConn = “Driver={Oracle in instantclient_12_2};Dbq=;Uid=;Pwd=***;”
m.handle = SQLSTRINGCONNECT(m.lcConn)
This handle is then passed in :
oDbHelper=NEWOBJECT(“MSSQLHelper”,“MSSQLHelper.prg”,“”,m.handle)
This method can also be used ( I didn't test ).
however , It always feels bad to do this , First, the framework needs to be modified , and ,driver String , It will be installed with instant client Different versions , therefore , I still feel that I still use oracle 9i Thin client for , This makes it more versatile .
Delete instant client Environment variables of , go back to oracle 9i, And turn over all kinds of Posts again , Finally I found the problem .
The Internet says yes : Run connection Oracle The directory name of the program cannot contain parentheses . And this time I installed VFP when , The installation directory is D:\Program Files (x86)\VFP9, Is this really the problem ?
Unload immediately VFP, Re install to D:\Program Files\VFP9, All the codes have not changed , Continue testing ,ncon The value of becomes positive , The connection is successful !
At this time, I really feel like a boat capsized in the gutter , This is because the directory contains parentheses , I have been busy for several days .
The conclusion is as follows :VFP The remote access oracle, have access to oracle 9i Thin client for , You can also use instant client, In fact, both of them play the role of access driven .
But I personally still like to use 9i client , Because after installation , It can be configured automatically ( Of course ,tnsnames.ora You need to configure it yourself ), Don't be like instant client, You need to manually configure three environment variables .
边栏推荐
猜你喜欢

JVM-字节码是如何被JVM执行的+关于线程一点思想引子

Blog recommended | bookkeeper - Apache pulsar high availability / strong consistency / low latency storage implementation

Unity-UI-Slider组件

Alibaba cloud 22q1 status summary, where are you going

C language implementation of simple calculator

申请软件代码签名证书

Integer ordered array lookup -- traversal and half / bisection

【RK2206】4. Mqtt example
![[tgowt] cmake to Ninja construction](/img/e9/8ce56c421ee98c0b36464fc65dd39d.png)
[tgowt] cmake to Ninja construction

Unity UI slider component
随机推荐
Jerry's modification to improve the output frame rate of camera source video [chapter]
官宣!博通将以610亿美元收购VMware,并承担80亿美元债务
C#中运算符重载的例子
Jvm- how the bytecode is executed by the JVM + a little thought about the thread primer
杰理之修改video_buf_config.h的应用层视频缓冲区大小【篇】
95 ans plus tard, le programmeur de Big Factory a été condamné à neuf mois de prison pour avoir supprimé la bibliothèque.
Common regular expressions
c#逆序排序
【RK2206】4. MQTT示例
Jerry's image transmission, recording card or camera displayed by UVC - description of high frame rate [article]
The HMI Software memory is abnormal, resulting in a crash exit bug
Neo4j桌面版数据库备份
Discussion on mobx
做产品规划的技巧心得
asp. Net datatable and some notes of table
Jerry's use of network diagram to replace LwIP library and WiFi library [chapter]
SSM driving school management system
C#关于抽象类的学习
TiDB单机、集群环境安装,单机急速体验
How to query the database with eloquent in laravel (select)