Storing in SQL, Procedure call

2006-06-06 Thread Jackie Lau



Hi,

I'm using freeradius 
with freetds and unixodbc. I am having an issue using a procedure call to 
insert to a Microsoft SQL Server. When I try to use the procedure call 
'exec', I see the following errors:

radius_xlat: 
'exec ***rlm_sql (sql): Reserving sql socket id: 8query: exec 
***
rlm_sql_unixodbc: 
'0 ' rlm_sql (sql): Couldn't update SQL accounting ALIVE record - 
0

But if I don't use 
aprocedure calland use an insert command in its place, it works just 
find. 

radius_xlat: 
'INSERT rlm_sql (sql): Reserving sql socket id: 3rlm_sql (sql): 
Released sql socket id: 3 modcall[accounting]: module "sql" returns ok 
for request 6

My question is why 
can't I use a procedure call 'exec'?

Thanks!


 
- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

RE: Storing in SQL, Procedure call

2006-06-06 Thread Jackie Lau
I tried both suggestions and still no luck.  Any other suggestion on how
to get a Stored Procedure to work with FreeRadius, unixODBC/FreeTDS and
Microsoft SQL Server 2000?  For some reason when trying to call a Stored
Procedure rlm_sql module is trying to perform a query rather then the
procedure call.  Thanks! 

-Original Message-
From: Marko Dinic [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 06, 2006 4:16 AM
To: freeradius-users@lists.freeradius.org
Cc: Jackie Lau
Subject: Re: Storing in SQL, Procedure call


Im using the same setup for access to some ancient Sybase and it works
fine. However, the query doesn't use EXEC ... it's plain :

 accounting_stop_query = sp_my_stored_procedure_name
'%{SQL-User-Name}','%{Realm}', 

I did have problems with freetds 0.62.3, tho, so I installed 0.63 and
had no problems with Sybase access since then.

On the other hand, Oracle setup (using rlm_sql_oracle) with EXEC
SP_NAME(...)
didn't work either, so I had to change it to BEGIN SP_NAME(...); END;
Maybe that would work for your unixODBC/freetds setup too.

--
Best regards,

Marko Dinic, System Engineer
-
YUnet International  http://www.eunet.yu
Dubrovacka 35/III,   11000 Belgrade
Tel: +381 11 311 9901;  Fax: + 381 11 311 9901
-
This  e-mail  is confidential and intended only for the recipient.
Unauthorized  distribution,  modification  or  disclosure  of  its
contents is prohibited. If you have received this e-mail in error,
please notify the sender by telephone  +381 11 311 9901.
-

 Hi,
  
 I'm using freeradius with freetds and unixodbc.  I am having an issue 
 using a procedure call to insert to a Microsoft SQL Server.  When I 
 try to use the procedure call 'exec', I see the following errors:
  
 radius_xlat:  'exec ***
 rlm_sql (sql): Reserving sql socket id: 8
 query:  exec ***
 rlm_sql_unixodbc: '0 ' 
 rlm_sql (sql): Couldn't update SQL accounting ALIVE record - 0
  
 But if I don't use a procedure call and use an insert command in its
 place, it works just find.   
 
 radius_xlat:  'INSERT 
 rlm_sql (sql): Reserving sql socket id: 3 rlm_sql (sql): Released sql 
 socket id: 3
   modcall[accounting]: module sql returns ok for request 6
  
 My question is why can't I use a procedure call 'exec'?
  
 Thanks!
  
  
 
 
 


- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


RE: Storing in SQL, repeat Attributes

2006-05-02 Thread Jackie Lau
Can you elaborate?  I'm still not following how I reference the second
occurance vs the first occurance of an attribute in the same start
record.  Thanks! 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
] On Behalf Of Alan DeKok
Sent: Tuesday, May 02, 2006 1:38 PM
To: FreeRadius users mailing list
Subject: Re: Storing in SQL, repeat Attributes 

