PC Review


Reply
Thread Tools Rate Thread

CLOB, BLOB I'm confused...

 
 
EMW
Guest
Posts: n/a
 
      15th Mar 2004
I have a table in a dataset with 4 columns.
Except for the third, all columns are NVARCHAR2.

The third is a CLOB. I read it can hold up to 4Gb.

The column of the dataset is bound with a textbox, so the datalimit is 32kb.

But when I store more then 4000 characters into the dataset and then write
the row in to the oracle database (with an INSERT INTO sql line) , I get an
error. "ORA-01704"

I've read somewhere it is possible to write more then 4000 characters at
once into the database, but I can't seem to find the right documentation for
it.

Can anyone give me some pointers on how to do this, or some links of pages
where a good explaination can be found?
References to books is of no use, can't afford them at the moment.

rg,
Eric


 
Reply With Quote
 
 
 
 
Miha Markic [MVP C#]
Guest
Posts: n/a
 
      16th Mar 2004
4000 characters is the limit for nvarchar2
Are you having problems with nvarchar2 or clob?

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

"EMW" <(E-Mail Removed)> wrote in message
news:405622f2$0$41758$(E-Mail Removed)...
> I have a table in a dataset with 4 columns.
> Except for the third, all columns are NVARCHAR2.
>
> The third is a CLOB. I read it can hold up to 4Gb.
>
> The column of the dataset is bound with a textbox, so the datalimit is

32kb.
>
> But when I store more then 4000 characters into the dataset and then write
> the row in to the oracle database (with an INSERT INTO sql line) , I get

an
> error. "ORA-01704"
>
> I've read somewhere it is possible to write more then 4000 characters at
> once into the database, but I can't seem to find the right documentation

for
> it.
>
> Can anyone give me some pointers on how to do this, or some links of pages
> where a good explaination can be found?
> References to books is of no use, can't afford them at the moment.
>
> rg,
> Eric
>
>



 
Reply With Quote
 
EMW
Guest
Posts: n/a
 
      16th Mar 2004
I had problems with storing data in a CLOB.

But I created a way around it, allthough I hope there is a shorter and
faster way.

I first write the contents of the richtextbox to a file with it's own
command, then I read it back into a bytearray and place that in the dataset.
Then I update the database with the dataset. I now use BLOB instead of CLOB.

I would like it if there is a way of doing this without writing and reading
the file.

rg,
Eric



"Miha Markic [MVP C#]" <miha at rthand com> schreef in bericht
news:uD$(E-Mail Removed)...
> 4000 characters is the limit for nvarchar2
> Are you having problems with nvarchar2 or clob?
>
> --
> Miha Markic [MVP C#] - RightHand .NET consulting & software development
> miha at rthand com
> www.rthand.com
>
> "EMW" <(E-Mail Removed)> wrote in message
> news:405622f2$0$41758$(E-Mail Removed)...
> > I have a table in a dataset with 4 columns.
> > Except for the third, all columns are NVARCHAR2.
> >
> > The third is a CLOB. I read it can hold up to 4Gb.
> >
> > The column of the dataset is bound with a textbox, so the datalimit is

> 32kb.
> >
> > But when I store more then 4000 characters into the dataset and then

write
> > the row in to the oracle database (with an INSERT INTO sql line) , I get

> an
> > error. "ORA-01704"
> >
> > I've read somewhere it is possible to write more then 4000 characters at
> > once into the database, but I can't seem to find the right documentation

> for
> > it.
> >
> > Can anyone give me some pointers on how to do this, or some links of

pages
> > where a good explaination can be found?
> > References to books is of no use, can't afford them at the moment.
> >
> > rg,
> > Eric
> >
> >

>
>



 
Reply With Quote
 
Cor
Guest
Posts: n/a
 
      16th Mar 2004
Hi Eric,

A complet sample I did make and send also today in another newsgroup.

It is a complete answer (I used in the sample a xmlfile as the database, to
keep the sample stand alone).

\\\
Private abyt() As Byte
Private fo As New OpenFileDialog
Private sf As New SaveFileDialog

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
'Reading a picture and put it in a bytearray
If fo.ShowDialog = DialogResult.OK Then
Dim fs As New IO.FileStream(fo.FileName, _
IO.FileMode.Open)
Dim br As New IO.BinaryReader(fs)
abyt = br.ReadBytes(CInt(fs.Length))
br.Close()
'just to show the sample without a fileread error
Dim ms As New IO.MemoryStream(abyt)
Me.PictureBox1.Image = Image.FromStream(ms)
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal _
e As System.EventArgs) Handles Button2.Click
'writing a picture from a bytearray
If sf.ShowDialog = DialogResult.OK Then
Dim fs As New IO.FileStream(sf.FileName, _
IO.FileMode.CreateNew)
Dim bw As New IO.BinaryWriter(fs)
bw.Write(abyt)
bw.Close()
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal _
e As System.EventArgs) Handles Button3.Click
'writing a bytearray to a dataset
Dim ds As New DataSet
ds.Tables.Add(New DataTable("Photo"))
ds.Tables(0).Columns.Add(New DataColumn("Sample"))
ds.Tables(0).Columns(0).DataType =
System.Type.GetType("System.Byte[]")
ds.Tables(0).Rows.Add(ds.Tables(0).NewRow)
ds.Tables(0).Rows(0)(0) = abyt
Dim sf As New SaveFileDialog
If sf.ShowDialog = DialogResult.OK Then
ds.WriteXml(sf.FileName, XmlWriteMode.WriteSchema)
End If
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button4.Click
'reading a picture from a dataset
Dim ds As New DataSet
If fo.ShowDialog = DialogResult.OK Then
ds.ReadXml(fo.FileName)
End If
abyt = CType(ds.Tables(0).Rows(0)(0), Byte())
Dim ms As New IO.MemoryStream(abyt)
Me.PictureBox1.Image = Image.FromStream(ms)
End Sub

I hope this helps a little bit?

Cor



 
Reply With Quote
 
EMW
Guest
Posts: n/a
 
      17th Mar 2004
Thanks Cor!

But I already had something simulair.
It's basicly the same as what I have

Thanks anyway, it is appreciated!




"Cor" <(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed)...
> Hi Eric,
>
> A complet sample I did make and send also today in another newsgroup.
>
> It is a complete answer (I used in the sample a xmlfile as the database,

to
> keep the sample stand alone).
>
> \\\
> Private abyt() As Byte
> Private fo As New OpenFileDialog
> Private sf As New SaveFileDialog
>
> Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Button1.Click
> 'Reading a picture and put it in a bytearray
> If fo.ShowDialog = DialogResult.OK Then
> Dim fs As New IO.FileStream(fo.FileName, _
> IO.FileMode.Open)
> Dim br As New IO.BinaryReader(fs)
> abyt = br.ReadBytes(CInt(fs.Length))
> br.Close()
> 'just to show the sample without a fileread error
> Dim ms As New IO.MemoryStream(abyt)
> Me.PictureBox1.Image = Image.FromStream(ms)
> End If
> End Sub
> Private Sub Button2_Click(ByVal sender As System.Object, ByVal _
> e As System.EventArgs) Handles Button2.Click
> 'writing a picture from a bytearray
> If sf.ShowDialog = DialogResult.OK Then
> Dim fs As New IO.FileStream(sf.FileName, _
> IO.FileMode.CreateNew)
> Dim bw As New IO.BinaryWriter(fs)
> bw.Write(abyt)
> bw.Close()
> End If
> End Sub
> Private Sub Button3_Click(ByVal sender As System.Object, ByVal _
> e As System.EventArgs) Handles Button3.Click
> 'writing a bytearray to a dataset
> Dim ds As New DataSet
> ds.Tables.Add(New DataTable("Photo"))
> ds.Tables(0).Columns.Add(New DataColumn("Sample"))
> ds.Tables(0).Columns(0).DataType =
> System.Type.GetType("System.Byte[]")
> ds.Tables(0).Rows.Add(ds.Tables(0).NewRow)
> ds.Tables(0).Rows(0)(0) = abyt
> Dim sf As New SaveFileDialog
> If sf.ShowDialog = DialogResult.OK Then
> ds.WriteXml(sf.FileName, XmlWriteMode.WriteSchema)
> End If
> End Sub
> Private Sub Button4_Click(ByVal sender As System.Object, _
> ByVal e As System.EventArgs) Handles Button4.Click
> 'reading a picture from a dataset
> Dim ds As New DataSet
> If fo.ShowDialog = DialogResult.OK Then
> ds.ReadXml(fo.FileName)
> End If
> abyt = CType(ds.Tables(0).Rows(0)(0), Byte())
> Dim ms As New IO.MemoryStream(abyt)
> Me.PictureBox1.Image = Image.FromStream(ms)
> End Sub
>
> I hope this helps a little bit?
>
> Cor
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ACCESS/ORACLE CLOB datatype-export ACCESS report to EXCEL CLOB tru Lynn Microsoft Access Form Coding 0 18th Jul 2008 05:01 PM
Oracle & binary serialization -- BLOB or CLOB? matt@mailinator.com Microsoft ADO .NET 3 26th Oct 2006 09:39 PM
Problem With Clob and Blob =?Utf-8?B?QWx0YWYgQWwtQW1pbiBOYWp3YW5p?= Microsoft ADO .NET 1 9th May 2006 02:15 PM
C# Oracle CLOB Puleen Patel Microsoft ADO .NET 6 24th Mar 2004 10:42 PM
clob into oracle ewen mcdonald Microsoft ADO .NET 4 15th Sep 2003 10:21 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:24 AM.