Can I get more context about what you are trying to do? Are you trying to insert a stream to the datasource or retrieve a stream from the datasource or just make a blob in general?

Hello Marcio,

The answer you are looking for can be found in the SerialBlob javadocs: this is the only known provided implementation of the java.sql.Blob interface. In particular, you would like the the SerialBlob(byte[]b) constructor to create a blob in Java.

Hello Magnus,

I recommend  that you use a SQL CALL instead of IRIS Native for .Net.

The following CALL query should work: CALL SYS.Mirror_MemberStatusList('NAMEOFTHEMIRROR') and this is no different than using a stored procedure (because MemberStatusList is a class query).

If you do not have a connection to %SYS where SYS.Mirror exists , but the user for your existing connection does have privileges to access %SYS, you can write a wrapper stored procedure something similar to:

:#Include %occResultSet
    new $NAMESPACE
    set $NAMESPACE="%SYS"
    $$$ResultSet("CALL Sys.Mirror.MemberStatusList('" _ MirrorName _ ')")

Hello Elize,

Based on the error that you are receiving, it seems that you might be executing a direct SQL statement instead of a parameterized statement. This means that your DateTime object (new DateTime(1900, 1, 1, 12, 03, 30) is being converted to a String and this, in effect, bypasses our ODBC driver's handling of specific nuances regarding temporal types.  

%Library.Time expects either a proper time string (denoted by the regex /(\d{2}:){2}\d{2}(.\d*)?/) or an appropriate $HOROLOG value and for this reason, you get SQL error -147.

Nonetheless, there are several solutions you can go about this:

  • If you cannot change to a parameterized statement nor edit the code, but can change the contents of the direct SQL statement
    • INSERT INTO tablename VALUES(CAST({ ts '1900-01-01 12:03:30' } AS TIME))
  • If you cannot change to a parameterized statement but can edit code
    • Change the DateTime.toString() method to DateTime.toString("T") such that it returns the time string only
  • If you can change to a parameterized statement, be advised that DateTime is not a valid object to bind to a %Time column. Per Microsoft's document, you should be using a TimeSpan object to store time.​​ This is easily achieved by reference DateTime's TimeOfDay property.