• A Network Switch Mapping Solution

The errors and solutions below on this page apply to any program using an SQLite database located on the USB flash drive

The Managed Switch Port Mapping Tool USB version can potentially show these errors but also the USB version of NetScanTools Pro and supporting applications that use an SQLite database located on the USB flash drive. Databases are usually intended to be read from and written to so when we open the databases we open them to be written to and that is what causes the error messages to appear. If your computer is configured to prevent writing to USB flash drives in one or both of the ways below you will have to follow the instructions below to allow writing to the SQLite databases.

Error: SQLITE_READONLY[8]: attempt to write a readonly database

Problem: when starting the USB version of the Managed Switch Port Mapping Tool, you see an immediate error that begins with this text:

Error Text: SQLITE_READONLY[8]: attempt to write a readonly database
Source: spmap:InitInstance:opening or creating user database
Switch Port Mapper Version: 2.xx

Solution:
Why is this happening? Your computer has protections enabled to prevent writing to USB drives. This will most likely occur on Windows 7, but it can occur on Windows Vista or 8.x.

Windows 7/Vista
Start / Run, enter gpedit.msc then press OK.

Windows 8.x
When viewing the start icons type gpedit.msc and the app 'Edit Group Policy' appears, click on it.

Locate Computer Configuration / Administrative Templates / System / Removable Storage Access

Double-click each one below and select the 'Disabled' radio button.

Removable Disks: Deny execute access
Removable Disks: Deny read access
Removable Disks: Deny write access (if this is enabled, you get the SQLITE_READONLY[8] error)

Locate User Configuration / Administrative Templates / System / Removable Storage Access and repeat the same steps.

Error: SQLITE_CANTOPEN[14]: unable to open the database file

Problem: when starting the USB version of the Managed Switch Port Mapping Tool, you see an immediate error that begins with this text:

Error Text: SQLITE_CANTOPEN[14]: unable to open the database file
Source: spmap:InitInstance:opening or creating user database
Switch Port Mapper Version: 2.xx

Solution:
Why is this happening? Your computer has protections enabled to prevent writing to USB drives. This will most likely occur on Windows 7, but it can occur on Windows XP, Vista or 8.x.

Windows 7/Vista
Start / Run, enter regedit.exe then press OK.

Windows 8.x
When viewing the start icons type regedit.exe, then click on it. WARNING: use the registry editor with care. If you are not familiar with using it, don't!

Locate the key:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\StorageDevicePolicies. Look for a value below that level named 'WriteProtect'. If it has a DWORD value of '1', then the USB drive is Read Only. Make it zero and you must reboot to allow writing to the USB flash drive. If the key and value does not exist, create it and make the DWORD value zero.

You may also consider creating or altering the same WriteProtect value found under:
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\StorageDevicePolicies
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Control\StorageDevicePolicies