0

I have ckeditor in the application in asp.net application through jquery.

It's working fine at local. Its inserting data in database, does not matter whatever is the length of the text. But when I insert data on live after putting the build on the server.

It is not saving the data, when I reduce, its length then it is saving the data.I am inserting this text using WCF service.

Please help in this context.

Looking forward to hear regarding the same.

PiotrWolkowski
  • 8,408
  • 6
  • 48
  • 68
Raj
  • 19
  • 2
  • you need to set the datatype as `nvarchar(max)` for the respective column on the server – Nad Apr 07 '15 at 11:37
  • where does the error surface? for example, this could be because of a column without a suitable type/width, but since you mention jQuery, it could be because you're transferring it as a query-string parameter and your url is too long (and is being rejected by the server) – Marc Gravell Apr 07 '15 at 11:38
  • maybe you need to increase the max size of the message in WCF: http://stackoverflow.com/questions/884235/wcf-how-to-increase-message-size-quota – Paritosh Apr 07 '15 at 12:55

1 Answers1

0

Oracle DB accepts 4000 characters as a max length of an input string (NOT a datatype). i.e, you are expected to send at most 4000 chars as a value. The solution: if you are using ASP.NET, try to use this function after changing your column type to CLOB so that its size would be up to 4GB:

 Public Shared Function AssignStringToCLOB(ByVal targetString As String, ByVal myConnection As OracleConnection) As OracleLob
    Dim _tempCommand As New OracleCommand()
    _tempCommand.Connection = myConnection
    _tempCommand.Transaction = _tempCommand.Connection.BeginTransaction()
    _tempCommand.CommandText = "DECLARE A " + OracleType.Clob.ToString() + "; " + "BEGIN " + "DBMS_LOB.CREATETEMPORARY(A, FALSE); " + ":LOC := A; " + "END;"
    Dim p As OracleParameter = _tempCommand.Parameters.Add("LOC", OracleType.Clob)
    p.Direction = ParameterDirection.Output

    _tempCommand.ExecuteNonQuery()

    Dim _tempCLOB As OracleLob = CType(p.Value, OracleLob)
    If targetString <> String.Empty Then
        Dim _bytesArray As Byte() = Text.Encoding.Unicode.GetBytes(targetString)
        _tempCLOB.BeginBatch(OracleLobOpenMode.ReadWrite)
        _tempCLOB.Write(_bytesArray, 0, _bytesArray.Length)
        _tempCLOB.EndBatch()
    End If

    _tempCommand.Transaction.Commit()
    Return _tempCLOB
End Function

and call it after opening the connection with Oracle DB to set a value to your parameter, this should work perfectly.

TareqBallan
  • 156
  • 1
  • 1
  • 8