KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > resource > adapter > jdbc > vendor > InformixExceptionSorter


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.resource.adapter.jdbc.vendor;
23
24 import java.io.Serializable JavaDoc;
25 import java.sql.SQLException JavaDoc;
26 import org.jboss.resource.adapter.jdbc.ExceptionSorter;
27
28
29 /**
30  * InformixExceptionSorter.java
31  *
32  * This is a basic exception sorter for the IBM INFORMIX 9.4 RDBMS. All error
33  * codes are taken from the IBM INFORMIX JDBC driver programmer's guide of the
34  * 2.21.JC6 JDBC driver.
35  *
36  * @author <a HREF="mailto:u.schroeter@mobilcom.de">Ulf Schroeter</a>
37  */

38 public class InformixExceptionSorter implements ExceptionSorter, Serializable JavaDoc
39 {
40    static final long serialVersionUID = -7135889081050258852L;
41
42    public boolean isExceptionFatal(SQLException JavaDoc e)
43    {
44       switch (e.getErrorCode())
45       {
46          case -79716: // System or internal error
47
case -79730: // Connection noit established
48
case -79734: // INFORMIXSERVER has to be specified
49
case -79735: // Can't instantiate protocol
50
case -79736: // No connection/statement established yet
51
case -79756: // Invalid connection URL
52
case -79757: // Invalid subprotocol
53
case -79758: // Invalid IP address
54
case -79759: // Invalid port nnumber
55
case -79760: // Invalid database name
56
case -79788: // User name must be specified
57
case -79811: // Connection without user/password not supported
58
case -79812: // User/password does not match with datasource
59
case -79836: // Proxy error: no database connection
60
case -79837: // Proxy error: IO error
61
case -79879: // Unexpected exception
62

63            return true;
64       }
65
66       return false;
67    }
68
69 } // InformixExceptionSorter
70
Popular Tags