As a powerful database front-end development tool, Delphi provides encapsulation controls for many database access methods. For Oracle Data Access Controls, No matter what database engine, a connection is generally encapsulated as a data set Connection Control. Therefore, you only need to set the relevant properties of the connection, and other dataset controls, such as query, you only need to specify this connection for table and so on. To connect the client application to the schema of Oracle, you generally need to install the Oracle client, use Net manager to set the host name, access protocol, port, and other information of the Oracle database server that the client can access. You can use the following method to connect to 1. dbexpress: dbexpress is more suitable for connecting to SQL databases. It is said that the efficiency is quite high. Place the sqlconnection on the dbexpress tab, right-click the control, select the "Edit connection Properities" function, and click set. The database field must be set to the service name set in the Oracle client. If you need to remember the password instead of entering the password each time you connect, set the loginprompt attribute to false, after setting OK, you can test whether connected: = true is successful. For other data processing controls, select the control on the corresponding dbexpress tab. 2. BDE: BDE should be Borland's own database engine, and the efficiency is quite good. Of course, Oracle connections are also supported. Use the Database Control signed by the BDE page. For the setting method, refer to: 3. ADO: ADO is a database connection technology supported by Microsoft, which means a Windows client data access engine. NET platform, launched ADO. net, better support for XML. Delphi encapsulates ADO and uses adoconnection to set its connectionstring through the Wizard. For details, see: 4. ODBC: ODBC is the most traditional connection method, which is relatively less efficient, but more universal. We do not recommend this method. Before use, you must first add a data source name DSN in ODBC settings, and then use the ADO or BDE component to access data. You can refer to settings for example:
5. Do not use controls, such as using native ADO components. This method is not recommended. Since Delphi has been encapsulated, why should it return to the original state. The above connection methods require the installation of Oracle client software, but the official Oracle client is too large and inconvenient to install. Currently, someone has released a lite version of Oracle client software on the Internet, which is relatively small, to meet the needs of connecting to Oracle, you can download the software without installing complex official versions. 6. download the odac control. You do not need to install the Oracle client. Instead, you can directly connect to the Oracle server through the TCP/IP protocol using the OCI method. You can make the program into a thin client, it is convenient to distribute programs. This control supports most versions of Delphi, C ++ builder, kylix, And. net, and provides source code. If you are interested, you can study it. For more information about the installation and usage, see the related instructions and help documents of the control.