Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #15881
| From | Gene Wirchenko <genew@ocis.net> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Handling ODBC Connection Errors |
| Date | 2012-09-12 19:33 -0700 |
| Organization | A noiseless patient Spider |
| Message-ID | <70h258trauptcfp6vm5jp5i96h6tonm5pv@4ax.com> (permalink) |
| References | <87t1585mmsdg8bqdd8vblsch7esmc36iu2@4ax.com> |
On Wed, 12 Sep 2012 14:03:26 -0700, Gene Wirchenko <genew@ocis.net>
wrote:
>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.
OK, I did find that .number can be used. (I so dislike
inaccurate documentation/writeups.)
What I also found is that the error numbers do not appear to be
the same as those that I see for the same error in SSMS or any
reasonable transformation. For example, a failed data conversion
(string to date) is 0x80040E14 with ODBC and 343 (0x157) with SSMS. I
have been unable to find anything relating the two. If you know,
please give me the URL.
Sincerely,
Gene Wirchenko
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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