database.majorErrorMessage()

NES2+Syntax

							database.majorErrorMessage()

Description

The majorErrorMessage() method of the database object contains the ODBC or database string error message that is returned if an error occurs.

Example

Listing 8.46 shows how you would create a connection and test for a successful connection. If the test fails, the majorErrorMessage() is used when writing the error to the page.

Listing 8.46 Using majorErrorMessage() to Retrieve a Database Connection Error
 <SERVER> // Open a connection var myConn = database.connect("ORACLE", "mySID", "myApp", "appsPWD", "myTNS"); if (myConn.connected()) { // You are connected, so perform any tasks here }else{ // There was an error connecting to the database write('Error ('+myConn.majorErrorCode()+'): ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.