Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #15877

Handling ODBC Connection Errors

From Gene Wirchenko <genew@ocis.net>
Newsgroups comp.lang.javascript
Subject Handling ODBC Connection Errors
Date 2012-09-12 14:03 -0700
Organization A noiseless patient Spider
Message-ID <87t1585mmsdg8bqdd8vblsch7esmc36iu2@4ax.com> (permalink)

Show all headers | View raw


Dear JavaScripters:

     Well, I am connecting to SQL Server.  Now, I am trying to handle
the errors that can happen.

     Please note that this is checkout work for what will eventually
be server-side code.  The argument that one should not use direct
access to the DBMS in browser code does not apply here.

     If I do not use try-catch and there is an error in my connection,
my program abends with an error.  Naturally, I want to trap any such
error.  I can do that, but I do not get much information.  Catching to
e gets me an e.name of "Error" and an e.message such as:
          [Microsoft][ODBC SQL Server Driver][SQL Server]Error
converting data type varchar to date.
or (note the variable text):
          [Microsoft][ODBC SQL Server Driver][SQL Server]Procedure or
function 'GetPriRow' expects parameter '@theKey', which was not
supplied.

     This is not too terribly usable.  Is there a way to get the
information broken down?  Even just an error number distinguishing the
error messages would be nice.

     Note that the various errors are not the point; being able to
identify so as to possibly handle each error is.

Sincerely,

Gene Wirchenko

Back to comp.lang.javascript | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Handling ODBC Connection Errors Gene Wirchenko <genew@ocis.net> - 2012-09-12 14:03 -0700
  Re: Handling ODBC Connection Errors Gene Wirchenko <genew@ocis.net> - 2012-09-12 19:33 -0700
    Re: Handling ODBC Connection Errors David Mark <dmark.cinsoft@gmail.com> - 2012-09-18 23:19 -0700
      Re: Handling ODBC Connection Errors David Mark <dmark.cinsoft@gmail.com> - 2012-09-18 23:26 -0700
  Re: Handling ODBC Connection Errors "J.R." <groups_jr-1@yahoo.com.br> - 2012-09-27 22:51 -0300
    Re: Handling ODBC Connection Errors Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-09-28 10:41 +0200
      Re: Handling ODBC Connection Errors "J.R." <groups_jr-1@yahoo.com.br> - 2012-09-28 15:29 -0700

csiph-web