Driver - Maple Programming Help

Home : Support : Online Help : Connectivity : Database Package : Driver : Database/Driver/Close

Driver

 Close
 closes the Driver Module

 Calling Sequence driver:-Close()

Parameters

 driver - Driver module

Description

 • Close frees the resources associated with driver.  This also happens when the resources are freed via garbage collection; however, you can call Close to release the resources immediately.
 • Any descendant modules of driver are closed when driver is closed.  (A module is a descendant of driver if it is returned by one of driver's exports or is a descendant of one of driver's descendants.)

Examples

Load the JDBC driver and open a connection to the database.

 > $\mathrm{driver}≔\mathrm{Database}[\mathrm{LoadDriver}]\left('\mathrm{driver}'="com.database.Driver",'\mathrm{classpath}'="/path/to/jar/jdbc.jar"\right):$
 > $\mathrm{conn}≔\mathrm{driver}:-\mathrm{OpenConnection}\left("jdbc:dbdriver://localhost/DBName","user1","passwd",'\mathrm{isolation}'='\mathrm{serializable}'\right):$

Close the driver.

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

Try to use the connection.

 > $\mathrm{conn}:-\mathrm{ExecuteQuery}\left("SELECT * FROM datatable"\right)$

 Error, (in ExecuteQuery) this object has been closed, no further operations are possible

Try to use the driver.

 > $\mathrm{conn}≔\mathrm{driver}:-\mathrm{OpenConnection}\left("jdbc:dbdriver://localhost/DBName","user1","passwd",'\mathrm{isolation}'='\mathrm{serializable}'\right)$

 Error, (in ExecuteQuery) this object has been closed, no further operations are possible