InstallShield advanced application-test whether Volume l can be connected

Source: Internet
Author: User

Implementation principle: Oracle database connection is implemented using Microsoft ODBC for Oracle.

Connect to the ACCESS database using the Oracle database string and the "ADODB. Connection" object. Determine whether the database can be connected successfully.

Note: The current computer must contain ADODB. Connection objects.

Source code:

 

Export prototype bool db_check1_lercon (byref string, byref string );
// Driver = {Microsoft ODBC for Oracle}; server = myserveraddress; uid = myusername; Pwd = mypassword;
// Driver = {Microsoft ODBC driver for Oracle}; connectstring = oracleserver. World; uid = myusername; Pwd = mypassword;
// ================================================ ======================================== //
// Function: db_checkpoliclercon //
////
// Purpose: test whether oracl can be connected //
////
// Argment: svservername-name of the Oracle Connection Service //
// Svusername-Logon account //
// Svuserpassword-Logon password //
// Return: True-connection succeeded; false-Connection Failed //
// Remark: This verification uses Microsoft ODBC for Oracle verification //
// ================================================ ======================================== //
Function bool db_checkpoliclercon (svservername, svusername, svuserpassword, szerror)
Object padoconnobj, padorecordsetobj, pdbconobj;
String szadoconnobjid, szadorecordsetobjid, szconnstring, szsql, svdriver;
Bool bexists;
Begin
Svdriver = "Microsoft ODBC for Oracle ";
Bexists = false;
Try
// Create ADO connection object to connect to the SQL Server
Szadoconnobjid = "ADODB. Connection ";
Set padoconnobj = Createobject (szadoconnobjid );

// Create the Oracle string to complete the connection
Szconnstring = "driver = {" + svdriver + "};";
Szconnstring = szconnstring + "Server =" + svservername + ";";
Szconnstring = szconnstring + "uid =" + svusername + ";";
Szconnstring = szconnstring + "Pwd =" + svuserpassword + ";";
// Szconnstring = szconnstring + "database = Master ";

// Open the ADO connection
Padoconnobj. Open (szconnstring );
Bexists = true;
Catch
Sprintf (szerror, "error: Number: % d;", Err. number );
Szerror = szerror + "Desc:" + err. description;
Bexists = false;
// Clean up
Set padoconnobj = nothing;
Endcatch;
Set padoconnobj = nothing;
Return bexists;
End;

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.