MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old July 12th, 2004, 05:54 AM
Bingo Bingo is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 1 Bingo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
MyODBC And MySQL Connections

Hi !

I am trying to use MyODBC (3.51) to connect to a MySQL server in ASP pages.
Everything works fine, but I ran in a problem when trying to use a temporary table.
The MySQL documentation states that the temporary table will be dropped whenever the connection is closed.
But it does not seem to be the case ! Here is the code :

<%
Dim adoConn
Dim adoRS
Dim strSQLQuery

Set adoConn = Server.CreateObject("ADODB.Connection")
Set adoRS = Server.CreateObject("ADODB.Recordset")

adoConn.Open "DSN=mysqlDSN"

If adoConn.errors.count = 0 Then
adoRS.ActiveConnection = adoConn
adoRS.CursorLocation = adUseClient

strSQLQuery = "FLUSH TABLES;"
adoConn.Execute strSQLQuery

strSQLQuery = "CREATE TEMPORARY TABLE TempTable SELECT * FROM SomeTable WHERE SomeTable.SomeField = 'SomeValue'"
adoConn.Execute strSQLQuery

strSQLQuery = "SELECT * FROM TempTable"
adoRS.Open strSQLQuery
Response.Write adoRS.RecordCount
adoRS.Close
Set adoRS = Nothing
End If

adoConn.Close
Set adoCOnn = Nothing
%>

First execution of the page runs just fine, but if I reload it, then I get an error :
[MySQL][ODBC 3.51 Driver][mysqld-4.1.1a-alpha-nt-log]Table 'temptable' already exists

As you can see, I DID close the connection in ADO, but did it actually close it in MySQL ? Why is the page reusing the same connection then ?
Well... The real question is : what should I do ?

Thanks a lot for helping !

Bingo

Reply With Quote
  #2  
Old January 12th, 2005, 07:00 PM
Slava Slava is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 1 Slava User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Temporary table is not deleted after ADO Connection.Close method used.

Hi, Bingo.

Just joined this forum to see the thread on your post and did not find any... I am having the same problem - did you found any solution?

Please, respond to forum or directly webdev@shabrov.com

Thanks in advance.

Slava.


Quote:
Originally Posted by Bingo
Hi !

I am trying to use MyODBC (3.51) to connect to a MySQL server in ASP pages.
Everything works fine, but I ran in a problem when trying to use a temporary table.
The MySQL documentation states that the temporary table will be dropped whenever the connection is closed.
But it does not seem to be the case ! Here is the code :

<%
Dim adoConn
Dim adoRS
Dim strSQLQuery

Set adoConn = Server.CreateObject("ADODB.Connection")
Set adoRS = Server.CreateObject("ADODB.Recordset")

adoConn.Open "DSN=mysqlDSN"

If adoConn.errors.count = 0 Then
adoRS.ActiveConnection = adoConn
adoRS.CursorLocation = adUseClient

strSQLQuery = "FLUSH TABLES;"
adoConn.Execute strSQLQuery

strSQLQuery = "CREATE TEMPORARY TABLE TempTable SELECT * FROM SomeTable WHERE SomeTable.SomeField = 'SomeValue'"
adoConn.Execute strSQLQuery

strSQLQuery = "SELECT * FROM TempTable"
adoRS.Open strSQLQuery
Response.Write adoRS.RecordCount
adoRS.Close
Set adoRS = Nothing
End If

adoConn.Close
Set adoCOnn = Nothing
%>

First execution of the page runs just fine, but if I reload it, then I get an error :
[MySQL][ODBC 3.51 Driver][mysqld-4.1.1a-alpha-nt-log]Table 'temptable' already exists

As you can see, I DID close the connection in ADO, but did it actually close it in MySQL ? Why is the page reusing the same connection then ?
Well... The real question is : what should I do ?

Thanks a lot for helping !

Bingo

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > MyODBC And MySQL Connections


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway