Using ASP to connect to Informix full scheme with components

Source: Internet
Author: User
Note: This scenario is intended for use by ASP to connect all types of databases through their own development components
Some enterprise databases now use Informix, and most developers have fewer operations on the database,
Because the current company has been eaten by IBM, and IBM main push is its DB2, not many
Using the OLE DB component, the connection is established through Server.CreateObject ("adodb.connection"), even
Can be successful, but the speed is full of panic, especially the number of data bar more than 20,000 of the table, even if only
is a query, and almost not out, the entire ASP host the efficiency of plummeting, memory consumption increased. Right
To this issue, I used Delphi to write a simple component.
The main code is as follows:
Unit main;
{$WARN Symbol_platform off}
Interface
Uses
ActiveX, Mtsobj, Mtx, Comobj, Aspbde_tlb, stdvcl,db,dbtables,sysutils;
Type
Tbdeasp = Class (Tmtsautoobject, ibdeasp)
Protected
function open (const SQLSTR, aliname:widestring): olevariant;
Safecall;
function execute (const SQLSTR, connstr:widestring): olevariant;
Safecall;
{Protected declarations}
End
Implementation
Uses Comserv;
function Tbdeasp.open (const SQLSTR, aliname:widestring): olevariant;
Var
Tmpre:variant;
Begin
Tmpre:=createoleobject (' Adodb.recordset ');
Try
Tmpre.open (Sqlstr,aliname);
Except
End
Result:=tmpre;
End
function Tbdeasp.execute (const SQLSTR, connstr:widestring): olevariant;
Var
Tmpre:variant;
Begin
Tmpre:=createoleobject (' adodb.connection ');
Try
Tmpre.open (CONNSTR);
Tmpre.execute (SQLSTR);
Result:=1;
Except
result:=0;
End
End
Initialization
Tautoobjectfactory.create (COMServer, tbdeasp, class_bdeasp,
Cimultiinstance, Tmboth);
End.
This program only wrote the simplest two methods Open,execute, you can add according to their own needs
Other methods, attributes, and so on.
The method is invoked as follows:
Ser var=server.createobject ("appname.bdeasp")
Set Rs=var.open ("SQL statement", "database connection statement")
Rs use method and Adodb.recordset objects exactly the same, after testing, speed significantly accelerated!!! System
Consume a lot of drop, 20 million data table, query speed very quickly.

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.