go to post Harry Tong · Apr 10, 2024 Hi Antonio, Are you using the IRISClient assembly from your IRIS 2024.1.0? I have Visual Studio 2022, I am using InterSystems.Data.IRISClient.dll from my C:\InterSystems\IRIS20241\dev\dotnet\bin\net7.0. I have an image file 03/28/2024 09:28 AM 5,261,669 myimage.png I use following sample .Net app that I borrow from Cache 2018 and modify all Cache references with IRIS references, I have no problem inserting the 5.2MB image file into a blob field in my test table. Harry using System;using System.IO; // Add the following using statementusing InterSystems.Data.IRISClient; namespace C_SharpConsoleExample{ /// <summary> /// Summary description for Class1. /// </summary> class ConsoleApp { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main(string[] args) { // // TODO: Add code to start application here // // Create a connection to Cache IRISConnection conn = new IRISConnection(); // Cache server Connection Information // Set Server to your IP address and port to Cache SuperServer port, Log File is optional conn.ConnectionString = "Server = localhost; Log File=cprovider.log;Port=1972; Namespace=USER; Password = SYS; User ID = _SYSTEM;"; //Open a Connection to Cache conn.Open(); // Create table with streams IRISCommand dropCmd = new IRISCommand("drop table Sample.Streams", conn); try { dropCmd.ExecuteNonQuery(); } catch (Exception ex) { //Do nothing string test = ex.Message; } // Create table with streams IRISCommand cmd = new IRISCommand("create table Sample.Streams(binaryData LONGVARBINARY, characterData LONGVARCHAR)", conn); cmd.ExecuteNonQuery(); // Insert stream data into table cmd.CommandText = "insert into Sample.Streams(binaryData, characterData) values (?, ?)"; // One way to mark the parameter as a binary stream datatype and then set the Value cmd.Parameters.Add(new IRISParameter("binaryData", IRISDbType.LongVarBinary)); cmd.Parameters[0].Value = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; // An alternate way to bind the data to the parameter and then mark the parameter as a character stream cmd.Parameters.Add(new IRISParameter("characterData", (string)"This is a short character stream!")); cmd.Parameters[1].IRISDbType = IRISDbType.LongVarChar; cmd.ExecuteNonQuery(); // Now insert two files from disk as streams // Open binary file and read into byte[] // FileStream fbs = new System.IO.FileStream(".\\ConsoleStream.exe", System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite); FileStream fbs = new System.IO.FileStream(".\\myimage.png", System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite); int filebLen = (int)fbs.Length; byte[] filebData = new byte[filebLen]; fbs.Read(filebData, 0, (int)filebLen); fbs.Close(); cmd.Parameters[0].Value = filebData; cmd.Parameters[0].Size = filebLen; // Open character file and read into string StreamReader fcs = new StreamReader(new System.IO.FileStream(".\\cprovider.log", System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite)); string filecData = fcs.ReadToEnd(); int filecLen = filecData.Length; fcs.Close(); cmd.Parameters[1].Value = filecData; cmd.Parameters[1].Size = filecLen; cmd.ExecuteNonQuery(); cmd.Parameters.Clear(); // Create an SQL Statement to execute (Command) cmd.CommandText = "select ID,* from Sample.Streams"; // Execute and fetch the data from Cache IRISDataReader reader = cmd.ExecuteReader(); Console.WriteLine("Output from statement: " + cmd.CommandText); Console.WriteLine(" "); Console.WriteLine("ID\tbinaryStream\t\tcharacterStream "); while (reader.Read()) {#if BYNUMBER // Access Column by Number Console.Write(reader[0]); Console.Write("\t"); Console.Write(reader[1] + " : N/A"); Console.Write("\t"); Console.Write(reader[2]); Console.Write("\t"); Console.WriteLine();#else // Access Column by Name Console.Write(reader[reader.GetOrdinal("ID")]); Console.Write("\t"); Console.Write(reader[reader.GetOrdinal("binaryData")] + " : N/A"); Console.Write("\t"); Console.Write(reader[reader.GetOrdinal("characterData")]); Console.Write("\t"); Console.WriteLine();#endif } Console.WriteLine(""); Console.WriteLine("End of characterStream output!"); // Cleanup Reader, Connection and Command reader.Close(); cmd.Dispose(); conn.Close(); } }}
go to post Harry Tong · Mar 13, 2024 Hi Jim.You are using parameterized sql query statement against your Oracle linked table, in ObjectScript context, string delimiter is double quote, can you try just put one single quote in your PrepStmtData variable and bind it to the prepared statement against your Oracle table? PrepStmtData="Monika's Test AC"
go to post Harry Tong · Jun 3, 2016 //quit $ZU(67,12,$j)set process=##CLASS(%SYS.ProcessQuery).Open($j)quit process.ClientNodeName
go to post Harry Tong · Jun 2, 2016 I made same mistake in my original post when I used $ZU(110), just like yours and another comments on this post, we will all get the hostname of the Cache server, not the workstation name of the xDBC connection comes from. My customer was specifically looking for the workstation name establishes the connection, not the host where Cache runs.
go to post Harry Tong · Nov 11, 2015 Just FYI, you can install Caché in one location, all you have to do is Before run cinstall script on Linux, export following environment variables ( you should export the same env variables in your .bash_profile) # export CACHESYS=/home/htong/cache2015/etc/cachesys # export PATH=$PATH:$CACHESYS Then you kick off cinstall (please note, you may either become root, or remain as yourself, in my case, just as htong) the Caché installation script will run (it will write cache.reg, iscagent and other libs to the directory specified by env variable CACHESYS) and will make either root or yourself as the owner of the instance. During install, you specify /home/htong/cache2015 as the location to install Caché. After that you will have everything you need in one location, in my case, /home/htong/cache2015. Better yet, you really don't need root to install and run Caché anymore, when I installed Caché 2015 as htong, after installation, I can do ccontrol stop CACHE as htong, then I just create a tar.gz file of entire /home/htong/cache2015 directory, I can copy the tar.gz file to any machine, and recreate my Caché instance just tar vxf it. From: wwsaleseng-admin@intersystems.com [mailto:wwsaleseng-admin@intersystems.com] On Behalf Of Luca RavazzoloSent: Wednesday, November 11, 2015 9:16 AMTo: Chip Gore; wwsalesengSubject: Re: OS Upgrade question... (Posted on Community and email list) We have exe in /usr/bin Until the time we will offer one single root dir for our install you’re better off re-installing than figuring out all the dispersed pieces… Kind Regards Luca
go to post Harry Tong · Nov 11, 2015 Cache installation procedure also writes to following system directories:htong@amd4dual:/home/htong># ls -l /usr/local/etctotal 1drwxr-xr-x 2 root root 832 2015-03-31 08:51 cachesyshtong@amd4dual:/home/htong># ls -l /usr/bin/ccontrollrwxrwxrwx 1 root root 32 2011-01-19 15:47 /usr/bin/ccontrol -> /usr/local/etc/cachesys/ccontrolhtong@amd4dual:/home/htong># ls -l /usr/bin/csessionlrwxrwxrwx 1 root root 32 2012-04-06 13:07 /usr/bin/csession -> /usr/local/etc/cachesys/csessionPlease copy them to a safe location before upgrading, and copy them back after upgrading.By the way, Red Hat 7 will have very small default /proc/sys/kernel/shmmax and shmall values, you need to reset them after upgrading, otherwise your Cache instance won't be able to allocate shared memory.