Using the MySQL database in ASP to realize the application skills

Source: Internet
Author: User
Tags odbc
Environment: WinXP SP2, mysql5.0.18,mysql ODBC 3.51 driver table uses MyISAM engine. Access 2003

Different places:
1, insert data, MySQL should try to use INSERT INTO statement, avoid using rs.addnew, if not to use, should first set Conn. Cursorlocation=3 Otherwise, definitely the error, and I found that insert is about 3 times times faster than AddNew. Also, if you use rs.addnew when you are rs.update, you cannot expect to get the value of RS ("id") immediately in Access.
2, and access comparison:
The same table structure, with insert 20,000 data, MySQL 7.5 seconds, if the use of rs.addnew will be 24 seconds! In Access, the insert is changed for 19.8 seconds, rs.addnew only 2.8 seconds!
Query comparison: Access query 40w data for 12 seconds, MySQL 14 seconds, a little bit slower.

Summary: In general, access is about three times times faster to insert than MySQL. Query data, if the amount of data is small, access is about twice times faster than MySQL, but when the volume of data is very large, the query speed of MySQL changes little, but access is down more severe.
Of course, MySQL should be faster than access, I guess the problem is in his ODBC driver, and access is the driver of OLE, Microsoft has made a lot of optimizations for him, so, in this test, MySQL avenge! As for concurrent performance, I didn't test it, but I think access should be much less than MySQL.

If you want to use
Rs.pagecount
Rs.pagesize
Rs. AbsolutePage
Rs.recordcount
Such attributes, you must first Conn. Cursorlocation=3
Otherwise, none of the above attributes can be used.
Also in order to prevent garbled and insert Chinese errors, you must conn.open immediately after: Conn.execute ("SET NAMES ' gb2312")
Otherwise, certainly inserts the error, and the garbled is not negotiable.

Connection mode:

' Connect with System DNS:
Strconnection= "DSN=MYSQL; Option=16384;driver={mysql ODBC 3.51 Driver};server=127.0.0.1;uid=root;pwd=67918;database=test "
' Connect directly with strings:
' strconnection= ' driver={mysql ODBC 3.51 Driver}; Server=localhost; port=3306; option=0; socket=; stmt=; Database=test; Uid=root; pwd=67918;option=16384 "
Set Conn=server.createobject ("Adodb.connection")
Conn. Cursorlocation=3
Conn.Open strconnection
Related Article

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.