External mapping utilizing a join condition in query

0 Likes

I recently had the challenge of having to do an external mapping db  lookup, but needed to use a join condition for my results.  Not much  attendtion has been paid to the more comlex queries that some times need  to be don ein order for these thing to work.  So I decided to share  what I came up with so as to help anyone else out who has similar need.


First  I mapped an event EVENTID to exteranlID and use that value in my  query.  There are many ways to do this I chose to do it through the  console.

extmap.0.properties to include join condition.

type=sql
field.getter=exterlId
field.setter.count=2
field.setter[0]=flexString1
field.setter[1]=flexString2
jdbc.class=sun.jdbc.odbc.JdbcOdbcDriver      - MSSQL  I believe it will different for Oracle and other DBs.
jdbc.url=jdb:odbc:Arcsight_myodbc             -  This is the ODBC we created for a connector on the machineso I I  used it and it works, documentation will state to create an ODBC string.


jdbc.username=myusername          
jdbc.password=myobfuscatedpw                  - This is the obfuscated pw created using the Arcsight utility.

Jdbc.query=select  a.primarykey as primarykey, a.field1 as field1, b.field2 as field2   from table1 as a  JOIN  table2 as b on a.field1 = b.field3 \

Where a.primarykey in (?\u0000?)

b.field3 is the key on the second table needed to get b.field2.

field1 gets mapped to setter0
field2 gets mapped to setter1

KB should be written on these more complex queries in addition to the easy ones

Comment List
Anonymous
Parents
  • I hadn't thought of that... So something like SELECT getter, setter FROM OPENQUERY(LOCALSERVER, 'EXEC my_sproc') WHERE getter in (?u0000?) ?  The only drawback that I see to this approach is that you have to drag back the whole result set from the stored proc before filtering it with the in clause so performance may not be great and linked servers have other performance costs but it's a feasible solution given those limitations.

Comment
  • I hadn't thought of that... So something like SELECT getter, setter FROM OPENQUERY(LOCALSERVER, 'EXEC my_sproc') WHERE getter in (?u0000?) ?  The only drawback that I see to this approach is that you have to drag back the whole result set from the stored proc before filtering it with the in clause so performance may not be great and linked servers have other performance costs but it's a feasible solution given those limitations.

Children
No Data
Related Discussions
Recommended