On this page

Getting started

Ten minutes from the first start to a query on your own database: start BroadSQL, try the sample database, add your connection, and learn the few rules that apply everywhere. If you haven't installed BroadSQL yet, see Installation first.

Start BroadSQL

Start connect.bat on Windows, or ./broadsql.sh on Linux. BroadSQL asks for the master password, the password that encrypts the file where it keeps your connections:

Enter master password:

Type the default password, clipper8AD, and press Enter. You land at the BroadSQL prompt, not connected to any database yet:

BroadSQL>

Every installation ships with this same default password: change it with SET MASTER PASSWORD; before you add real connections (see Security).

Try it now: the WORLD sample database

BroadSQL comes with a sample database, WORLD: countries, cities and languages, in an H2 database included in the download. Nothing to install or configure:

BroadSQL> CONNECT WORLD;
WORLD> SELECT CODE, NAME, POPULATION FROM COUNTRY WHERE CONTINENT = 'Europe' AND POPULATION >= 50000000 ORDER BY POPULATION DESC;
|----|----------------------------------------------------|-----------|
|CODE|NAME                                                |POPULATION |
|----|----------------------------------------------------|-----------|
|RUS |Russian Federation                                  |146934000  |
|DEU |Germany                                             |82164700   |
|GBR |United Kingdom                                      |59623400   |
|FRA |France                                              |59225700   |
|ITA |Italy                                               |57680000   |
|UKR |Ukraine                                             |50456000   |
|----|----------------------------------------------------|-----------|

6 rows fetched in 12 ms.

WORLD>
Illustrative output: the rows are those of the documented run of the same query in a Script, on the WORLD sample (Arguments and parameters); the time of the run differs every time.

Four more commands to try on it:

WORLD> SHOW TABLES;
WORLD> DESCR COUNTRY;
WORLD> SHOW REFERENCES COUNTRY;
WORLD> DUMP COUNTRY TO countries AS CSV;

SHOW TABLES lists the tables, DESCR describes the columns of one, SHOW REFERENCES shows what points to it, and DUMP writes it to countries.csv in the export folder. With the interactive console, DESCR COU followed by Tab offers COUNTRY and COUNTRYLANGUAGE.

WORLD is the file samples/WorldDB.mv.db of the installation, opened with the URL jdbc:h2:./samples/WorldDB, user sa and no password. It is ordinary sample data: change it as you like. To get the original back, replace the file with the one from the BroadSQL download while BroadSQL is not connected to it.

Step 1: add your first connection

Windows: type CONFIG; at any prompt. A window opens: fill in the connection and save it.

Linux, or any platform from the prompt: type ADD CONNECTION MYDB; and answer its questions, then y to save. The connection is tested right after it is saved.

Either way, a connection has these fields:

FieldWhat to enter
IDWhat you will type after CONNECT: at most 15 characters, not case-sensitive (MYDB and mydb are the same).
NameA human-friendly description.
TypeThe database type, which gives the JDBC driver: PostgreSQL, H2, Oracle, SQL Server...
URLThe JDBC URL of the database, for example jdbc:postgresql://dbhost:5432/mydb.
User name and passwordThe database account. The password is stored encrypted.
Database GroupOptional: the application this database belongs to, such as WORLDAPP in the examples of this site.
EnvironmentDEV, QA, PROD... An Environment flagged Production asks before any change.
CommentFree text, optional.

For Oracle, SQL Server, MySQL and the others, copy the vendor's JDBC driver into the drivers folder first: Connect to your database has a page per database, with the URL format and the type to choose.

Step 2: connect and run your first query

BroadSQL> CONNECT MYDB;
MYDB> SHOW TABLES;

CONNECT tests the connection before switching to it, so a wrong URL or password is reported at once and leaves you where you were. From the prompt, type any SQL your database understands, ending with ;: BroadSQL sends what it does not recognize as one of its own commands to the database unchanged.

The essentials

Every command, BroadSQL's own or plain SQL, ends with ;. A command can span several lines; it runs once BroadSQL reads the closing ;. Several commands can share one line, each ending with its own ;: they run in order, and if one fails, the ones after it on that line are not run. A ; inside a quoted value (SELECT 'a;b';) is never taken as the end of a command.

CommandWhat it does
CONNECT <id>Opens a connection. OPEN, CON and CONN are aliases.
DISCONNECTCloses the current connection.
HELPLists the command categories; HELP <command> shows one command, HELP FIND <text> searches, HELP SHORTCUTS lists the keys.
exitQuits BroadSQL, closing every connection cleanly. Lowercase, without ;.

The console remembers and completes what you type:

KeyEffect
TabCompletes commands, SQL keywords, table and column names, connection IDs, Scripts and file paths.
Up / Down, Ctrl+RRecall and search earlier commands, including those of previous sessions.
EscCancels everything you are typing, including earlier lines of an unfinished statement.
Ctrl+CStops the command that is running; while typing, abandons the current line.

Two shortcuts worth knowing from day one:

  • / on a line by itself runs the last SQL statement again; / PROD runs it once on the PROD connection of the same Database Group, without switching (see Connections, Database Groups and Environments).
  • @<script> runs a Script, a text file of SQL and BroadSQL commands from the Scripts Library (see Running Scripts).

Every syntax element of this kind is on one page: Syntax and shortcuts.

Where to go next

Found something wrong or unclear on this page? , with the page address.