< Day Day Up > |
Database connection functions let you make and manage any connection, including the Dreamweaver-provided ADO, ColdFusion, and JDBC connections. These functions interface with the Connection Manager only; they do not access a database. For functions that access a database, see "Database access functions" on page 590. MMDB.deleteConnection()Availability Dreamweaver MX. Description This function deletes the named database connection. Arguments connName
Returns Nothing. Example The following example deletes a database connection: function clickedDelete() { var selectedObj = dw.serverComponents.getSelectedNode(); if (selectedObj && selectedObj.objectType=="Connection") { var connRec = MMDB.getConnection(selectedObj.name); if (connRec) { MMDB.deleteConnection(selectedObj.name); dw.serverComponents.refresh(); } } } MMDB.getColdFusionDsnList()Availability Dreamweaver UltraDev 4. Description This function gets the ColdFusion data source names (DSNs) from the site server, using the geTRDSUserName() and getrDSPassword() functions. Arguments None. Returns An array that contains the ColdFusion DSNs that are defined on the server for the current site. MMDB.getConnection()Availability Dreamweaver UltraDev 4, enhanced in Dreamweaver MX. Description This function gets a named connection object. Arguments name
Returns A reference to a named connection object. Connection objects contain the following properties:
NOTE These properties are the standard ones that Dreamweaver implements. Developers can define their connection types and add new properties to this standard set or provide a different set of properties. MMDB.getConnectionList()Availability Dreamweaver UltraDev 1. Description This function gets a list of all the connection strings that are defined in the Connection Manager. Arguments None. Returns An array of strings where each string is the name of a connection as it appears in the Connection Manager. Example A call to MMDB.getConnectionList() can return the strings ["EmpDB", "Test", TestEmp"]. MMDB.getConnectionName()Availability Dreamweaver UltraDev 1. Description This function gets the connection name that corresponds to the specified connection string. This function is useful when you need to reselect a connection name in the user interface (UI) from data on the page. If you have a connection string that references two drivers, you can specify the connection string and the driver that corresponds to the connection name that you want to return. For example, you can have two connections.
ConnectionString="jdbc:inetdae:velcro-qa-5:1433?database=pubs" DriverName="com.inet.tds.TdsDriver2" The connection strings for Connection 1 and Connection 2 are the same. Connection 2 connects to a more recent version of the tdsDriver driver. You should pass the driver name to this function to fully qualify the connection name you want to return. Arguments connString, {driverName}
Returns A connection name string that corresponds to the connection string. Example The following code returns the string "EmpDB": var connectionName = MMDB.getConnectionName ("dsn=EmpDB;uid=;pwd="); MMDB.getConnectionString()Availability Dreamweaver UltraDev 1. Description This function gets the connection string that is associated with the named connection. Arguments connName
Returns A connection string that corresponds to the named connection. Example The code var connectionString = MMDB.getConnectionString ("EmpDB") returns different strings for an ADO or JDBC connection.
MMDB.getDriverName()Availability Dreamweaver UltraDev 1. Description This function gets the driver name that is associated with the specified connection. Only a JDBC connection has a driver name. Arguments connName
Returns A string that contains the driver name. Example The statement MMDB.getDriverName ("EmpDB"); might return the following string: "jdbc/oracle/driver/JdbcOracle" MMDB.getDriverUrlTemplateList() (deprecated)Availability Dreamweaver UltraDev 4, deprecated in Dreamweaver MX. NOTE For Dreamweaver UltraDev 4, the list of JDBC drivers are stored in the connections.xml file, which is located in the Configuration/Connections folder. Each driver has an associated URL template. This function returns the list of JDBC drivers. For Dreamweaver MX (or later), these drivers and URL templates are hard-coded in the JDBC dialog boxes. In addition, this function is an empty function definition to eliminate undefined-function errors. The following example shows how a JDBC driver and URL template are hard-coded: var DEFAULT_DRIVER = "COM.ibm.db2.jdbc.app.DB2Driver"; var DEFAULT_TEMPLATE = "jdbc:db2:[database name]"; Dreamweaver has a dialog box for each driver/URL template pair. In summary, Dreamweaver UltraDev 4 developers need to add a new entry to the XML, and Dreamweaver MX (or later), developers need to implement a new dialog box. Description This function gets JDBC Drivers and respective URL templates. Arguments None. Returns An array that contains JDBC drivers that have been detected on the user's system and their respective URL templates, if they are specified. The array has an even number of elements that contain: Driver1, UrlTemplate1, Driver2, UrlTemplate2, and so on. MMDB.getLocalDsnList()Availability Dreamweaver UltraDev 4. Description This function gets ODBC DSNs that are defined on the user's system. Arguments None. Returns An array that contains the ODBC DSNs that are defined on the user's system. MMDB.getPassword()Availability Dreamweaver UltraDev 1. Description This function gets the password that is used for the specified connection. Arguments connName
Returns A password string that is associated with the connection name. Example The statement MMDB.getPassword ("EmpDB"); might return "joessecret". MMDB.getRDSPassword()Availability Dreamweaver UltraDev 4. Description This function gets the Remote Development Services (RDS) password (for use with ColdFusion connections). Arguments None. Returns A string that contains the RDS password. MMDB.getRDSUserName()Availability Dreamweaver UltraDev 4. Description This function gets the RDS user name (for use with ColdFusion connections). Arguments None. Returns A string that contains the RDS user name. MMDB.getRemoteDsnList()Availability Dreamweaver UltraDev 4, enhanced in Dreamweaver MX. Description This function gets the ODBC DSNs from the site server. The geTRDSUserName() and getrDSPassword() functions are used when the server model of the current site is ColdFusion. This function provides an option for a developer to specify a URL parameter string to be appended to the Remote Connectivity URL that MMDB.getRemoteDsnList() generates. If the developer provides a parameter string, this function passes it to the HTTP connectivity scripts. Arguments {urlParams}
Returns Returns an array that contains the ODBC DSNs that are defined on the server for the current site. MMDB.getRuntimeConnectionType()Availability Dreamweaver UltraDev 1. Description This function returns the runtime connection type of the specified connection name. Arguments connName
Returns A string that corresponds to the connection type. This function can return one of the following values: "ADO", "ADODSN", "JDBC", or "CFDSN". Example The following code returns the string "ADO" for an ADO connection: var connectionType = MMDB.getRuntimeConnectionType ("EmpDB") MMDB.getUserName()Availability Dreamweaver UltraDev 1. Description This function returns a user name for the specified connection. Arguments connName
Returns A user name string that is associated with the connection name. Example The statement MMDB.getUserName ("EmpDB"); might return "amit". MMDB.hasConnectionWithName()Availability Dreamweaver UltraDev 4. Description This function determines whether a connection of a given name exists. Arguments name
Returns Returns a Boolean value: true indicates that a connection with the specified name exists; false otherwise. MMDB.needToPromptForRdsInfo()Availability Dreamweaver MX. Description This function determines whether Dreamweaver should open the RDS Login Information dialog box. Arguments bForce
Returns A Boolean value: TRue indicates that the user needs to be prompted for RDS login information; false otherwise. MMDB.needToRefreshColdFusionDsnList()Availability Dreamweaver MX. Description This function tells the Connection Manager to empty the cache and get the ColdFusion data source list from the application server the next time a user requests the list. Arguments None. Returns Nothing. MMDB.popupConnection()Availability Dreamweaver MX. Description This function invokes a connection dialog box. This function has the following three signatures:
Arguments dialogFileName or connRec or connrec, bDuplicate
Returns Nothing. The defined connection dialog box appears. MMDB.setRDSPassword()Availability Dreamweaver UltraDev 4. Description This function sets the RDS password. Arguments password
Returns Nothing. MMDB.setRDSUserName()Availability Dreamweaver UltraDev 4. Description This function sets the RDS user name. Arguments username
Returns Nothing. MMDB.showColdFusionAdmin()Availability Dreamweaver MX. Description This function displays the ColdFusion Administrator dialog box. Arguments None. Returns Nothing. The ColdFusion Administrator dialog box appears. MMDB.showConnectionMgrDialog()Availability Dreamweaver UltraDev 1. Description This function displays the Connection Manager dialog box. Arguments None. Returns Nothing. The Connection Manager dialog box appears. MMDB.showOdbcDialog()Availability Dreamweaver UltraDev 4 (Windows only). Description This function displays the System ODBC Administration dialog box or the ODBC Data Source Administrator dialog box. Arguments None. Returns Nothing. The System ODBC Administration dialog box or the ODBC Data Source Administrator dialog box appears. MMDB.showRdsUserDialog()Availability Dreamweaver UltraDev 4. Description This function displays the RDS user name and password dialog box. Arguments username, password
Returns An object that contains the new values in the username and password properties. If either property is not defined, it indicates that the user cancelled the dialog box. MMDB.showRestrictDialog()Availability Dreamweaver UltraDev 4. Description This function displays the Restrict dialog box. Arguments catalog, schema
Returns An object that contains the new values in the catalog and schema properties. If either property is not defined, it indicates that the user cancelled the dialog box. MMDB.testConnection()Availability Dreamweaver UltraDev 4. Description This function tests connection settings. It displays a modal dialog box that describes the results. Arguments serverPropertiesArray This function expects a single argument, an array object that contains values from the following list, which are appropriate for the current server model. For properties that do not apply to the connection being tested, set them to empty ("").
Returns A Boolean value: true if the connection test is successful; false otherwise. |
< Day Day Up > |