Database Connection

Hi
I’m having issues with connecting to a simple database. SQL i’m fine with, and usually ODBC as I use it in day job. However, even reading the manual and comparing “teletypeguy” contribution I get this error message

In theory this seems obvious… Below is the dbl file. I have tried the connection string way as below, the "teletypeguy"s way and using dsn, all to not avail. Also tried forward and back slashes.
There is only one column and one table at present so nothing conflicting there. I am using SQLite3
Any pointers would be welcome.
Thanks
Paul


{
    "meta ": {
        "version": 0
    },
    "name" :"Parts Database",
    "description" :"Parts Database Desc",
    "Source": { 
        "type": "odbc" ,
        "dsn":"",
        "username":"",
        "password":"",
        "timeout_seconds": 2,
        "connection_string": "C:/WORK/Library/Kicad/Database/ComponentDatabase.db"
    },
    "libraries":[
        {
            "name": "Caps",
            "table":"Capacitors",
            "key": "PartNumID",
            "symbols":"Symbol",
            "footprints": "Footprint",
            "fields":[
                {
                    "column":"Value",
                    "name": "Value",
                    "visible_on_add":true,
                    "visible_in_chooser": true,
                    "show_name": false
                }
            ],
            "properties":{
                "description": "Description",
                "footprint_filters": "Footprint Filters",
                "keywords": "keywords",
                "exclude_from_bom": "No Bom",
                "exclude_from_board": "Schematic Only"
    
            }
        }
    ]
}

I can not help with the database stuff, but I put triple backticks around your posted source code to make it easier to read.

You have an extra space in your "meta" key at the top, which is probably breaking things, and "Source" needs to be "source" (lowercase)

Your connection string is also just a filepath, you need either a DSN or you need to specify the sqlite driver like Driver={SQLite3};Database=<filepath> (assuming SQLite3 is the name of your driver, which it might not be)

@crafyjohn
THanks for quick reply. I have gone through and checked /corrected all whitespaces and changed “source” (First time with JASON).
I have now tried this:-
“connection_string”:
Driver=KicadDb;Database=C:\WORK\Library\Kicad/Database\ComponentDatabase.db"

also the other way around, and also with a semicolon at the start AKA “teletypeguy”, but get same error as before.
I have also put forward slashes instead of back-slash in the path but that gives error shown below, so assume that won’t work. Clip of this error along with a clipof the odbd driver.

Thanks

Paul

“KicadDb” is a DSN name, not a driver name.

Try DSN=KicadDb as your connection string.

1 Like

@craftyjohn

excellent. works a treat. Thanks for all your help

Paul

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.