-
1. Re: Available or extending env() specifically client_ipaddress
shawkins Apr 12, 2013 11:31 AM (in response to virtualdatabase)>I can't remember syntax exactly but in the older MetaMatrix days you could discover the client_ipaddress within a session..
I don't recall us making those values available. 8.2+ supports OBJECTTABLE - https://docs.jboss.org/author/display/TEIID/OBJECTTABLE
{code}SELECT ip FROM OBJECTTABLE('teiid_context' COLUMNS ip string 'teiid_row.session.IPAddress') AS x{code}
You can also do the same via a udf. Ideally we should also expose sysadmin tables for things like sessions and other runtime information.
>Also, any docs on exposing/defining other env type properties?
env has been somewhat deprecated as it can expose more information that is generally desirable. You have to specifically enable its use in the configuration.
-
2. Re: Available or extending env() specifically client_ipaddress
rareddy Apr 12, 2013 11:31 AM (in response to virtualdatabase)Env() function is turned off by default, you can turn it on in the configuration. See https://docs.jboss.org/author/display/teiid830final/System+Functions
As per the client_ipaddress, where do you need this? if you are writing a UDF function, then CommandContext is automatically injected into the function as the first parameter if you define it, on it you can access the session object that contains the client_ipaddress.
If you are using Admin API (on client side), you can query for all the sessions, that will also contain the client_ipaddress.
HTH
Ramesh..
-
3. Re: Available or extending env() specifically client_ipaddress
virtualdatabase Apr 12, 2013 11:40 AM (in response to shawkins)what mechanism would I implement this as a UDF?
What does
'teiid_row.session.IPAddress'
represent in your example?BTW, Ultimately i will use this within a view query
-
4. Re: Available or extending env() specifically client_ipaddress
rareddy Apr 12, 2013 11:46 AM (in response to virtualdatabase)Look at the link I provided, including the child pages.
IPAddress will be a string.
-
5. Re: Available or extending env() specifically client_ipaddress
virtualdatabase Apr 12, 2013 4:25 PM (in response to rareddy)I cannot find any reference to "client_ipaddress" anywhere in the link/children that you provided..
-
6. Re: Available or extending env() specifically client_ipaddress
rareddy Apr 12, 2013 5:04 PM (in response to virtualdatabase)I meant how to write a UDF with command context, can be found there.
-
7. Re: Available or extending env() specifically client_ipaddress
shawkins Apr 12, 2013 5:44 PM (in response to rareddy)The object table logic above access the CommandContext (http://docs.jboss.org/teiid/8.3.0.Final/apidocs/org/teiid/CommandContext.html) and then Session (http://docs.jboss.org/teiid/8.3.0.Final/apidocs/org/teiid/adminapi/Session.html) to obtain the ip address. The usage of the CommandContext is touched on in the OBJECTTABLE docs, the UDF docs, and you can consult the JavaDocs to see all of the information available - see the community docs page for the appropriate location e.g. http://docs.jboss.org/teiid/8.3.0.Final/apidocs/