BorlandC++使用BDE訪問Oracle的方法
BorlandC++使用BDE訪問Oracle是我們計算機朋友經常遇到的問題,下面小編爲大家整理了一些方法,希望對你有所幫助!
系統HRef="https://bimogu.com/tags-132-0.html" target="_blank" >環境:
1、操作系統:Windows 2000 Server
2、數據庫: Oracle 8i R2 (8.1.6) for NT 企業版
3、開發工具:Borland C++ Builder 5 企業版
連接方法:
一、安裝 Oracle 8i R2 (8.1.6) for NT 企業版
使用典型安裝,安裝目錄爲D:Oracle;
二、安裝 Borland C++ Builder 5 企業版
把 Borland C++ Builder 5 光盤放入光驅,使用典型安裝,
安裝目錄爲C:Program FilesBorlandCBuilder5;
三、生成Oracle實驗記錄
連入SQL*Plus,以system/manager用戶登錄
SQL> conn system/manager
創建新的用戶:如user1/pass1,賦予connect,resource權限。
SQL> grant connect,resource to user1 identified by pass1;
SQL> conn user1/pass1
SQL> create table test(a number,b char(19));
SQL> insert into test values(1,to_char(sysdate,'yyyy-mm-dd hh24:mi:ss'));
SQL> insert into test values(2,to_char(sysdate,'yyyy-mm-dd hh24:mi:ss'));
SQL> insert into test values(3,to_char(sysdate,'yyyy-mm-dd hh24:mi:ss'));
SQL> insert into test values(4,to_char(sysdate,'yyyy-mm-dd hh24:mi:ss'));
SQL> insert into test values(5,to_char(sysdate,'yyyy-mm-dd hh24:mi:ss'));
SQL> commit;
SQL> select * from test;
A B
---------- -------------------
1 2000-11-28 20:27:33
2 2000-11-28 20:27:36
3 2000-11-28 20:27:38
4 2000-11-28 20:27:40
5 2000-11-28 20:27:52
D:OracleOra81networkADMIN中有如下內容:
test =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = )(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = oradb)
)
)
總結:
Oracle service_names: oradb
Oracle用戶名: user1
戶名密碼: pass1
測試表名: test
tnsnames: test
四、配置BDE
開始->程序->Borland C++Builder 5->BDE Administrator
1、配置Drivers,修改以下幾個地方.
DLL32:
VENDOR INIT:
LANGDRIVER: Oracle SQL WE850
SQLPASSTHRU MODE: SHARED NOAUTOCOMMIT
清除SERVER NAME和USER NAME
修改完,按鼠標右鍵,apply(CTRL+A),提交修改
2、配置Database Aliases(數據庫訪問別名),新建一個別名,起名爲oracle.
3、修改以下幾個地方.
SERVER NAME: test
修改完,按鼠標右鍵,apply(CTRL+A),提交修改,退出BDE Administrator
重新打開BDE Administrator,用鼠標左鍵雙擊別名oracle,進行連接測試
輸入用戶名、密碼,按“OK”連接,不能把user1/pass1直接寫在User Name上,要分開寫
五、啓動 Borland C++ Builder 5 企業版,寫連接 Oracle 的 C++ Builder 程序
開始->程序->Borland C++Builder 5->C++Builder 5
File->New...->Application.
C++ Builder 開發窗口上方的`工具箱面板:
打開Data Access控件組,用鼠標雙擊控件Table,再雙擊DataSource控件, 把它們放到窗體Form1上,默認名稱爲Table1和DataSource1:
打開Data Controls控件組,用鼠標雙擊DBGrid控件(上圖中畫紅框的),
把它放到窗體Form1上,默認名稱爲DBGrid1,
修改控件Table1、DataSource1、DBGrid1的屬性,Table1的Active屬性:True
Table1的DatabaseName屬性:oracle(即是選BDE名)
Table1的TableName屬性:TEST(這裏需要連接oracle)
DataSource1的DataSet屬性:Table1
DBGrid的DataSource屬性:DataSource1
按F9,運行此程序,彈出登錄畫面,
輸入用戶名、密碼,按“OK”.
相關文章
-
Win10系統提示Officebackgroundtaskhandler.exe彈窗問題的解決方
win10系統經常彈出名稱爲“”的.彈窗怎麼辦?如何解決?針對這一問題,本文就爲大家圖文介紹Win10系統彈窗問題的解決方法,有興趣的朋友們就來了解下吧!前陣子有不少朋友反映,自己 Windows 10 屏幕總是會彈出一個神祕窗口,眼疾 -
Diaspora Finance Powers Global Development美文欣賞
Diaspora Finance Powers Global DevelopmentLuis Lopez-Ramirez, a 30-year old Honduran immigrant, makes pizza.He has worked two jobs over 16 hours each day.He carefully saves his money and rents a small -
Oracle認證:ORACLE綁定變量BINDPEEKING
ORACLE 在9i之後引入了bind peeking,通過bind peeking,oracle可以在硬解析的時候窺探綁定變量的值,並根據當前綁定變量的值生成執行計劃。在oracle 9i之前的版本中,oracle僅僅通過統計信息來生成執行計劃。下面看一下不 -
A Lifeguard at Johns Beach Saved a Drowning Child,A Lifeguar英語作文
在生活、工作和學習中,大家一定都接觸過作文吧,作文是人們把記憶中所存儲的有關知識、經驗和思想用書面形式表達出來的記敘方式。爲了讓您在寫作文時更加簡單方便,下面是小編收集整理的'A Lifeguard at Johns Beach Sav -
Should Private Cars Be Encouraged in China高中英語作文
with the rapid development of economy in china, the number of people who own private cars is rising day after day. quite different views eist as to this e is no doubt that private cars have been playi -
World Day to Combat Desertification大學英語作文
Desertification is a process. In many parts of the world, the desert is spreading and the experts have tired to find all the ways to stop the cropland from being desert. In order to call for the publi -
英語美文閱讀:Kerry: Anti-IS Coalition Could Contribute to B
U.S. Secretary of State John Kerry says inteational cooperation in the fight against Islamic State militants could contribute to broader Middle East peace. Kerry says the Obama administration is commi -
英國文學I wondered lonely as a cloud的賞析整理
英國文學I wondered lonely as a cloud賞析整理I Wandered Lonely as a Cloud By William Wordsworth一.I wandered lonely as a cloud我好似一朵孤獨的流雲,(Simile) That floats on high o'er vales and hills,高 -
關於javascript中encodeURI和decodeURI的使用方法
關於java script中encodeURI和decodeURI的使用方法 一、基本概念encodeURI和decodeURI是成對來使用的,因爲瀏覽器的`地址欄有中文字符的話,可以會出現不可預期的錯誤,所以可以encodeURI把非英文字符轉化爲英文編 -
Djokovic Fulfilled Career Grand英語作文
在現實生活或工作學習中,大家都不可避免地要接觸到作文吧,寫作文可以鍛鍊我們的獨處習慣,讓自己的心靜下來,思考自己未來的方向。那麼你知道一篇好的'作文該怎麼寫嗎?下面是小編爲大家整理的Djokovic Fulfilled Career Gr