SQL

Syndicate content 27 

Hi,

I have a question related with EnsLib.SQL.OutboundAdapter adapter.

Is there a way to open an oracle transaction and do either commit or rollback depending on the query result?

Is posible to keep open an oracle transaction to execute a lot of queries on different methods on the same business operation and do a commit when the business process finished?

Thanks and Best Regards

Sergio Vidal

Last comment 24 July 2018
0   0 2
0

answers

158

views

0

rating

I'm trying to have my REST service return the entire data set for one of our legacy globals.  Currently I am parsing the object from a SQL statement into generic objects to be returned like this:


         Set specimenArray=[]
        
        WHILE resultSet.%Next() {
            Set specimen = {}
            Set specimen.SpecimenId= resultSet.SpecimenId
            Set specimen.ProjectId = resultSet.ProjectId
            
            Set Oref = specimenArray.%Push(specimen)
        }
        
        Set tProxy = specimenArray.%ToJSON()
        set %response.Status = 200
        set %response.ContentType = "application/json"
        Set %response.CharSet="utf-8"

        Write tProxy

Last answer 23 July 2018 Last comment 23 July 2018
+ 1   0 2
206

views

+ 1

rating

I have a class that has a property calledTags (like DescriptiveWords, but tags), where multiple tags are possible.  I am trying to decide on list of Objects vs. array of Objects.

Based on this post: https://community.intersystems.com/post/querying-list-property-sql, sounds like using an array of Objects is the better way to go. Indeed, I already noticed that it's not possible to have duplicates when using an array of Objects.

However, I am unable to make my queries on the array of Object use an index.  

Here is a code example, with queries and the cost of the query (see the comments for each Index)I have found when running the query in Mgmt POrtal

Last answer 13 July 2018 Last comment 12 July 2018
0   0 3
190

views

0

rating

Hi Community!

Please welcome a new session recording from Global Summit 2017:

What's Lurking in Your Data Lake?

 

0   0 1
0

comments

67

views

0

rating

I am trying to fetch the data from cache database. But i got the error like "CSP application closed the connection before sending a responce".

Below is the query.

SELECT
CallbackComment
FROM SQ.CBPhoneResult_View Where PhoneDateODBC = '2018-04-09'

I have investigated and found that "CallbackComment" contains the special character single quotes " ' "  for one result and due to this i got this error.

In this field data is enter by customer. so we cannot restrict them like Do Not use single quotes.

Please provide some solution as soon as possible.

Thanks in advance. 

Last answer 7 July 2018 Last comment 9 July 2018
0   0 2
373

views

0

rating

I have a serial object:

Class EmbedObj Extends %SerialObject

which is stored as a  property of another object

Class ContainerObj Extends %Persistent

Property InnerObj As EmbedObj;

Property Foobar As %String;

Question:

From within the context of an instance of EmbedObj, how can I navigate to the containing instance of "ContainterObj" and find that value of its Foobar property?

Harder Question:  Is there a way I can do this as part of SQLComputeCode? (my EmbedObj has a Calculated property which now needs to depend on the value of property Foobar of the containing object).

Thanks in advance for any help on how to walk this relationship via Object or SQL access.

Last answer 13 June 2018 Last comment 17 June 2018
0   0 4
270

views

0

rating

I have several stored procedures that when I execute them they will only return a single snapshot. In my BP I have been setting this to a Snapshot variable then looping using a WHILE through the snapshot variable just to get that single value.

Since it is only a single row, is there an easier way where I don't have to do a WHILE loop to pull the values out of that row? Can I call First Row or something like that to get me just the row into the Snapshot variable?

Last answer 14 June 2018
0   0 2
0

comments

157

views

0

rating

Hi Everyone,

I am trying to built a SSIS package thru BIDS Visual Studio 2013. My Datasource is a InterSystems Cache Database, I wanted to Import Tables records from the Datasource to MS SQL Server 2014.

