sqlsharp.1 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537
  1. .TH sqlsharp 1 "9 September 2008"
  2. .SH NAME
  3. sqlsharp \- Mono SQL Query command-line tool
  4. .SH SYNOPSIS
  5. .B sqlsharp
  6. [\-f filename] [\-o filename] [\-s]
  7. .SH DESCRIPTION
  8. sqlsharp is a Mono SQL tool used for entering SQL queries
  9. to a database using Mono data providers.
  10. .PP
  11. .SH OPTIONS
  12. The following options are supported:
  13. .TP
  14. .I "-f filename"
  15. Output file to load SQL commands from.
  16. .TP
  17. .I "-o filename"
  18. Output file to send results.
  19. .TP
  20. .I "-s"
  21. Silent mode.
  22. .PP
  23. .SH HOW TO USE
  24. The SQL tool accepts commands via its command line interface. Commands
  25. begin with a backslash followed by the command name.
  26. .PP
  27. Example:
  28. .nf
  29. \\open
  30. .fi
  31. .PP
  32. Basically, there are five commands a user should know:
  33. \\provider, \\connectionstring, \\open, \\quit, and \\help
  34. .PP
  35. To connect to a database, you need to do the following:
  36. .PP
  37. 1. set your data provider via \\provider
  38. .PP
  39. .nf
  40. Example:
  41. SQL# \\provider mysql
  42. .fi
  43. .PP
  44. 2. set your connection string via \\connectionstring
  45. .PP
  46. .nf
  47. Example:
  48. SQL# \\connectionstring Database=test
  49. .fi
  50. .PP
  51. 3. open a connection to the database via \\open
  52. .PP
  53. .nf
  54. Example:
  55. SQL# \\open
  56. .fi
  57. .PP
  58. .SH CONNECTION AND PROVIDER COMMANDS
  59. These commands are used to setup the provider,
  60. connection string, and open/close the database connnection
  61. .TP
  62. .I "ConnectionString"
  63. Sets the Connection String
  64. .nf
  65. Example:
  66. SQL# \\ConnectionString Database=testdb
  67. or
  68. SQL# \\cs Database=testdb
  69. For more examples, see section CONNECTION STRING EXAMPLES.
  70. .fi
  71. .TP
  72. .I "Provider"
  73. Sets the Provider of the Data Source. For list of Providers, see section PROVIDERS.
  74. .nf
  75. Example: to set the provider for MySQL:
  76. SQL# \\provider mysql
  77. or
  78. SQL# \\p mysql
  79. Note: if you need to load an external provider in SQL#,
  80. see the SQL# command \\loadextprovider
  81. .fi
  82. .TP
  83. .I "ListProviders"
  84. List ADO.NET 2.0 Providers available
  85. .nf
  86. Example:
  87. SQL# \\ListProviders
  88. or
  89. SQL# \\listp
  90. .fi
  91. .TP
  92. .I "BCS"
  93. Prompts you for building each connection parameter and builds the connection string
  94. and also allows you to enter a password wich does not echo.
  95. .nf
  96. Example:
  97. SQL# \\bcs
  98. ConnectionString Option: Data Source [] SQL# blazer
  99. ConnectionString Option: Persist Security Info [False] SQL#
  100. ConnectionString Option: Integrated Security [False] SQL#
  101. ConnectionString Option: User ID [] SQL# scott
  102. Password: *****
  103. ConnectionString Option: Enlist [False] SQL#
  104. ConnectionString Option: Pooling [True] SQL#
  105. ConnectionString Option: Min Pool Size [0] SQL#
  106. ConnectionString Option: Max Pool Size [100] SQL#
  107. ConnectionString Option: Unicode [False] SQL#
  108. ConnectionString Option: Load Balance Timeout [0] SQL#
  109. ConnectionString Option: Omit Oracle Connection Name [False] SQL#
  110. ConnectionString is set.
  111. .fi
  112. .TP
  113. .I "LoadExtProvider"
  114. ASSEMBLY CLASS to load an external provider. Use the complete name
  115. of its assembly and its Connection class.
  116. .nf
  117. Example: to load the MySQL provider Mono.Data.MySql
  118. SQL# \\loadextprovider Mono.Data.MySql Mono.Data.MySql.MySqlConnection
  119. .fi
  120. .TP
  121. .I "Open"
  122. Opens a connection to the database
  123. .nf
  124. Example:
  125. SQL# \\open
  126. .fi
  127. .TP
  128. .I "Close"
  129. Closes the connection to the database
  130. .nf
  131. Example:
  132. SQL# \\close
  133. .fi
  134. .TP
  135. .I "Default"
  136. show default variables, such as, Provider and ConnectionString.
  137. .nf
  138. Example:
  139. SQL# \\defaults
  140. .fi
  141. .TP
  142. .I "Q"
  143. Quit
  144. .nf
  145. Example:
  146. SQL# \\q
  147. .fi
  148. .SH SQL EXECUTION COMMANDS
  149. Commands to execute SQL statements
  150. .PP
  151. .TR
  152. .I "e"
  153. execute SQL query (SELECT)
  154. .nf
  155. Example: to execute a query
  156. SQL# SELECT * FROM EMPLOYEE
  157. SQL# \\e
  158. Note: to get \\e to automatically work after entering a query, put a
  159. semicolon ; at the end of the query.
  160. Example: to enter and exectue query at the same time
  161. SQL# SELECT * FROM EMPLOYEE;
  162. .fi
  163. .TP
  164. .I "exenonquery"
  165. execute a SQL non query (not a SELECT)
  166. .nf
  167. Example: to insert a row into a table:
  168. SQL# INSERT INTO SOMETABLE (COL1, COL2) VALUES('ABC','DEF')
  169. SQL# \\exenonquery
  170. Note: this can be used for those providers that are new and do not have
  171. the ability to execute queries yet.
  172. .fi
  173. .TP
  174. .I "exescalar"
  175. execute SQL to get a single row and single column.
  176. .nf
  177. Example: to execute a Maxium aggregate
  178. SQL# SELECT MAX(grade) FROM class
  179. SQL# \\exescalar
  180. .fi
  181. .TP
  182. .I "exexml"
  183. FILENAME to execute SQL and save output to XML file
  184. .nf
  185. Example:
  186. SQL# SELECT fname, lname, hire_date FROM employee
  187. SQL# \\exexml employee.xml
  188. Note: this depends on DataAdapter, DataTable, and DataSet
  189. to be working properly
  190. .fi
  191. .TP
  192. .SH FILE COMMANDS
  193. Commands for importing commands from file to SQL# and vice versa
  194. .TP
  195. .I "f"
  196. FILENAME to read a batch of SQL# commands from file
  197. .nf
  198. Example:
  199. SQL# \\f batch.sql#
  200. Note: the SQL# commands are interpreted as they are read. If there is
  201. any SQL statements, the are executed.
  202. .fi
  203. .TP
  204. .I "o"
  205. FILENAME to write result of commands executed to file.
  206. .nf
  207. Example:
  208. SQL# \\o result.txt
  209. .fi
  210. .TP
  211. .I "load"
  212. FILENAME to load from file SQL commands into SQL buffer.
  213. .nf
  214. Example:
  215. SQL# \\load commands.sql
  216. .fi
  217. .TP
  218. .I "save"
  219. FILENAME to save SQL commands from SQL buffer to file.
  220. .nf
  221. Example:
  222. SQL# \\save commands.sql
  223. .fi
  224. .SH GENERAL PURPOSE COMMANDS
  225. General commands to use.
  226. .TP
  227. .I "h"
  228. show help (all commands).
  229. .nf
  230. Example:
  231. SQL# \\h
  232. .fi
  233. .TP
  234. .I "s"
  235. TRUE, FALSE to silent messages.
  236. .nf
  237. Example 1:
  238. SQL# \\s true
  239. Example 2:
  240. SQL# \\s false
  241. .fi
  242. .TP
  243. .I "r"
  244. reset or clear the query buffer.
  245. .nf
  246. Example:
  247. SQL# \\r
  248. .fi
  249. .TP
  250. .I "print"
  251. show what's in the SQL buffer now.
  252. .nf
  253. Example:
  254. SQL# \\print
  255. .fi
  256. SH VARIABLES WHICH CAN BE USED AS PARAMETERS
  257. Commands to set variables which can be used as Parameters in an SQL statement. If the
  258. SQL contains any parameters, the parameter does not have a variable set, the
  259. user will be prompted for the value for each missing parameter.
  260. .TP
  261. .I "set"
  262. NAME VALUE to set an internal variable.
  263. .nf
  264. Example:
  265. SQL# \\set sFirstName John
  266. .fi
  267. .TP
  268. .I "unset"
  269. NAME to remove an internal variable.
  270. .nf
  271. Example:
  272. SQL# \\unset sFirstName
  273. .fi
  274. .TP
  275. .I "variable"
  276. NAME to display the value of an internal variable.
  277. .nf
  278. Example:
  279. SQL# \\variable sFirstName
  280. .fi
  281. .SH PROVIDER SUPPORT OPTIONS
  282. Enable or Disble support for a particular provider option
  283. .TP
  284. .I "UseParameters"
  285. TRUE,FALSE to use parameters when executing SQL which
  286. use the variables that were set.
  287. .PP
  288. If this option is true, the SQL
  289. contains parameters, and for each parameter
  290. which does not have a SQL# variable set, the
  291. user will be prompted to enter the value
  292. For that parameter.
  293. .nf
  294. Example:
  295. SQL# \\useparameter true
  296. .fi
  297. .PP
  298. Default: false
  299. .TP
  300. .I "UseSimpleReader"
  301. TRUE,FALSE to use simple reader when displaying results.
  302. .nf
  303. Example:
  304. SQL# \\usesimplereader true
  305. .fi
  306. .PP
  307. Default: false. Mostly, this is dependent on the provider. If the provider
  308. does not have enough of IDataReader implemented to have
  309. the normal reader working, then the simple reader can be used.
  310. Providers like SqlClient, MySQL, and PostgreSQL have this
  311. ption defaulting to true.
  312. .PP
  313. .SH PROVIDERS
  314. .nf
  315. PROVIDER NAME NAMESPACE ASSEMBLY
  316. oracle Oracle 8i-11g System.Data.OracleClient System.Data.OracleClient
  317. postgresql NetPostgreSQL Npgsql Npgsql
  318. bytefx ByteFX MySQL ByteFX.Data.MySqlClient ByteFX.Data
  319. sqlclient MS SQL 7-2008 System.Data.SqlClient System.Data
  320. odbc ODBC System.Data.Odbc System.Data
  321. sqlite SQL Lite Mono.Data.SqliteClient Mono.Data.SqliteClient
  322. sybase Sybase Mono.Data.SybaseClient Mono.Data.SybaseClient
  323. firebird Firebird SQL FirebirdSql.Data.FirebirdSql FirebirdSql.Data.Firebird
  324. mysql MySQL AB MySql.Data.MySqlClient MySql.Data
  325. NOTES:
  326. Ngsql is the .Net Data Provider for PosgreSQL. The
  327. latest verison can be downloaded from
  328. http://npgsql.projects.postgresql.org/
  329. MySql.Data is the MySQL Connector/Net for connecting to MySql databases.
  330. For MySQL, it is strongly recommend to use MySql.Data instead of the old
  331. ByteFX.Data provider. Unfortunately, MySql.Data is not included with Mono.
  332. You can download the latest MySQL Connector/Net from MySQL AB at
  333. http://dev.mysql.com/downloads/
  334. FirebirdSql.Data.Firebird can be downloaded from here:
  335. http://www.firebirdsql.org/index.php?op=files&id=netprovider
  336. .fi
  337. .SH CONNECTION STRING SAMPLES
  338. Example connection strings for various providers to be used via the
  339. command \\ConnectionString
  340. .nf
  341. Example of usage:
  342. \\connectionstring Database=testdb
  343. Connection String examples:
  344. Microsoft SQL Server via System.Data.SqlClient
  345. Server=DANPC;Database=pubs;User ID=saPassword=;
  346. For Integrated Security, bear in mind that Mono is not
  347. integrated with Windows, SQL Server client nor server, nor
  348. Windows Server. Therefore, you must provide the Windows Domain
  349. name and domain user name and password for this user.
  350. Server=DANPC;Database=pubs;User ID=DOMAIN\user;Password=pass;Integrated Security=SSPI
  351. For a server locally, you can use localhost.
  352. ODBC via System.Data.Odbc provider using
  353. a DSN named "MSSQLDSN" I set up
  354. in the Windows control panel's ODBC Data Sources
  355. which connects to Microsoft SQL Server 2000:
  356. DSN=MSSQLDSN;UID=danmorg;PWD=freetds
  357. To use ODBC ON Unix, consider unixODBC from http://www.unixodbc.org/
  358. or use iODBC from http://www.iodbc.org/
  359. SQL Lite via Mono.Data.SqliteClient
  360. provider which connects to the
  361. database file SqliteTest.db; if not found,
  362. the file is created:
  363. URI=file:SqliteTest.db
  364. Oracle via System.Data.OracleClient
  365. Data Source=testdb;User ID=scott;Password=tiger
  366. If you prefer to not use a tnsnames.ora file, you can
  367. use a connection string which allows a
  368. TNS network description that is parentheses delimited
  369. like the following which has the host, port, and
  370. service name. For host, you can specify an IP address
  371. instead of a hostname.
  372. User ID=SCOTT;
  373. Password=TIGER;
  374. Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.101)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=TESTDB)))
  375. Npgsql (.NET PostgreSQL) from
  376. http://gborg.postgresql.org/project/npgsql/projdisplay.php
  377. Server=localhost;Database=test;User ID=postgres;Password=fun2db
  378. ByteFX (ByteFX MySQL) from
  379. Please use MySql.Data instead.
  380. Server=localhost;Database=test;User ID=mysql;Password=
  381. FirebirdSql via FirebirdSql.Data.Firebird (download latest form FirebirdSql.org)
  382. Database=C:\\FIREBIRD\\EXAMPLES\\EMPLOYEE.FDB;User=SYSDBA;Password=masterkey;Dialect=3;Server=localhost
  383. MySQL via (MySql.Data) MySQL Connector/Net from http://www.mysql.com/
  384. Server=localhost;Database=test;User ID=mysql;Password=mypass;Pooling=false
  385. .fi
  386. .SH TRACING SUPPORT
  387. No support for tracing right now.
  388. .SH AUTHORS
  389. The Mono SQL Query Tool was written
  390. .nf
  391. by Daniel Morgan <[email protected]>
  392. .fi
  393. .PP
  394. .SH LICENSE
  395. The Mono SQL Query Tool is released under the terms of the GNU GPL.
  396. Please read the accompanying `COPYING' file for details. Alternative
  397. licenses are available from Novell or Daniel Morgan.
  398. .SH BUGS
  399. To report bugs in the compiler, you can use `bug-buddy', or you can
  400. file bug reports in our bug tracking system:
  401. .nf
  402. http://bugzilla.ximian.com.
  403. .fi
  404. .PP
  405. .SH MAILING LISTS
  406. For details, visit:
  407. .nf
  408. http://lists.ximian.com/mailman/listinfo/mono-devel-list
  409. .fi
  410. .SH WEB SITE
  411. For details, visit:
  412. .nf
  413. http://www.mono-project.com
  414. .fi
  415. .PP
  416. .SH SEE ALSO
  417. mono(1)