04-29-2015 10:23 AM
We have a libname function as below and it is connecting & provides 0 return code. But the problem is, it is not disconnecting (i think), it leaves idle sessions on the teradata side. Just want to know what exactly this function does ? whether it connects & disconnects to/from teradata ? or Do i need to explicitly specify how to disconnect from teradata ?
rc_libname = libname(teradata_libname, ,unix_engine , " server='&com_dbserver' schema='&com_db' user='"||trim(teradata_userid)||"' password='"||trim(teradata_password)||"'" );
To add to that, we have a dsid function statements after rc_libname return code check... not sure if it impacts the teradata connection..
rc_close = close(dsid);
Thanks in advance..
04-29-2015 10:38 AM
The LIBNAME function assigns or deassigns a libref from a SAS library. When you use the LIBNAME function with two or more arguments, SAS attempts to assign the libref. When you use one argument, SAS attempts to deassign the libref. Return codes are generated depending on the value of the arguments that are used in the LIBNAME function and whether the libref is assigned."
04-29-2015 11:56 AM
Thank you... i will check this. Can you please explain me what dsid=open() does ? is it like a read/select statement but it wont establish a connection ?
04-29-2015 03:34 PM
Your libname is starting a session. As I see a Teradata being mentioned pleas use shared connections. It is some special RDMS behaving a litrle bit different as other OLTP DBMS systems
The dsid open opening a table that is mire like a transaction at the Teradata site.
These are advanced functions not for beginners when you are a beginner it more appropriate to use the more common easy statements of a beginners approach.
06-25-2015 10:44 AM
Hi, I know it is an advacned function but I am trying to put a fix to this existing code. The problem with the above stmt is that it is not disconnecting from teradata as this code loops till a certain time. I tried to use rc_libname = libname(teradata_libname); to disconnect but getting an error
"ERROR: Unable to clear or re-assign the library TERAlib_ because it is still in use.". Please assist me in this.
06-26-2015 02:47 AM
As long as there is some TD processing going on you cannot break interrupt that.
What could be done is killing the Sas session that started that TD process completely with an OS cmd like kill pid.
That will signal the TD process also. Do not use the -9 option but let it gracefully ending.
06-26-2015 02:49 AM
Your error message is telling the session has been made and connected. As you can view open tables with eguide that opening can be the lock on the libname