As a Sanity check. I only created one Package to import one Table to MSSQL Server to try out. The connection to the InterSystems Cache Database was successful. The DSN for the InterSystems Cache Database is created in the System for 32 and 64 Bit.

Here is where my Problem lies. I can successfully execute the SSIS Package in the BIDS Visual Studio 2013 BUT when i deploy the SSIS Package into the Integration Services Catalogs in the SSMS (SQL Server Management Studio) i get the following errors:

Last answer 12 June 2018 Last comment 12 June 2018
0   0 2
388

views

0

rating

The Art of Mapping Globals to Classes (4 of 3)

The forth in the trilogy, anyone a Hitchhikers Guide to the Galaxy fan?

If you are looking to breathe new life into an old MUMPS application follow these steps to map your globals to classes and expose all that beautiful data to Objects and SQL.

If the above does not sound familiar to you please start at the beginning with the following:

The Art of Mapping Globals to Classes (1 of 3)

The Art of Mapping Globals to Classes (2 of 3)

The Art of Mapping Globals to Classes (3 of 3)

Last comment 12 June 2018
+ 5   0 6
824

views

+ 5

rating

Without installing Kerberos has anyone Authenticated a SQL JDBC connection? Currently we are using local SQL Accounts to sign onto External SQL Databases, but we are being told that we need to switch to Service accounts that live on a Active Directory Domain. 

I wrote with a little help a ZAUTHENICATE to do the Authentication for Ensemble, can I use something like that to connect to an External SQL Database using a Service Account on a Active Directory Domain?

Thanks

Scott

Last comment 7 June 2018
0   0 3
0

answers

169

views

0

rating

Date range queries going too slow for you?  SQL Performance got you down?  I have one weird trick that might just help you out! (SQL Developers hate this!)*

If you have a class that records timestamps when the data is added, then that data will be in sequence with your IDKEY values - that is, TimeStamp< TimeStampif and only if ID1 < IDfor all IDs and TimeStamp values in table - then you can use this knowledge to increase performance for queries against TimeStamp ranges.  Consider the following table

Last comment 4 June 2018
+ 14   1 9
4985

views

+ 14

rating

I  have generated a class using the linked procedure wizard however  I can't get it to work if the  datatype  of one of the parameters is VARCHAR(MAX).  It works fine if I change it to say VARCHAR(500) and  rerun the  stored procedure wizard. 

I get the following  error returned.:

