Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to get CLOB with VB

Re: How to get CLOB with VB

From: ak <a.klammer_at_austrac.gov.au>
Date: Wed, 23 Feb 2000 18:43:42 +1100
Message-ID: <4jMs4.31548$3b6.154420@ozemail.com.au>


We're in a similar situation to that below, except we are using JDBC and JSP as a front end. I've posted a message in c.d.o.misc, named "Passing long string to Oracle through JDBC?" I'm having trouble extracting from the database, or sending to the database, a string > 4000 chars long. As most of our CLOBS are larger than that, this is a huge sticking point. One suggestion that was made was to move our transaction control up to the JSP level, which would work, but I'm hoping a neater/more elegant solution is available. How can I push > 4000 char strings into Oracle via JDBC?

mark tomlinson <marktoml_at_hotmail.com> wrote in message news:38B2FB33.2A4A8373_at_hotmail.com...
> The following works for me using: ADO 2.0 and the ODBC driver from Oracle
> version 8.1.5
>
> However, Using Oracle Objects for Ole (OO4O) from VB to do this is MUCH
faser
> and cleaner.
>
>
> 'CREATE TABLE empclob (
> ' empno number(4),
> ' clob1 clob);
>
>
> 'Visual Basic Code
> Dim objCon As ADODB.Connection
> Dim objRst As ADODB.Recordset
>
> Set objCon = New ADODB.Connection
> Set objRst = New ADODB.Recordset
>
> objCon.ConnectionString = "DSN=V815;Data Source=V815;User
> ID=scott;password=tiger;"
> objCon.Open ConnectionString
>
> objRst.Open "empclob", objCon, adOpenStatic, adLockOptimistic,
adCmdTable
>
> 'One way to insert... using insert
> objRst.AddNew Array("empno", "clob1"), Array(9000, "Testing 9000")
>
> 'Another way to insert... using update
> objRst.AddNew
> objRst!EMPNO = 9001
> objRst!CLOB1 = "Testing 9001"
> objRst.Update
>
> 'Third way to insert... using stream
> objRst.AddNew
> objRst!EMPNO = 9002
> objRst.Fields("CLOB1").AppendChunk "First stream..."
> objRst.Fields("CLOB1").AppendChunk "Second stream..."
> objRst.Fields("CLOB1").AppendChunk "Third and last stream..."
> objRst.Update
>
>
> 'Read from the clob
> Dim objCon As ADODB.Connection
> Dim objRst As ADODB.Recordset
>
> Set objCon = New ADODB.Connection
> Set objRst = New ADODB.Recordset
>
> objCon.ConnectionString = "DSN=dsn815;Data Source=V81;User
> ID=scott;password=tiger;"
> objCon.Open ConnectionString
> MsgBox ("connected")
> sql = "select * from empclob"
> Set rsTabel = New ADODB.Recordset
> rsTabel.ActiveConnection = objCon
> rsTabel.CursorLocation = adUseServer
> rsTabel.LockType = adLockReadOnly
> rsTabel.Source = sql
> rsTabel.Open
>
> MsgBox (rsTabel(0))
> MsgBox (rsTabel(1))
>
>
>
Received on Wed Feb 23 2000 - 01:43:42 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US