FCC Database

For whatever reason, you may need or want to have a local copy of the entire FCC database on your local computer.  If that is the case, then this is for you.

I found this script at Radio Artisan, and out thanks go to him for publishing his script.  It is fairly simple to use, and you do not need a whole lot of experience with databases, but some knowledge is helpful.

The script uses a MySQL database to store the entire FCC amateur radio call sign database.  There are many uses for this.  You want a copy on your local system.  You may want to develop a web based call sign look up site.

Whatever your interest, I hope you find this useful.

I originally ran this on an Ubuntu 14.04 system with MySQL.  I then used it on a CentOS 7 system.  I currently use Fedora 20 and it runs well.  CentOS and Fedora use a MySQL fork called MariaDB, but is is essentially the same as MySQL, although I did need to make some small modifications to run on CentOS from Ubuntu.  The script runs as is on a Fedora 20 laptop running MySQL 5.6.

I have made some minor (very minor) mods to the original script and I have noted them in comments.  Enjoy.

Please bear in mind that I am not a data base person per se.  I am sure there are those who can improve on the methods here.  If so, please comment.

The first thing you need to do is have MySQL (or MariaDB) installed on your system.  You also need to have a database user created that will be the user on which you run this script (this is stored in an un-encrypted file in your home directory).  Next, follow these steps.

1) Run the script with the make database option to create the database.  The first time the scriot is runm it will ask you for your username and password for the database.

hamedb.sh makedatabase

2) When this completed, you can now populate the database wirh the FCC data.  The following command will populate the database with the FCC data.

hamdb.sh populatedb

The script depends on the day of the week in which it is run.  The FCC runs a job nightly to process current entries.  On Sunday night, a new master database is generated  (now about 113 MB).  The script is a day ahead, meaning, that if you want the Master list, you run the script on Monday.  I have added a “day” section to the script where you can uncomment a line and “force” a certain day.  Say, it is Wednesday and you want the master list, uncomment “Sun” and the script will gather the Sunday list.

You find a call sign by the following.

hamdb.sh <callsign>

That is it. There are other options, such as counting the records, doing a partial search on a call sign, etc.  But it is more fun to browse the code and discover these things for yourself.

As I was writing this, MySQL 5.6 was installed on my laptop (Fedora 20).  It had some security changes that required me to do modifications to the code.  The change involved the use of passwords on the command line.  MySQL 5.6 frowns on this now, which all-in-all is probably a good thing.

You will need to use the new tool, the “mysql_config_editor” to create a “login path”.  Use the following line to create a path for this script:

mysql_config_editor set --login-path=fcc_amateur --host=localhost --user="username" --password

When you hit enter, you will be prompted for a password.  The username and password are now stored, encrypted, on you hard drive.  The username and password can be whatever you set them up to be in MySQL as the database users.

I was going to post the code here for viewing, but as there now 2 versions, I will only post links to them.

This is  the pre MySQL 5.6 script
And the post MySQL 5.6 script

I am posting these for use by anyone who wants to learn about them.  I make no guarantees the the scripts will meet any particular needs, and I cannot offer any support for them.  I will try to answer any questions about how I got something to work.

Have fun tinkering around with them.  I did.

73 de Mike, W6GYC

Leave a Reply

Your email address will not be published. Required fields are marked *