Summary of QTP connection to oracle Database
First of all, because many friends in the Group say that QTP is a little troublesome to connect to oracle, I am doing a complete tutorial on connecting to oracle. If you want to learn it, you can refer to it. The specific method is as follows:
1. No matter what language it is, it is essential to connect to the oracle client, which cannot be saved; I use 10g_win32_client; if you think you are old, you can use the new version;
Decompress the package and install the package. The next step is nothing more than configuration. We will not talk about the configuration here. I will talk about the configuration here;
①
The following figure roughly describes the procedure. If it still does not, you can find it on Baidu. If you configure the oracle client, it will be detailed.
2. Configure the data source (ODBC) (For win7 configuration)
①-Open Control Panel-system and security-management tools-Data Source (ODBC)
Add User Data Source
Select oracle driver
Enter the corresponding information
Test whether the connection is successful
In this way, odbc configuration is complete;
3. Start to connect to the database;
Create a new. txt file and modify the name of the extension * in the local database *. udl, double-click *. in the udl file, open the database link property, locate the "provider" and select the graphics card, select the oracle connection to oracle provider for ole db, click Next, enter the data source, database username and password, click test connection and open it with UE or notepad *. the udl file and the oracle connection string have been generated,
In this way, even if the configuration is successful, and then open oracle. udl in text,
Provider = OraOLEDB. Oracle.1; Persist Security Info = False; User ID = BPMUSER2; Data Source = CEDATA
Add password: Use; Separate: Provider = OraOLEDB. Oracle.1; Persist? Security? Info = False; User? ID = BPMUSER2; Password = BPMUSER2; Data? Source = CEDATA
Then write the qtp Test
'--------------------------------------- ' Name: oracle_nextAPPROVEID authentication required parameter 'function: query the database to find the next approver. Then, the following parameter is returned: use: QTP. oracle_nextAPPROVEID ("-") contains invalid Parameter Function When oracle_nextAPPROVEID (FormID) zookeeper has just been released. zookeeper has just been released. zookeeper Dim has been released. Cnn has been released. 'A database connection string is defined. zookeeper has been released. zookeeper has been released. hybriddb for MySQL uses hybriddb for MySQL. connection ") Too many connections have been made too many Cnn. open logging = "Provider = OraOLEDB. oracle.1; Persist Guest Security token Info = False; User Login ID = BPMUSER2; Password = BPMUSER2; data transmission Source = CEDATA "has been released because there are already too many such problems. state success = Success 0 when Then has been passed into success or not 'checks whether the database connection is successful. debug ("[Cnn. state] invalid Cnn. state failed = running "failed & failed Cnn. state) when there are too many statistics, there are too many statistics reported. functionOut ("[Cnn. state] invalid Cnn. state failed = running "failed & failed Cnn. state) when there are too many threads when there are too many threads before they begin to Exit the Function when there are too many threads else If there are too many threads before they begin cnn. state <> running 0 has been completed Then has been released too many reports. debug ("[Cnn. state] invalid Cnn. state failed = running "failed & failed Cnn. state) when there are too many bytes before Set errors Rs = CreateObject ("ADODB. recordset ") Specifies whether or not the record set object is generated. Then, the record set object has been created before 'formid = mongochr (34) & FormID & chr (34) too many errors have been reported. debug ("[FormID] pipeline FormID pipeline = Pipeline" pipeline & pipeline FormID) too many rows have been written into each other before using SQL statements = "select distinct * distinct from (select distinct B. ID,. PROCESSID, APPROVEID should begin from pipeline FORM_MASTER_INFO should a pipeline inner should join pipeline FORM_HISTORY_INFO should B should on pipeline. PROCESSID = B. PROCESSID authentication and authentication. FORMRESULT = 'n' WHERE else. PROCESSID = comment '"& FormID &"' cannot exceed order limit by limit B. ID shortdesc) When where then rownum = 1 "when too many rows have been reported. debug ("[SQL] Explain SQL explain = explain" Explain & explain SQL) too many errors have been reported when there are too many errors On our Error processing Resume processing next packet has been reported when there are too many errors over Rs. open tracing SQL statement execution, Cnn, 1, 3 minutes interval 'Execute SQL statements, and records can be freely moved, the singular record is in read-only mode. when reading the invalid uid = Rs ("APPROVEID") Comment ", the record whose field is custid is obtained, the cursor is defined in the first row. Therefore, the first row of the field is obtained. debug ("[uid] upgrade uid failed = upgrade" upgrade & Upgrade uid) upgrade oracle_nextAPPROVEID failed = "(" & Upgrade uid &") "Please wait until there are too many missing 'msgbox missing uid missing starting End even If there are already missing end Functions
You can call it to complete the process. You need to close the connection to complete the process.
RS. close 'close record set
Set RS = nothing 'release the object
Cnn. Close 'Close the data connection
Set Cnn = nothing 'release the object
These are post-statements.