SQL query with unixodbc and freetds
Vieri
rentorbuy at yahoo.com
Sat Dec 9 16:22:57 CET 2017
# cat /etc/unixODBC/odbc.ini
[sqlserver]
Driver = FreeTDS
Description = MS SQL server
Trace = No
Server = sqlserver
Port = 1433
Database = myDB
TDS_Version = 7.1
# cat /etc/unixODBC/odbcinst.ini
[FreeTDS]
Description=Freetds
Driver=/usr/lib64/libtdsodbc.so
UsageCount=2
Threading=2
It's so I can connect to the DSN "sqlserver" from FreeRADIUS.
I'm not sure how to do that in mods-available/sql.
sql {
driver = "rlm_sql_unixodbc"
dialect = "mssql" # I suppose.
# I shouldn't set neither "server" nor "port", just the DSN.
# However, I suspect I actually can specify the DSN in "server", and simply ignore the "port".
# server = "localhost"
# port = 3306
# login = "radius"
# password = "radpass"
# So in my case, I might use:
server = "sqlserver"
login = "whatever"
pĂ ssword = "whatever"
# Somehow I need to set the following line. Why?
radius_db = "myDB"
# Can I simply comment out all the rest of the defaults since I'm not going to use any of these anyway?
# This too:
# $INCLUDE ${modconfdir}/${.:name}/main/${dialect}/queries.conf
# expands to mods-config/sql/main/mssql/queries.conf, but will not be used.
# Just leave the "pool" clause as in default example.
}
in radiusd.conf:
instantiate {
sql
}
I don't really need to load the schema at mods-config/sql/main/mssql/schema.sql, do I?
Anyway, if I run radiud -X I get:
instantiate {
# Instantiating module "sql" from file /etc/raddb/mods-enabled/sql
rlm_sql (sql): Attempting to connect to database "myDB"
rlm_sql (sql): Initialising connection pool
pool {
start = 5
min = 3
max = 32
spare = 10
uses = 0
lifetime = 0
cleanup_interval = 30
idle_timeout = 60
retry_delay = 30
spread = no
}
rlm_sql (sql): Opening additional connection (0), 1 of 32 pending slots used
rlm_sql (sql): Opening additional connection (1), 1 of 31 pending slots used
rlm_sql (sql): Opening additional connection (2), 1 of 30 pending slots used
rlm_sql (sql): Opening additional connection (3), 1 of 29 pending slots used
rlm_sql (sql): Opening additional connection (4), 1 of 28 pending slots used
}
Before moving on and trying to run an SQL query, I'd like to know if I've done something silly here, or if I've overlooked something that could bite me later.
Thanks,
Vieri
More information about the Freeradius-Users
mailing list