Issues with using database libraries

I want to get a database library working in KiCad 7.

I’m using KiCad 7.05-7.05~ubuntu22.04.1, release build

I get no errors connecting to the database when I use Preferences->Manage Symbol Libraries. But it could be failing silently as it take a couple of seconds to connect.

There was a prior post which seemed to describe a similar issue. That post was not able to determine what the problem was and it seemed to resolve itself. The post is located here: Problem with Database Connection - SOLVED

Using isql, I’m seeing it properly connect to the database:

srodgers@steverod ~ $ !isql
isql kicad-symbol-database
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL> ^C

Here is a screenshot of what’s in the database:

The main issue is that the spinner is missing when using the chooser from the schematic editor , and therefore I can’t access any of the parts in my database.

Here is the contents of the dp_parts.kicad_dbl file:

{
    "meta": {
        "version": 0
    },
    "name": "KiCad Database Library",
    "description": "Component Database",
    "source": {
        "type": "odbc",
        "dsn": "kicad-symbol-database",
        "username": "",
        "password": "",
        "timeout_seconds": 2,
        "connection_string": ""
    },
    "libraries": [
        {
            "name": "Resistors",
            "table": "Resistors",
            "key": "PartNumber",
            "symbols": "Symbol",
            "footprints": "Footprint",
            "fields": [
                {
                    "column": "Part Number",
                    "name": "PartNumber",
                    "visible_on_add": false,
                    "visible_in_chooser": true,
                    "show_name": true,
                    "inherit_properties": true
                },
                {
                    "column": "Resistance",
                    "name": "Resistance",
                    "visible_on_add": true,
                    "visible_in_chooser": true,
                    "show_name": false
                },
                {
                    "column": "Case Size",
                    "name": "Case Size",
                    "visible_on_add": false,
                    "visible_in_chooser": true,
                    "show_name": false
                },
                {
                    "column": "Tolerance",
                    "name": "Tolerance",
                    "visible_on_add": false,
                    "visible_in_chooser": true,
                    "show_name": false
                },
                {
                    "column": "Power",
                    "name": "Power",
                    "visible_on_add": false,
                    "visible_in_chooser": true,
                    "show_name": false
                },
                {
                    "column": "TempCo",
                    "name": "TempCo",
                    "visible_on_add": false,
                    "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"
            }
        }
    ]
}

my .kicad_dbl is like this:

...
    },
    "name": "EDLDB Database",
    "description": "KiCAD Database placement testing",
    "source": {
        "connection_string":"dsn=EDLDB" 
    },
    "libraries": [
....

and doesn’t contain a “properties” filed, a part form that i can’t see anything clearly wrong with yours… have you tried passing it to a on-line validator to see if there are syntax errors?
see: KiCad: The case for Database driven design - #144 by craftyjon

1 Like

Thanks for the link. Lots of info in there. The JSON syntax checks out using an online checker.

Generally if there is an error connecting to the database it should show a popup error message. I think the problem is that in your config file, your key name is PartNumber (no space) but in your DB editor screenshot, the column name is Part Number (with space). Because of this, no rows are returned and the library appears empty.

Yes, that is correct, but there was something else as well. When this stanza is included in the JSON file, the spinner is not present:

            "properties": {
                "description": "Description",
                "footprint_filters": "Footprint Filters",
                "keywords": "Keywords",
                "exclude_from_bom": "No BOM",
                "exclude_from_board": "Schematic Only"
            }

I’m not sure why removing that stanza makes it work though.

I can’t seem to get the Value field to display in the chooser no matter the settings of visible_in_chooser. Maybe this is by design since the value shows up in the graphic.

Here is the full kicad_dbl file as an example in case someone is interested in getting this to work with sqlite3:

    "meta": {
        "version": 0
    },
    "name": "KiCad Database Library",
    "description": "Component Database",
    "source": {
        "connection_string": ";Database=/home/srodgers/projects/kicad/database-library/kicad-db-lib.sqlite3;Driver=SQLite3"
    },
    "libraries": [
        {
            "name": "Resistors",
            "table": "Resistors",
            "key": "PartNumber",
            "symbols": "Symbol",
            "footprints": "Footprint",
            "fields": [
                {
                    "column": "PartNumber",
                    "name": "PartNumber",
                    "visible_on_add": false,
                    "visible_in_chooser": true,
                    "show_name": true,
                    "inherit_properties": true
                },
                {
                    "column": "Value",
                    "name": "Value",
                    "visible_on_add": true,
                    "visible_in_chooser": true,
                    "show_name": false
                },
                {
                    "column": "CaseSize",
                    "name": "CaseSize",
                    "visible_on_add": false,
                    "visible_in_chooser": true,
                    "show_name": false
                },
                {
                    "column": "Tolerance",
                    "name": "Tolerance",
                    "visible_on_add": false,
                    "visible_in_chooser": true,
                    "show_name": false
                },
                {
                    "column": "Power",
                    "name": "Power",
                    "visible_on_add": false,
                    "visible_in_chooser": true,
                    "show_name": false
                },
                {
                    "column": "TempCo",
                    "name": "TempCo",
                    "visible_on_add": false,
                    "visible_in_chooser": true,
                    "show_name": false
                }
            ]
        }
    ]
}

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