Brief introduction to Delphi7.0 three ways to connect Oracle databases

Source: Internet
Author: User
Tags most popular database
Oracle, a large relational database based on advanced Structured Query Language (SQL), is one of the most popular database of client/server (Client/server) architectures, and is now widely used in information management of various types of enterprises. Database support is an important feature of Delphi7.0 development environment, many programmers use Delphi7.0 as development tool in database application development to realize access and control to database. Delphi database applications use the database engine to access the data sources they reference. This article provides a general overview of the 3 ways in which you Delphi7.0 connect Oracle databases in a Windows XP environment, BDE, ADO, dbexpress, respectively. These 3 ways require the installation of Oracle clients and the configuration of Tnsnames.ora files. Install the Oracle client to the local computer, open the C:/oracle/.../network/admin/tnsnames.ora file, add the following content to the configuration of the database you want to access, TEST = (DESCRIPTION = (address_ LIST = (Address = (PROTOCOL = TCP) (HOST = 172.16.2.134) (PORT = 1521)) (Connect_data = (SID = test)) where the value of Host,port,sid is Related to the database configuration you are accessing. 1 The traditional BDE BDE (Borland database Engine) uses aliases to refer to databases files or directories, and you need to install BDE with the application on the client's computer. Connection Step: 1.1 Install BDE. The Delphi7.0 installation disk contains the BDE installer, the computer that is installed by default, and the alias of the Oracle database you want to access, for example: Test. 1.2 Connect the Oracle database in the Delphi7.0 program. Place the Tdatabase component in the BDE tab into the main form of the application, double-click Tdatabase, and the Tdatabase component editor, enter the database alias, username, and password, and click the OK button. Set the Loginprompt property value of the Tdatabase component to false in the object Viewer (avoid the Login dialog box, below), set the Tdatabase component's connected property to true, so that the Oracle server is successfully connected. 1.3 Use the Ttable component to access the data. Place the Ttable component in the application's main form and set its databasenameThe sex value is test, then the Tdatasource and Tdbgrid components are added, and the next step is the same as developing the local database application. 2 Microsoft's ADO ado (ActiveX Data Objects) is a Microsoft advanced interface, based on Microsoft's data access to OLE DB technology. Connection Step: 2.1 Connect Oracle Database in Delphi7.0 program. Place the Tadoconnection component in the ADO tab into the main form of the application, double-click Tadoconnection, select Use Connection String in the dialog box that appears, and enter in the box below: provider= Msdaora.1; User Id=test;data source=test; Persist security Info=false, where test is the Oracle server name and user name. Set the Loginprompt property value of the Tadoconnection component to false in the object Viewer to set the connected property value of the Tadoconnection component to true so that the Oracle server is successfully connected. 2.2 Use the Tadocommand component to access the data. Place the Tadocommand component in the main form of the application, set its Connec tion property value to Connection1, click its CommandText property value, and enter the SQL query statement in the dialog box that appears (this article takes the query data as an example), Add the Tdatasource and Tdbgrid components, and the next work is the same as developing a local database application. 3 new generation of platform's database access engine dbexpress dbexpress is a set of newer components, technologies and drivers, boasting platform capabilities, allowing programmers to develop more efficient database applications, thus becoming the core data access technology for Delphi and Kylix. Connection Step: 3.1 Connect Oracle Database in Delphi7.0 program. Place the Tsqlconnection component in the Dbexpress tab into the main form of the application, double-click Tqlconnection, and the Tsqlconnection component editor, select Oracle as driver name, enter the database name, Username and password, click OK button. Setting the Loginprompt property value of the Tsqlconnection component to false in the object Viewer will tsqlconnection the component's connectedThe property value is set to true so that it is successfully connected to the Oracle server. 3.2 Use the Tsqldataset component to access the data. Place the Tsqldataset component in the main form of the application, set its Sqlconne ction property value to SQLConnection1, click its CommandText property value, and enter the SQL query statement in the dialog box that appears (this article takes the query data as an example), Add the Tdatasource and Tdbgrid components, and the next work is the same as developing a local database application. 4 conclusion BDE is the previous generation of data engine, has entered the maintenance state, not easy to have a substantial improvement, for the newly developed database applications, if there is no special requirements of the proposed do not use it; in Windows platform with dbexpress or ADO I didn't find much difference, Dbexpress faster; If you want to develop a platform-like database application, it's better to use dbexpress. Google's photo software. The software you need to buy the camera
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.