Save - Maple Help

Connection

 Save
 save the Connection settings

 Calling Sequence connection:-Save( name, opts )

Parameters

 connection - Connection module name - (optional) string; identifier for this connection opts - (optional) equation(s) of the form option=value where option is one of password, filename, overwrite, or create

Description

 • Save stores all the information necessary to re-establish connection (with the possible exception of the password) in a file. This connection can be re-established using the LoadConnection command.
 • Save can store multiple connections within a file by associating each connection with an identifier. If specified, name is used as the identifier. Otherwise, "default" is used as the identifier.
 • The opts argument can contain one or more of the following equations.
 filename = string
 The filename option specifies the file in which this connection is saved.  When not given, saved connections are placed in $HOME/maple/toolbox/Database/data/default.con, where$HOME is the value returned by kernelopts( homedir ).
 create = true or false
 The create option controls whether Save creates the directories necessary to save to the default filename.   If create is true these directories are created. If it is false they are not.  By default, create is false.
 overwrite = true or false
 The overwrite option controls whether the connection being saved overwrites a saved connection with the same identifier.  If overwrite is true the connection is overwritten. Otherwise, it is not.  By default, overwrite is false.
 password = string or one of the literal symbols none or hidden
 Important: The password is stored on disk in plain text.
 • Along with saving the parameters necessary to re-establish the connection, Save also stores the connection's current settings, as returned by GetOptions.  When this connection is loaded these settings will also be used.
 • The Save command returns nothing.

Examples

Create a connection.

 > $\mathrm{driver}≔\mathrm{Database}\left[\mathrm{LoadDriver}\right]\left(\right):$
 > $\mathrm{conn}≔\mathrm{driver}:-\mathrm{OpenConnection}\left(\mathrm{url},\mathrm{name},\mathrm{pass}\right):$

Save the connection to disk using the default file and the default identifier.

 > $\mathrm{conn}:-\mathrm{Save}\left(\right):$

Close the connection.

 > $\mathrm{conn}:-\mathrm{Close}\left(\right);$$\mathrm{driver}:-\mathrm{Close}\left(\right)$

Re-establish the connection saved as default.

 > $\mathrm{driver},\mathrm{conn}≔\mathrm{Database}\left[\mathrm{LoadConnection}\right]\left(\mathrm{password}='\mathrm{hidden}'\right):$

Modify this connection's options.

 > $\mathrm{conn}:-\mathrm{SetOptions}\left('\mathrm{autocommit}'=\mathrm{true}\right)$

Save using a different identifier and specify the password.

 > $\mathrm{conn}:-\mathrm{Save}\left("ac1",'\mathrm{password}'=\mathrm{pass}\right):$

Close the connection.

 > $\mathrm{conn}:-\mathrm{Close}\left(\right);$$\mathrm{driver}:-\mathrm{Close}\left(\right)$

Re-establish the "ac1" connection.

 > $\mathrm{driver},\mathrm{conn}≔\mathrm{Database}\left[\mathrm{LoadConnection}\right]\left("ac1"\right):$

Check this connection's options.

 > $\mathrm{conn}:-\mathrm{GetOptions}\left('\mathrm{autocommit}'\right)$
 $\left[{\mathrm{autocommit}}{=}{\mathrm{true}}\right]$ (1)