3.8. SQL configuration Previous topic Parent topic Child topic Next topic

SQL clauses use the Perl DBI/DBD interface to connect to your database. You can therefore use SQL clauses with a large number of commercial and free SQL database systems. In order to use SQL, the minimum installation to get your SQL system to work is:
The SQL parameters DBSource, DBUsername, and DBAuth are passed to DBI like this:
DBI->connect(DBSource, DBUsername, DBAuth)
DBSource is a specification, which usually starts with dbi:drivername:..., but the exact meaning of these variables depends on the Perl DBD driver you use. For more information about the syntax of DBSource, DBUsername, and DBAuth for different database vendors, see Section 19.
You can specify multiple databases by using multiple DBSource, DBUsername, and DBAuth parameters. Whenever Radiator tries to connect to a database, SQL tries to connect to the first DBSource listed, using the first DBUsername and DBAuth parameters. If that connection fails, it tries the second, third and so on, until all the databases are tried, and finally gives up without replying to the NAS. This gives your NAS the opportunity to fall back to another RADIUS server if all your SQL databases are down. You can change this default behaviour with the RoundRobinOnFailure configuration parameter. For more information, see Section 3.8.8.
SQL clauses are tolerant of database failures. If the database server goes down, Radiator tries to reconnect to a database as described above, starting again at the first database or using round robin, depending on the configuration. Whichever database Radiator connects to, it stays connected to it until that database becomes unreachable, at which time it searches again for a database, starting at the first. If Radiator is not able to connect to any SQL server, it returns an IGNORE, which causes Radiator to ignore the request. This causes most NASs to fall back to a secondary RADIUS server.
Remember the SQL database needs maintenance. Make sure you have someone who is knowledgeable about installing, configuring, maintaining, and backing up your SQL database.
In some cases SQL database server use a significant number of CPU cycles and become the performance bottleneck. For example, doing a simple lookup on a user/password database with a simple index on the user name is usually very quick, in the order of milliseconds per lookup, even if the table has millions of rows. However, an insert into a large accounting table with a complicated index can be very slow. Make sure you understand how to design and tune your database tables, otherwise it could have a significant effect on SQL performance.
The following clauses utilise SQL:
The following clauses utilise AuthBy SQL and thus support all the common SQL parameters: