<BEGIN SHAMELESS PLUG> Hi Kevin;
You may want to look at the online article I wrote at http://www.dynamergy.com/mike/articles/blobaccessvb.html which covers use of the stream object in detail. While written for VB, it should be easy enough to convert to ASP. Mike Hillyer <END SHAMELESS PLUG> -----Original Message----- From: Kevin Wixson [mailto:[EMAIL PROTECTED]] Sent: Monday, December 30, 2002 10:29 AM To: [EMAIL PROTECTED] Subject: Binary Data and BLOB Problem Having trouble with my first MySQL database. I want to upload and install image files to a database for online sample photo gallery for our customers. The system I've created so far sometimes works, sometimes doesn't. It seems to depend on the size of the file being uploaded, but tests have been inconclusive. Having trouble diagnosing the problem since the error is most often "Internal Server Error," which doesn't tell me much. Otherwise I get: Microsoft OLE DB Provider for ODBC Drivers error '80040e21' [MySQL][ODBC 3.51 Driver][mysqld-4.0.5-beta-max-nt]Lost connection to MySQL server during query /shooters/Insert.asp, line 148 The relevant code is: ' Checking to make sure if file was uploaded If fileSize > 0 Then set rsImage = Server.CreateObject("ADODB.Recordset") rsImage.ActiveConnection = MM_connShooters_STRING rsImage.Source = "select * from web_lab.Images limit 0" rsImage.CursorType = adOpenKeyset rsImage.CursorLocation = adUseClient rsImage.LockType = adLockPessimistic rsImage.Open() rsImage_numRows = 0 ' Adding data rsImage.AddNew rsImage("userID") = userID rsImage("imageType") = contentType rsImage("imageSize") = fileSize rsImage("imageName") = fileName rsImage("imageCaption") = caption Do While lngOffset < fileSize varChunk = LeftB(RightB(fileData, fileSize - lngOffset), conChunkSize) rsImage("imageData").AppendChunk varChunk lngOffset = lngOffset + conChunkSize Loop ERROR--> rsImage.Update 'adoImageStream.Close rsImage.Close Set rsImage = Nothing Response.Write "<font color=""green"">File was successfully uploaded..." Response.Write "</font>" Else Response.Write "<font color=""brown"">No file was selected for uploading" Response.Write "...</font>" End If My connection string is: MM_connShooters_STRING = "driver={MySQL ODBC 3.51 Driver}; database=[name];uid=[id];pwd=[pass];OPTION=16427;" The constant conChunkSize is 100. I have checked the max packet size (set to 15500000) and as you can see, set cursors to client. Alternatively, I have also tried to use the stream object, but I haven't had any luck there either. I'm sure I'm not doing it right. Thank you, Kevin Wixson IT Manager Norman Camera & Video (616) 567-5552 1-800-900-6676 Fax: (616) 343-6410 e-mail: [EMAIL PROTECTED] Visit us on the web at: http://www.normancamera.com --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php