2.4: Using Files in ChessDB
In this section, you will learn how to:
- open databases or PGN files in ChessDB.
- create new databases in ChessDB.
- import games into a database.
We will use the sample.pgn file in our examples, which you can download by clicking the link just given.
ChessDB uses a fast, compact and efficient three-file format for chess databases, with the file extensions .si3, .sg3 and .sn3. Please note that all three files are essential components of a database, so do not remove one of them to save disk space!
There are seveal ways to get a database.
- One is supplied. It has the name 2600+players. It is in the direcotry
C:\Program File\ChessDB\bin\databasesIt has 27,681 games all played by players rated 2600 Elo or above.
- You can create one by reaeding in a PGN file as explained here
- and other ways
Opening a PGN file or database
One way to open a file in ChessDB is to specifiy it on a command line, for example: chessdb sample.pgn But we will assume you already have ChessDB running and want to open a file in it.
To open a file (of any format ChessDB can recognise) in ChessDB, select the File / Open menu command, or use the Ctrl+O shortcut or the toolbar icon. You should see a standard file-open dialog box, and see the file named tutorial.pgn listed if is in the current directory. Open it now.
If you want to compare files in a directory by size or age before opening one of them, you can use the ChessDB File finder, available from the File menu, the Ctrl+/ shortcut key or the toolbar icon. The file finder is also useful if you know the name of a file that ChessDB can open, but cannot remember where it is.
Once you have opened sample.pgn, notice how the main window has changed. The game information area should now show information about the first game in the file, like the screenshot shown here. It shows that the first game in the file saw Vladimir Kramnik (rated 2770) scored a win (1-0) with the White pieces against Peter Leko (rated 2743) in a match in Budapest in 2001.
Also note that whenever you open a PGN file, ChessDB also produces a window with the title ChessDB: Importing PGN file that shows any errors that might have been detected. This is very useful since adherence to the PGN standard varies widely and it is common to find poorly formatted PGN files on the Internet that confuse most chess software. But for most PGN files this window should indicate games were imported with "no errors or warnings".
Creating a new database
You cannot edit a PGN file in ChessDB, as they are opened read-only and file maintenance functions are only available for ChessDB-format database files. So you will want to create one or more ChessDB-format databases and import games from PGN files into them.
You can create a new database with the File / New menu item, the Ctrl+N shortcut or the toolbar icon. Do this now. You should see a standard file-save dialog box, where you can type the name of a new file to be created. Enter the name mybase for example. This will create a new database called mybase, using the three-file format described above.
After creating the new database mybase, you should now see from the status bar that your new database has no games in it.
The database switcher
ChessDB now has two files open: the tutorial.pgn file, and your empty mybase database. You can switch between files from the File menu, but a much nicer way is to use the Switcher window. Open it now by using the Windows / Database switcher menu item, the Ctrl+D shortcut, or the toolbar icon. You should see a window like this:
The Switcher shows which files you have open, with the current file highlighted in yellow. You can see from the five slots of the switcher that ChessDB allows you to have up to four files open at one time, plus a clipbase (the very last slot) that is useful as a temporary database. (Note: The clipbase is a special database that is always open but only exists in memory; it does not use any files on your disk drive. When you exit ChessDB, the clipbase contents are lost and the clipbase will be empty when you next run ChessDB.)
To switch to a different file, simply click the left mouse button on its slot in the Switcher. Pressing the right mouse button over a switcher slot pops up a menu of commands that act on the database in that slot.
Selecting an icon
You should see, as in the screenshot above, that the tutorial.pgn file and the clipbase have graphical icons to help you distinguish between them, but your new database has no icon. A PGN file is always given the icon you can see for tutorial.pgn, but for ChessDB-format databases there are over 20 icons you can choose from. The icon has no significance outside of the switcher window; it is only a graphical aid to help identifying databases.
Move the mouse cursor to the slot with your new database, press the right mouse button, and select Change icon... from the pop-up menu. A dialog box like the one shown here should appear. Click on icon that you want for your new database and select OK. You should see the switcher updated to show the new icon.
Customizing the Switcher
Hint: if you don't like a wide flat Switcher window, you can make it tall and narrow by pressing the right mouse button in it and selecting Change window orientation from the popup menu. Also, if you have read the earlier section about customising ChessDB, you will know that you can move it to a screen location that suits you, then select the Options / Save Options menu item to remember its location for future ChessDB sessions. If you eventually make use of the Switcher often in ChessDB and want it to always appear when ChessDB starts, turn on the Database switcher checkbox in the Options / Startup menu and then save options.
So now you have a PGN file and a ChessDB-format database open, but no games in the database. There are two ways you can import the games from the PGN file to your new database. The first is to make sure your database is the active database (meaning it is the one highlighted in yellow in the Switcher window and named in the main window status bar), and then use the Tools / Import file of PGN games... menu command. But since you already have the tutorial.pgn PGN file open, there is a faster way: you can use drag-and-drop in the Switcher window.
Move the mouse cursor over the tutorial.pgn slot in the Switcher, and press the mouse button down. You should see the cursor change its shape. Keep holding down the left mouse button, and drag the mouse cursor to the slot where your new tutorial database is. Now release the button. This tells ChessDB you want to copy the games from the PGN file to your database. You should now see a dialog box like the one shown here. Select Copy games, and all the games in sample.pgn will be copied to your database.
If you would like to contribute to the tutorial or see anything that should be updated, corrected or improved, please contact David Kirkby. But please note David only speaks English.
Website administered by Dr. David Kirkby
This page was last modified: September 16, 2007. 10:41:41 am GMT