sqlsharp(1)
π sqlsharp(1) π
okay bestie, listen up β this is sqlsharp, straight outta the General Commands Manual. it's a Mono SQL Query command-line tool and honestly? it's giving main character energy for your terminal. π
β¨ NAME β¨
sqlsharp β the Mono SQL Query command-line tool. yeah. that's her. π
πΈ SYNOPSIS πΈ
sqlsharp [-f filename] [-o filename] [-s]
π¦ DESCRIPTION π¦
so like, sqlsharp is a Mono SQL tool that you use for entering SQL queries to a database using Mono data providers. that's the whole vibe. you type SQL, it talks to your database, everybody wins. π
π OPTIONS π
here's what you can pass her, bestie:
-ffilenameβ Output file to load SQL commands from. like, it slurps your SQL out of a file. π-ofilenameβ Output file to send results. where the answers go to live. π-sβ Silent mode. shhh. π€« no yapping.
π HOW TO USE π
okay so the SQL tool takes commands through its command line interface. every command starts with a backslash followed by the command name. that's the whole thing. iconic behavior honestly.
Example:
\open
basically? there are five commands a user should know: \provider, \connectionstring, \open, \quit, and \help. those five. memorize them. iykyk. π§ β¨
to connect to a database, you gotta do this little three-step routine:
- set your data provider via
\provider
Example:
SQL# \provider mysql
- set your connection string via
\connectionstring
Example:
SQL# \connectionstring Database=test
- open a connection to the database via
\open
Example:
SQL# \open
boom. connected. slay. π₯
π CONNECTION AND PROVIDER COMMANDS π
these commands are used to setup the provider, the connection string, and to open/close the database connection. (yes the original says "connnection", we love her anyway π)
ConnectionStringβ Sets the Connection String
Example:
SQL# \ConnectionString Database=testdb
or
SQL# \cs Database=testdb
for more examples, go look at the section CONNECTION STRING EXAMPLES. π
Providerβ Sets the Provider of the Data Source. for the list of Providers, peep the section PROVIDERS.
Example: to set the provider for MySQL:
SQL# \provider mysql
or
SQL# \p mysql
Note: if you need to load an external provider in SQL#, see the SQL# command \loadextprovider. π«Ά
ListProvidersβ List ADO.NET 2.0 Providers available
Example:
SQL# \ListProviders
or
SQL# \listp
BCSβ Prompts you for building each connection parameter and builds the connection string and also lets you enter a password which does not echo. very discreet. very demure. π
Example:
SQL# \bcs
ConnectionString Option: Data Source [] SQL# blazer
ConnectionString Option: Persist Security Info [False] SQL#
ConnectionString Option: Integrated Security [False] SQL#
ConnectionString Option: User ID [] SQL# scott
Password: *****
ConnectionString Option: Enlist [False] SQL#
ConnectionString Option: Pooling [True] SQL#
ConnectionString Option: Min Pool Size [0] SQL#
ConnectionString Option: Max Pool Size [100] SQL#
ConnectionString Option: Unicode [False] SQL#
ConnectionString Option: Load Balance Timeout [0] SQL#
ConnectionString Option: Omit Oracle Connection Name [False] SQL#
ConnectionString is set.
LoadExtProviderβASSEMBLY CLASSto load an external provider. use the complete name of its assembly and its Connection class.
Example: to load the MySQL provider Mono.Data.MySql
SQL# \loadextprovider Mono.Data.MySql Mono.Data.MySql.MySqlConnection
Openβ Opens a connection to the database
Example:
SQL# \open
Closeβ Closes the connection to the database
Example:
SQL# \close
Defaultβ show default variables, such as,ProviderandConnectionString.
Example:
SQL# \defaults
Qβ Quit. bye bestie! π
Example:
SQL# \q
π₯ SQL EXECUTION COMMANDS π₯
commands to execute SQL statements. the moment we've all been waiting for. β
e β execute SQL query (SELECT)
Example: to execute a query
SQL# SELECT * FROM EMPLOYEE
SQL# \e
Note: to get\eto automatically work after entering a query, put a semicolon;at the end of the query. life hack fr fr.
Example: to enter and exectue query at the same time
SQL# SELECT * FROM EMPLOYEE;
exenonqueryβ execute a SQL non query (not a SELECT)
Example: to insert a row into a table:
SQL# INSERT INTO SOMETABLE (COL1, COL2) VALUES('ABC','DEF')
SQL# \exenonquery
Note: this can be used for those providers that are new and do not have the ability to execute queries yet. πΌ
exescalarβ execute SQL to get a single row and single column. just one. singular. one single lil value. β¨
Example: to execute a Maxium aggregate
SQL# SELECT MAX(grade) FROM class
SQL# \exescalar
exexml FILENAMEβ to execute SQL and save output to XML file
Example:
SQL# SELECT fname, lname, hire_date FROM employee
SQL# \exexml employee.xml
Note: this depends onDataAdapter,DataTable, andDataSetto be working properly. so like, if those are broken, this is broken. no cap.
πΎ FILE COMMANDS πΎ
commands for importing commands from file to SQL# and vice versa. the whole round trip. π¦
fFILENAMEβ to read a batch of SQL# commands from file
Example:
SQL# \f batch.sql#
Note: the SQL# commands are interpreted as they are read. if there are any SQL statements, the are executed. π
oFILENAMEβ to write result of commands executed to file.
Example:
SQL# \o result.txt
loadFILENAMEβ to load from file SQL commands into SQL buffer.
Example:
SQL# \load commands.sql
saveFILENAMEβ to save SQL commands from SQL buffer to file.
Example:
SQL# \save commands.sql
π GENERAL PURPOSE COMMANDS π
general commands to use. the everyday essentials. the little black dress of SQL# commands. π
hβ show help (all commands).
Example:
SQL# \h
sβTRUE,FALSEto silent messages.
Example 1:
SQL# \s true
Example 2:
SQL# \s false
rβ reset or clear the query buffer. clean slate energy. π§Ό
Example:
SQL# \r
printβ show what's in the SQL buffer now.
Example:
SQL# \print
β¨ SH VARIABLES WHICH CAN BE USED AS PARAMETERS β¨
commands to set variables which can be used as Parameters in an SQL statement. if the SQL contains any parameters, the parameter does not have a variable set, the user will be prompted for the value for each missing parameter. so like, she'll ask. politely. π
setNAME VALUEβ to set an internal variable.
Example:
SQL# \set sFirstName John
unsetNAMEβ to remove an internal variable.
Example:
SQL# \unset sFirstName
variableNAMEβ to display the value of an internal variable.
Example:
SQL# \variable sFirstName
π PROVIDER SUPPORT OPTIONS π
Enable or Disble support for a particular provider option. toggle time, bestie. π
UseParametersβTRUE,FALSEto use parameters when executing SQL which use the variables that were set.
if this option is true, the SQL contains parameters, and for each parameter which does not have a SQL# variable set, the user will be prompted to enter the value for that parameter.
Example:
SQL# \useparameter true
Default: false
UseSimpleReaderβTRUE,FALSEto use simple reader when displaying results.
Example:
SQL# \usesimplereader true
Default:false. mostly, this is dependent on the provider. if the provider does not have enough ofIDataReaderimplemented to have the normal reader working, then the simple reader can be used. providers like SqlClient, MySQL, and PostgreSQL have this ption defaulting to true.
π PROVIDERS π
here's the lineup, bestie. every single one. π
oracleβ NAME:Oracle 8i-11g, NAMESPACE:System.Data.OracleClient, ASSEMBLY:System.Data.OracleClientpostgresqlβ NAME:NetPostgreSQL, NAMESPACE:Npgsql, ASSEMBLY:Npgsqlbytefxβ NAME:ByteFX MySQL, NAMESPACE:ByteFX.Data.MySqlClient, ASSEMBLY:ByteFX.Datasqlclientβ NAME:MS SQL 7-2008, NAMESPACE:System.Data.SqlClient, ASSEMBLY:System.Dataodbcβ NAME:ODBC, NAMESPACE:System.Data.Odbc, ASSEMBLY:System.Datasqliteβ NAME:SQL Lite, NAMESPACE:Mono.Data.SqliteClient, ASSEMBLY:Mono.Data.SqliteClientsybaseβ NAME:Sybase, NAMESPACE:Mono.Data.SybaseClient, ASSEMBLY:Mono.Data.SybaseClientfirebirdβ NAME:Firebird SQL, NAMESPACE:FirebirdSql.Data.FirebirdSql, ASSEMBLY:FirebirdSql.Data.Firebirdmysqlβ NAME:MySQL AB, NAMESPACE:MySql.Data.MySqlClient, ASSEMBLY:MySql.Data
π NOTES π
Ngsql is the .Net Data Provider for PosgreSQL. the latest version can be downloaded from http://npgsql.projects.postgresql.org/
MySql.Data is the MySQL Connector/Net for connecting to MySql databases. for MySQL, it is strongly recommend to use MySql.Data instead of the old ByteFX.Data provider. unfortunately, MySql.Data is not included with Mono. you can download the latest MySQL Connector/Net from MySQL AB at http://dev.mysql.com/downloads/
FirebirdSql.Data.Firebird can be downloaded from here: http://www.firebirdsql.org/index.php?op=files&id=netprovider
Microsoft SQL Server via System.Data.SqlClient
Server=DANPC;Database=pubs;User ID=saPassword=;
For Integrated Security, bear in mind that Mono is not integrated with Windows, SQL Server client nor server, nor Windows Server. So you literally have to hand over the Windows Domain name, the domain user name, and the password for this user. No shortcuts, bestie.
Server=DANPC;Database=pubs;User ID=DOMAINser;Password=pass;Integrated Security=SSPI
And if your server is local? Just use localhost. π
ODBC via System.Data.Odbc provider
This one uses a DSN named "MSSQLDSN" that I set up in the Windows control panel's ODBC Data Sources, and it connects to Microsoft SQL Server 2000:
DSN=MSSQLDSN;UID=danmorg;PWD=freetds
Wanna do ODBC on Unix? Then consider unixODBC from http://www.unixodbc.org/ or use iODBC from http://www.iodbc.org/ π
SQL Lite via Mono.Data.SqliteClient
This provider connects to the database file SqliteTest.db β and if it's not found, the file is created β¨ (yes, it just manifests. iconic behaviour tbh.)
URI=file:SqliteTest.db
Oracle via System.Data.OracleClient
Data Source=testdb;User ID=scott;Password=PLACEHOLDER
If you prefer to not use a tnsnames.ora file, you can use a connection string which allows a TNS network description that is parentheses delimited, like the following β which has the host, port, and service name. And for host, you can specify an IP address instead of a hostname. π
User ID=SCOTT;
Password=TIGER;
Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.101)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=TESTDB)))
Npgsql (.NET PostgreSQL)
Straight from http://gborg.postgresql.org/project/npgsql/projdisplay.php
Server=localhost;Database=test;User ID=postgres;Password=fun2db
ByteFX (ByteFX MySQL)
from
Please use MySql.Data instead. π¨ (this one's a deprecated vibe, bestie β swap it out)
Server=localhost;Database=test;User ID=mysql;Password=
FirebirdSql via FirebirdSql.Data.Firebird
(download the latest from FirebirdSql.org)
Database=C:\FIREBIRD\EXAMPLES\EMPLOYEE.FDB;User=SYSDBA;Password=masterkey;Dialect=3;Server=localhost
MySQL via (MySql.Data) MySQL Connector/Net
Server=localhost;Database=test;User ID=mysql;Password=mypass;Pooling=false
π TRACING SUPPORT π
No support for tracing right now. That's it. That's the whole section. π Nothing to see here, moving on. π«Ά
βοΈ AUTHORS βοΈ
The Mono SQL Query Tool was written by Daniel Morgan <monodanmorg@yahoo.com> π
π LICENSE π
The Mono SQL Query Tool is released under the terms of the GNU GPL. Please read the accompanying COPYING file for details. π
Alternative licenses are available from Novell or Daniel Morgan. β¨
π BUGS π
To report bugs in the compiler, you can file bug reports in our bug tracking system:
https://github.com/mono/mono/issues
go be the main character who actually files the issue, bestie π
π MAILING LISTS π
For details, visit:
http://lists.ximian.com/mailman/listinfo/mono-devel-list
π WEB SITE π
For details, visit:
π SEE ALSO π
and that's a wrap on sqlsharp(1), bestie π this page is dated 9 September 2008 and it came out of the sqlsharp source β so yeah, it's vintage, but it still ate. go query something iconic. ππ¦
π¦ where this page comes from
- alpine 3.24: mono-doc 6.14.1-r1 Β· MIT
- epel 10: mono-data 6.14.1-1.el10_2 Β· MIT
- fedora 44: mono-data 6.14.1-3.fc44 Β· MIT
- fedora 44: mono-data 6.14.1-4.fc44 Β· MIT
- nixos 26.05: mono 6.14.1
- nixpkgs unstable: mono 6.14.1
- ubuntu resolute: mono-devel 6.14.1+ds2-2 Β· MIT
- ubuntu stonking: mono-devel 6.14.1+ds2-3 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms