Notes for using MySQL Databases in ASP

Source: Internet
Author: User

Environment: WINXP SP2, mysql5.0.18, and MySQL ODBC 3.51 driver tables use the MyISAM engine. Access 2003

Different Places:
1. When inserting data, MySQL should try to use the insert into statement to avoid using RS. addnew. If not, set conn first. cursorlocation = 3 otherwise, an error is certainly reported, and I found that using insert is about three times faster than addnew. In addition, if you use Rs. addnew when you use Rs. Update, you cannot immediately obtain the value of RS ("ID") in access.
2. Comparison with access:
In the same table structure, when 20000 pieces of data are inserted using insert, MySQL is converted into 7.5 seconds. If Rs. addnew is used, it takes 24 seconds! In access, insert is converted to 19.8 seconds, while Rs. addnew is converted to 2.8 seconds!
Query comparison: Access queries for 40 million pieces of data are converted into 12 seconds, and MySQL queries are converted into 14 seconds, which is a little slower.

Summary: In general, the access insertion speed is about three times faster than that of MySQL. When querying data, if the data volume is small, access is about twice faster than mysql. However, when the data volume is large, the query speed of MySQL does not change much, but access is greatly reduced.
Of course, MySQL should be faster than access. I guess the problem lies in its ODBC driver, while the access driver uses Ole, and Microsoft has made many optimizations for it, in this test, MySQL is wronged! I didn't test the concurrency performance, but I think access should be much inferior to MySQL.

If you want to use
Rs. pagecount
Rs. pagesize
Rs. absolutepage
Rs. recordcount
For this attribute, you must first conn. cursorlocation = 3
Otherwise, all the above attributes cannot be used.
To prevent garbled characters and Chinese characters, you must immediately: conn. Execute ("set names 'gb2312'") after conn. Open '")
Otherwise, an error is inserted, and the garbled characters are not discussed.

Connection method:

'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

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.