ErrorMsg:   SQLState: (07002) NativeError: [0] Message: [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error

Can anyone see what I am doing wrong?  I think it is to do with the way I am using the  %Stream.GlobalCharacter?   Any help is much appreciated.

Class generated by linked procedure wizard

Last answer 10 May 2018 Last comment 1 June 2018
0   0 4
284

views

0

rating

Hi All

I'm looking for the a simple-quick-easy solution to monitor a SQL table thought Ensemble.

I have a process that update a DataBase ,a scheduled task that runs every night  (Not Ensemble)

In the end it updates a table (replica_status) with a new recored with two fileds:  Id, DateTime

I looked around the community but didn't find an answerd case.

I'm thinking on a Task that will run a sql outboud adapter BO that checks that table and send a alert if no new record was created yesterday

is this the right approach or is there's a better solution?

Thanks Gadi

Last answer 24 May 2018 Last comment 29 May 2018
0   0 3
173

views

0

rating

Hi Community!

New session recording from Global Summit 2017 is already on DC YouTube Channel:

SQL – Things You Should Know

 

Last comment 25 May 2018
+ 1   0 3
137

views

+ 1

rating

Hello glabal masters,

I am trying to develop WAS using Cache and Spring Framework.

The ON DUPLICATE KEY UPDATE is not working.

Source : 

INSERT INTO 
            ocsGUMCHECDINFO (CODE,DODATE,NAME,DAY,PURPOSE,REQUIREMENT,BEFORENOTE,AFTERNOTE,CNT,REPORT,CONSENT,CONTACT)
        VALUES
            (#{code},#{doDate},#{name},#{day},#{purpose},#{requirement},#{beforeNote},#{afterNote},#{cnt},#{report},#{consent},#{contact})
        ON DUPLICATE KEY UPDATE DAY=#{name},PURPOSE=#{day},REQUIREMENT=#{requirement},BEFORENOTE=#{beforeNote},AFTERNOTE=#{afterNote},CNT=#{cnt},REPORT=#{report},CONSENT=#{consent},CONTACT=#{contact}

Is "ON DUPLICATE KEY UPDATE" not working in Cache SQL? Is there any other way if this isn't working?

Thank you

Last answer 25 May 2018 Last comment 25 May 2018
0   0 2
141

views

0

rating

I have  a SQL  procedure that I call into and it does some processing and passes back any data validations that fail. I would like to receive those message in my operation and act upon the message received .The question is how do you get output messages from a stored procedure I am using MsSQL 2012  with ensemble

Last answer 14 May 2018 Last comment 14 May 2018
0   0 2
144

views

0

rating

Hello Global masters!

I developed Web with Spring framework (JAVA, Jdbc Cache) and I wrote SQL when I made it.

And Window program with VB6, Cache Object and VisM.

Is there a significant performance gap? SQL and Cache Object?

same function, same computer performance just different Java and VB6.

Thank you.

Minsu.

Last answer 11 May 2018 Last comment 11 May 2018
0   0 2
227

views

0

rating

Any insights, news, alternatives or experience about sequence pattern querying like with Oracle's MATCH_RECOGNIZE, more declarative, less simple direct COS way? Both obvious solutions (shadowing data to oracle cloud or implementing MATCH_RECOGNIZE compiler in COS from scratch) seem big overkill. Do Intersystems have plans to adopt this "2007 ANSI standard proposal" and "SQL:2016 standard"

My problem is regular need to do analytics on medical lab data dynamics and correlations, and while its always doable by COS and multiple SQL statements, such handcrafting for every new hypothesis/idea or statistic takes some hours each and definitely is not something that can be delegated to non-programmers.

Last comment 4 May 2018
0   0 2
0

answers

168

views

0

rating

I have a lookup table and record batch Table I would like to do a count on the records stored in that batch by counting the number of records in that batch that have  a certain key on the responseKey column. This column keys are stored in the look up table for comparison. So I would like to do a join sql pivot that will use my keys stored in the lookup as columns and count as values

so far I have managed to do this but this is not efficient I would like to fire that sql once not on every count

SELECT * FROM
(
SELECT tMatch.DataValue, Count(*)
FROM ResponseRMAP.Record bRecord
JOIN Match ON tMatch.TableName = 'Match' AND tMatch.KeyName = bRecord.ResponseCode
WHERE bRecord.%ParentBatch = 55

)
 
Last comment 4 May 2018
0   0 2
0

answers

275

views

0

rating

Hi,

The following sql statement is working through the SMP but couldn't make it work through the code.

The table is a linked table to oracle db.

Tried to change the date property in the linked table class from %Date to %String and also tried using %SQL.Statement and %Library.ResultSet

this work through SMP:

INSERT INTO PACKAGE.SOME_TABLE_NAME

(EFFECTIVE_START_DATE,MORE,DATA,HERE)

VALUES (to_date ('2018-04-01','yyyy-mm-dd'),123,456,789)

In the code i'm using '?' in the statement for the parameters.

So in the code it's go something like this (where the to_date is in the sql statement)

Last answer 23 April 2018 Last comment 24 April 2018
0   0 2
162

views

0

rating

How to convert SQL persistent classes to JSON output - I have tried 1 option but appears to be very lengthy process.

I have many other SQL storage's defined and have to expose them as well to JSON. Can anyone please suggest a better approach.

My column names usually match with my Json properties.

My User.TestClass is the class with GetJsonList() as my method to return /output JSON formatted data.

The Code tried and SQL storage structure are as follows -

Last answer 19 April 2018 Last comment 18 April 2018
+ 1   0 3
360

views

+ 1

rating