LoadDriver - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim





load a Database Driver


Calling Sequence




Calling Sequence





(optional) equations of the form option=string where option is one of driver or classpath



The LoadDriver command attempts to load a Java Database Connectivity [JDBC] driver, which Maple uses to connect to a database.  With no arguments, Maple tries to load a driver from a list of known drivers.  It uses the current value of the CLASSPATH environment variable as the search path for the Driver. If no JDBC driver can be loaded, then an exception is raised.  For more information about JDBC drivers, see JDBC.


The LoadDriver command returns a Driver module.  The OpenConnection export of this module can be used to connect to the database.  For an overview of using the Database package, see usage.


The LoadDriver command accepts two optional parameters that specify which driver to use.


driver = string


Specify the package name of the Java Driver class to use.  This name must be available in the documentation for the JDBC driver being used.  It must be similar in form to "com.vendorname.Driver".  If a classpath argument is not specified it looks for this class using the CLASSPATH environment variable.


classpath = string


Specify locations to search for the JDBC Driver.  The string must contain directories and .jar files in the same format as is used for the CLASSPATH variable.  That is, paths delimited by kernelopts( pathsep ), where a directory path indicates to search .class file within that directory and a .jar file indicates to search .class files within that .jar file.  Most JDBC drivers are shipped in the form of a .jar file.  For example classpath="database/java/jdbc.jar".  If you do not specify a driver argument then Maple attempts to load a Driver from a list of known drivers.


The list of known drivers used by LoadDriver is, com.mysql.jdbc.Driver (for MySQL databases), org.postgresql.Driver (for PostgreSQL databases), net.sourceforge.jtds.jdbc.Driver (for Microsoft SQL Server databases) and com.sybase.jdbc2.jdbc.SybDriver (for various Sybase databases).  When no driver argument is given, Maple stops searching after the first Driver is successfully loaded.  Therefore, specifying driver or classpath may be required if multiple JDBC drivers are installed.


Let Maple look for the driver.


Error, (in Database:-LoadDriver) a driver could not be loaded, please see ?Database:-LoadDriver

No valid driver found.  Try specifying the classpath.


Error, (in Database:-LoadDriver) could not load driver: classpath = c:\\database\\jdbc\\driver.jar

Still no driver found.  Try specifying the driver.


Error, (in Database:-LoadDriver) could not load driver: driver = com.jdbc.Driver

This time specify both.


drivermoduleoptionunload=Close;localhandle;exportOpenConnection,Close;end module


See Also