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

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:
  #1  
Old May 18th, 2004, 08:02 AM
DevAdmin DevAdmin is offline
Utility Bot
Dev Articles Novice (500 - 999 posts)
 
Join Date: Feb 2004
Posts: 865 DevAdmin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Article Discussion: MySQL and BLOBs

One of MySQL's strengths is its use of Binary Large Object (BLOB) columns. These columns store unprocessed binary data, typically files, that can be retrieved and manipulated like the other common datatypes. The difficulty comes in accessing the BLOB column in VB. Prior to ADO 2.5, the only way to move data in and out of a MySQL BLOB column using Visual Basic was to use the appendchunk and getchunk methods. With ADO 2.5, the stream object has been added, greatly simplifying the process of working with MySQL BLOBs. In this article, I will focus entirely on using the stream object.


Read the full article here: MySQL and BLOBs

Reply With Quote
  #2  
Old November 10th, 2004, 03:06 PM
ssaamg ssaamg is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 1 ssaamg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Arguments are of the wrong type

Quote:
Originally Posted by DevAdmin
One of MySQL's strengths is its use of Binary Large Object (BLOB) columns. These columns store unprocessed binary data, typically files, that can be retrieved and manipulated like the other common datatypes. The difficulty comes in accessing the BLOB column in VB. Prior to ADO 2.5, the only way to move data in and out of a MySQL BLOB column using Visual Basic was to use the appendchunk and getchunk methods. With ADO 2.5, the stream object has been added, greatly simplifying the process of working with MySQL BLOBs. In this article, I will focus entirely on using the stream object.


Read the full article here: MySQL and BLOBs


Hi,

I find your program very useful and tried to create a form in MSAccess to pull and push the blobs. The push works fine, but when trying to pull the blob (mystream.write) I get this error message: Arguments are of wrong type, are out of acceptable range or are in conflict with one another.



Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
& "SERVER=localhost;" _
& "DATABASE=testmediarepo;" _
& "UID=root;" _
& "PWD=;" _
& "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384
conn.CursorLocation = adUseClient
conn.Open

'OPEN RECORDSET
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Dim openStr As String
Dim regstr As String
Dim FileStr As String

'OPEN RECORDSET TO READ BLOB
If REGDATE <> "" Then
regstr = Trim(Str(DatePart("yyyy", REGDATE))) & Trim(Str(DatePart("m", REGDATE))) & Trim(Str(DatePart("d", REGDATE))) & Trim(Str(DatePart("h", REGDATE))) & Trim(Str(DatePart("n", REGDATE))) & Trim(Str(DatePart("s", REGDATE)))
openStr = "Select * from OVERVIEW_DESCRIPTION WHERE REGDATE=" & regstr

rs.Open openStr, conn
'OPEN STREAM
Dim mystream As New ADODB.Stream
' Set mystream = New ADODB.Stream
mystream.Type = adTypeBinary
mystream.Open
FileStr = "c:\newimage5." & Right(Trim(MAPSOURCE), 3)


mystream.Write rs!TOURMAP


FileStr = "c:\newimage5." & Right(Trim(MAPSOURCE), 3)
mystream.SaveToFile FileStr, adSaveCreateOverWrite
Image29.Picture = FileStr
Image29.Visible = True
mystream.Close
rs.Close
End If

Err_Resume:
conn.Close
Exit Sub
Err_Load:
MsgBox Err.Description
Resume Err_Resume

conn.Close


ssaamg

Reply With Quote
  #3  
Old January 16th, 2005, 08:51 AM
netsmith netsmith is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 1 netsmith User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
This is a great article thanks.

My situation is slightly different though and I wondered if you had any idea if this solution might still work.

My web server is a windows 2003 server and all my forms and pages are in ASP (all the same so far) but the mySQL server i wish to use is actually living on a seperate UNIX box. In theory should all I need to do is update the connection string?

Hope so

Any help would be great.

Regards
Chris

Reply With Quote
  #4  
Old March 30th, 2005, 10:21 AM
Ryan Elisei Ryan Elisei is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 1 Ryan Elisei User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 45 m 37 sec
Reputation Power: 0
Wink code snippet

Code:
regstr = Trim(Str(DatePart("yyyy", REGDATE))) & Trim(Str(DatePart("m", REGDATE))) & Trim(Str(DatePart("d", REGDATE))) & Trim(Str(DatePart("h", REGDATE))) & Trim(Str(DatePart("n", REGDATE))) & Trim(Str(DatePart("s", REGDATE)))


You might change this length of code to:

regstr = Format(Trim(Str(REGDATE)),"yyyymdhns")

or even just

regstr = Format(Str(REGDATE),"yyyymdhns")

convention would list the data type first in the variable name - strReg

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsCommunityDevelopment Tutorials > Article Discussion: MySQL and BLOBs


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 3 hosted by Hostway