QuickTest Professional connection methods for various databases __ database

Source: Internet
Author: User
Tags db2 db2 odbc driver dba dsn ibm db2 ibm db2 odbc driver odbc mysql odbc driver
SQL Server format (no need to install SQL Server locally)
ConnectionString (Connection string):
1. There is no way to create a data source locally
Driver=sql Server; server= database IP address; uid= user name; pwd= password; App=microsoft Office 2003; Wsid= Local host name; database= database name

Instance:
Driver=sql Server; server=10.160.11.10; Uid=sa; Pwd=sa; App=microsoft Office 2003; Wsid=rjhljun;database=dcwork

2. How to create a data source locally
dsn= data source name; uid= user name; pwd= password; App=microsoft Office 2003; Wsid= the host name of the database; database= database name

Instance:
Dsn=localserver; Uid=sa; Pwd=sa; App=microsoft Office 2003; Wsid=rjdcworktest;database=dcwork

3.SQL statement instance (from database table Hr_language_type, query field language name Language_name, conditional language name = Chinese, sort result by language name Ascending)
Source (SQL statement):
SELECT Hr_language_type. Language_name from Dcwork.dbo.HR_LANGUAGE_TYPE hr_language_type WHERE (hr_language_type. Language_name= ' Chinese ') Order by Hr_language_type. Language_name


Second, DB2 format: (locally installed at least DB2 run-time Client Lite)
ConnectionString (Connection string):
1. There is no way to create a data source locally
DRIVER={IBM DB2 ODBC DRIVER}; uid= user name; pwd= password; mode=share;dbalias= database name;

Instance:
DRIVER={IBM DB2 ODBC DRIVER}; Uid=db2admin; Pwd=db2admin; Mode=share;dbalias=dcwork;

2. How to create a data source locally
dsn= data source name; uid= user name; pwd= password; Mode=share;dbalias=dcwork;

Instance:
DSN=DWCORKDB2; Uid=db2admin; Pwd=db2admin; Mode=share;dbalias=dcwork;

3.SQL Statement Instance
Source:sql statement
SELECT Hr_language_type. Language_name from Db2admin.hr_language_type hr_language_type WHERE (hr_language_type. Language_name= ' Chinese ') Order by Hr_language_type. Language_name


Oracle format: (local need to install Oracle ODBC DRIVER)
ConnectionString (Connection string):
1. There is no way to create a data source locally
Driver={oracle in OraHome92}; server= database service name; uid= user name; pwd= password; dbq= database name; dba=w; apa=t; Exc=f; Xsm=default; fen=t; qto=t; frc=10; fdl=10; lob=t; rst=t; Gde=f; Frl=lo; bam=ifallsuccessful; Mts=f; Mdi=me; Csr=f; Fwc=f; pfc=10; Tlo=o;

Open QTP
1.insert--checkpoint--database checkpoint
2. In the pop-up window select the second item specify SQL ..., then click Next, and then click Create
Create your own ODBC, if you can link Oracle, there should be no problem in the QTP playback
Mine is Linux as4+oracle 10G.
The script in the QTP is
Dim Cnn
Set Cnn = CreateObject ("ADODB.") Connection ")
cnn.connectionstring = "driver={oracle in Oraclient10g_home1}"; Server=test; Uid=system; Pwd=test;dbq=test;dba=w; apa=t; Exc=f; Xsm=default; fen=t; qto=t; frc=10; fdl=10; lob=t; rst=t; Btd=f; bam=ifallsuccessful; Num=nls;dpm=f; mts=t; Mdi=me; Csr=f; Fwc=f; fbs=60000; Tlo=o; "

Cnn.open
If cnn.state = 0 Then
Reporter.reportevent Micfail, "testing", "Connection database Failed"
Else
Reporter.reportevent Micpass, "testing", "Connection Database Success" End If
The playback is through! First make sure your ODBC is connected properly first!

Four MySQL format: (local need to install MySQL ODBC DRIVER) Dim Cnn
Set Cnn = CreateObject ("ADODB.") Connection ")
cnn.connectionstring = "database=testmysql;dsn=192.168.1.63;option=0; pwd=123456; port=0; server=192.168.1.63; Uid=root "
Cnn.open
If cnn.state = 0 Then
Reporter.reportevent Micfail, "testing", "Connection database Failed"
Else
Reporter.reportevent Micpass, "testing", "Connect database successfully"
End If

2. How to create a data source locally
dsn= data source name; uid= user name; pwd= password; dbq= database name; dba=w; apa=t; Exc=f; fen=t; qto=t; frc=10; fdl=10; lob=t; rst=t; Gde=f; Frl=f; bam=ifallsuccessful; Mts=f; Mdi=f; Csr=f; Fwc=f; pfc=10; tlo=0;

Instance:
Dsn=dcworkoracle; Uid=dcwork;dbq=dcwork;dba=w; apa=t; Exc=f; fen=t; qto=t; frc=10; fdl=10; lob=t; rst=t; Gde=f; Frl=f; bam=ifallsuccessful; Mts=f; Mdi=f; Csr=f; Fwc=f; pfc=10; tlo=0;

3.SQL Statement Instance
Source:sql statement
SELECT Hr_language_type. Language_name from Dcwork.hr_language_type hr_language_type WHERE (hr_language_type. Language_name= ' Chinese ') Order by Hr_language_type. Language_name

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.