BlueKarana
asked on
Classic ASP: store and retrieve CLOB in Oracle
I'm storing a long string, about 17,000 chars, (base64 of an image) in a CLOB field in an Oracle database.
How do I retrieve the CLOB into a string, that is, the same base64 image string?
Currently I'm only getting 996 chars, then it cuts off.
*** all code is classic ASP ***
Code for storing CLOB:
Code for retrieving CLOB:
So, how do I get rs("PHOTOCLOB") into a string without truncation?
I've read about using ADO getchunks, but I haven't figured out how to do that successfully. It still truncates.
like so:
(The BinaryWrite only writes out 996 characters.)
Thanks!
How do I retrieve the CLOB into a string, that is, the same base64 image string?
Currently I'm only getting 996 chars, then it cuts off.
*** all code is classic ASP ***
Code for storing CLOB:
BinRead = Request.BinaryRead(ByteCount)
Dim ImageStr
ImageStr= BinaryToString(BinRead)
Set rsVisitReservation = Server.CreateObject ("ADODB.Command")
rsVisitReservation.ActiveConnection = MM_NetBadgeOracle_STRING
rsVisitReservation.CommandText = "UPDATE netbadge.VISITORRESERVATION SET PHOTOCLOB=? WHERE PASSID = " & PassID
rsVisitReservation.Prepared = true
rsVisitReservation.Parameters.Append rsVisitReservation.CreateParameter("param2", 201, 1, len(ImageStr), ImageStr) ' adLongVarChar
Set rsVR = rsVisitReservation.Execute
Code for retrieving CLOB:
ConnectStr = MM_NetBadgeOracle_STRING
set rs = Server.CreateObject("ADODB.Recordset")
SQL = "SELECT PHOTOCLOB FROM netbadge.visitorreservation WHERE passid =1443"
Set rs = Server.CreateObject("adodb.recordset")
rs.Open SQL, ConnectStr, 2, 3
Response.BinaryWrite rs("PHOTOCLOB")
So, how do I get rs("PHOTOCLOB") into a string without truncation?
I've read about using ADO getchunks, but I haven't figured out how to do that successfully. It still truncates.
like so:
' Copy the string to a variable in chunks
Dim varScan
Dim VarChunk
Dim lngOffset
Dim varImgStr
lngLogoSize = Len(rs("PHOTOCLOB"))
lngOffset = 0
Do While lngOffset < lngLogoSize
varChunk = rs("PHOTOCLOB").GetChunk(conChunkSize)
varImgStr = varImgStr & varChunk
lngOffset = lngOffset + conChunkSize
Loop
response.write "varImgStr = "& varImgStr
(The BinaryWrite only writes out 996 characters.)
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
For those who follow in my antidiluvian wake:
Open in new window
Thanks for the nudge, slightwv.