In my development of the BS structure program, because of the frequent need to process some large-capacity text data in Oracle, so after repeated testing and finally with ASP successfully solved the large text data under Oracle access problem.
first, the operating environment:
1. Microsoft Windows Server + IIS 5.0
2. Oracle8i Chinese Standard Edition
second, the establishment of data tables:
CREATE TABLE SYSTEM. TEST (
BLOB LONG,
ID number)
/
third, the source program:
1. Data Deposit Procedure: test.asp
<%
' Form submission Processing Section {Shanghai Treatment Impotence Hospital}
‘--------------------------------------------------
If request ("OK") =1 then
' Character conversion function
function Tansstr (SSTR)
Sstr=replace (Sstr, "", " ")
Sstr=replace (SSTR,CHR & CHR), "<br>")
Tansstr=sstr
End Function
' Submit data Assignment
A=lenb (Request ("text"))
B=len (Request ("text"))
C=TANSSTR (Request ("text"))
' Open database, open test data table to RS for recordset
Set orasession=createobject ("Oracleinprocserver.xorasession")
Set oradatabase=orasession.dbopendatabase ("Autop", "System/manager", 0)
Set rs=oradatabase.createdynaset ("SELECT * from test ORDER BY id DESC", 0)
' Seek ID value
If Rs.eof Then
Id=1
Else
ID=RS ("id") +1
End If
' Because of the size of the SQL statement, the data is stored in a non-SQL statement
‘--------------------------------------------------------
' New record
Rs. Dbaddnew
The classic is in this sentence: The Dbappendchunk method of the Fields object of Rs recordset deals with the problem of large-field deposit.
Rs. Fields ("blob"). Dbappendchunk (c)
' Deposit ID Value
RS ("id") =id
' Refresh record set
Rs. Dbupdate
' Show Results section
‘---------------------------------------------------------
Response.Write "Data has been stored in the database.
"
Response.Write "Total number of characters: " & FormatNumber (b,2,-2,-2,-1) & " word
"
Response.Write "Total bytes consumed: " & FormatNumber (a,2,-2,-2,-1) & " byte
"
Response.Write " please check ... "
' Close the data connection.
Rs.close
Set rs=nothing
Set orasession=nothing
Response.End
End If
%>
resolution of Oracle Large segment access problem in asp:
2, Data Recall Program: View.asp
<%
' Connect to database, open data table as read-only
Set orasession= CreateObject ("Oracleinprocserver.xorasession")
Set oradatabase=orasession.dbopendatabase ("Autop", "system/ Manager ", 0)
Set rs=oradatabase.dbcreatedynaset (" SELECT * from test ORDER BY id DESC ", 4)
' Assign the initial value: Define a byte size of 1024byte per intercept, maximum can be set to 65280byte (64K)
size=65280
i=0
do
' The Dbgetchunk method of the Fields object in the Rs recordset reads the Data
Text=rs.fields ("Blob") in the loop. Dbgetchunk (i*size,size)
Response.Write Text
' to find out the detailed bytes of each fetch data
Text_size=lenb (Text)
I=i+1
' If the detailed number of bytes per fetch data is less than the size of the intercept byte to be defined, then the data is complete and exits the loop. &NBSP;
Loop until Text_ Size
' Close data connection
Set orasession=nothing
% >
ASP Database Programming: Resolution of Oracle Large text access problem in ASP