Jackie Lau [EMAIL PROTECTED] wrote:
 Notice how the FlowID attribute is logged twice but have different 
 values  How do I reference the second occurance of FlowID i.e 
 %{FlowID}

  See doc/variables.txt

  Alan DeKok.
-
List info/subscribe/unsubscribe? See
http://www.freeradius.org/list/users.html

- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html


Storing in SQL, repeat Attributes

2006-05-01 Thread Jackie Lau



Hi,

I having a problem 
storing repeated Attributes in to a Microsoft Sql Database. My Start 
record gets loggedlike this:

 
Acct-Status-Type = Start 
NAS-IP-Address = 127.0.0.254 
NAS-Port = 5060 Acct-Session-Id = 
"[EMAIL PROTECTED]" 
Session-Ingress-CallId = "[EMAIL PROTECTED]" 
Session-Egress-CallId = "[EMAIL PROTECTED]" 
Session-Protocol-Type = "SIP" 
Calling-Station-Id = "Test" 
Called-Station-Id = 
"sip:[EMAIL PROTECTED]" 
h323-setup-time = "18:01:42.091 UTC APR 28 
2006" h323-connect-time = 
"18:01:42.119 UTC APR 28 2006" 
Session-Egress-Realm = "b11" 
Session-Ingress-Realm = "p11" 
FlowID = "localhost:65616" 
FlowType = "PCMA" Flow-In-Realm = 
"p11" Flow-In-Src-Addr = 
0.0.0.0 Flow-In-Src-Port = 
0 Flow-In-Dst-Addr = 
10.2.35.117 Flow-In-Dst-Port = 
49232 Flow-Out-Realm = 
"b11" Flow-Out-Src-Addr = 
10.2.19.117 Flow-Out-Src-Port = 
49232 Flow-Out-Dst-Addr = 
0.0.0.0 Flow-Out-Dst-Port = 
0 FlowID = 
"localhost:65617" FlowType = 
"PCMA" Flow-In-Realm = 
"b11" Flow-In-Src-Addr = 
0.0.0.0 Flow-In-Src-Port = 
0 Flow-In-Dst-Addr = 
10.2.19.117 Flow-In-Dst-Port = 
49232 Flow-Out-Realm = 
"p11" Flow-Out-Src-Addr = 
10.2.35.117 Flow-Out-Src-Port = 
49232 Flow-Out-Dst-Addr = 
10.10.1.139 Flow-Out-Dst-Port = 
49228 Client-IP-Address = 
10.1.0.33 Acct-Unique-Session-Id = 
"bfbfead8e14980c1" Timestamp = 
1146246538
Notice how the 
FlowID attribute is logged twice but have different values How do I 
reference the second occurance of FlowID i.e %{FlowID} in my SQL statement in my 
mssql.conf? I created two new columns in my sql database called FlowID1 
and FlowID2.

 
accounting_update_query = "INSERT into ${acct_table1} (AcctSessionId, 
AcctUniqueId, UserName, Realm, NASIPAddress, NASPortId, NASPortType, 
AcctSessionTime, AcctAuthentic, ConnectInfo_start, AcctInputOctets, 
AcctOutputOctets, CalledStationId, CallingStationId, ServiceType, 
FramedProtocol, FramedIPAddress, AcctStartDelay, FlowID1, FlowID2) 
values('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', '%{SQL-User-Name}', 
'%{Realm}', '%{NAS-IP-Address}', '%{NAS-Port-Id}', '%{NAS-Port-Type}', 
'%{Acct-Session-Time}', '%{Acct-Authentic}', '', '%{Acct-Input-Octets}', 
'%{Acct-Output-Octets}', '%{Called-Station-Id}', '%{Calling-Station-Id}', 
'%{Service-Type}', '%{Framed-Protocol}', '%{Framed-IP-Address}', '0', 
'%{FlowID}', '%{FlowID}')"


- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html