I have the following code tha generates the error "InputStream Null".
Now I have done everything I could to prove to myself that it is not
NULL.. :-)
Yet...I keep getting the error message...the full error message is
Type: com.sun.sbdc.SQLException
Message: Invalid Argument in JDBC call: input stream is NULL
I am using Build 1.9.126 and this is an HSQLDB database.
Here is the code (it is the line "oStmt.setBinaryStream( 1,
oInputStream, l ) " that generates the error )
function fnInsertImage( iID as Integer, oInputStream as Object,
oConnection as Object, iImageSize as long ) as Integer
dim sSQL as String
dim oStmt as Object
dim l as long
dim aImage() as integer
l = iImageSize
'sSQL = "INSERT INTO " & """" & "IMAGES" & """" & " ( " _
' & """" & "IMGID" & """" & ", " & """" & "IMAGE" & _
' """" & " ) VALUES ( ?, ? ) "
sSQL = "UPDATE IMAGES SET IMAGE = ? WHERE IMGID = ?"
oStmt = oConnection.prepareStatement( sSQL )
oStmt.setInt( 2, iID )
'Xray.Xray oInputStream
oStmt.setBinaryStream( 1, oInputStream, l )
oStmt.executeUpdate
fnInsertImage = 0
end function
Here is the code where I open the stream
function fnOpenInputStream( sFileName as String ) as object
dim oInputStream as object
dim sURL as String
dim oSFA as object
dim oInpDataStream as object
sUrl = ConvertToUrl(sFileName)
oSFA = createUNOService ("com.sun.star.ucb.SimpleFileAccess")
oInputStream = oSFA.openFileRead(sURL)
oInpDataStream = createUNOService ("com.sun.star.io.DataInputStream")
oInpDataStream.setInputStream(oInputStream)
fnOpenInputStream = oInpDataStream
end function
Now - here is something that might be the clue..If i do something like
this inside fnOpenInputStream:
dim aImage() as integer
dim l as long
l = FileLen(sFileName)
aImage = Array( 100 )
oInpDataStream.readBytes( aImage(), 100 )
as a test ..it works..and the array aImage holds 100 values.
HOWEVER...if I do this:
dim aImage() as integer
dim l as long
l = FileLen(sFileName)
aImage = Array( l )
oInpDataStream.readBytes( aImage(), l - 1 )
I get the error "Inadmissable value or datatype, overflow "
Any ideas what I have done wrong?
Thanks for any help or suggestions on this
Drew Jensen
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]