save the Connection settings - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Connectivity : Database Package : Connection : Database/Connection/Save

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

  

The password option controls the storage of a database password.  The Database does not store the passwords used to connect to databases unless explicitly told to do so.  If no password is stored, you must specify one when calling LoadConnection.  By using the password option, you store a password with the connection.  This allows the connection to be re-established without entering the password at load time.  If a string is given, that string is used as the password. If hidden is given, a Maplet application is opened to allow you to enter your password without it appearing in the worksheet.  The default value is none.

  

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.

driver:=Database[LoadDriver]:

conn:=driver:-OpenConnectionurl,name,pass:

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

conn:-Save:

Close the connection.

conn:-Close;driver:-Close

Re-establish the connection saved as default.

driver,conn:=Database[LoadConnection]password='hidden':

Modify this connection's options.

conn:-SetOptions'autocommit'=true

Save using a different identifier and specify the password.

conn:-Saveac1,'password'=pass:

Close the connection.

conn:-Close;driver:-Close

Re-establish the "ac1" connection.

driver,conn:=Database[LoadConnection]ac1:

Check this connection's options.

conn:-GetOptions'autocommit'

autocommit=true

(1)

See Also

Database, Database[Connection], Database[Connection][GetOptions], Database[Connection][SetOptions], Database[LoadConnection], Database[usage]


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam