I think the problem is that you're using jdbc to odbc bridge and the connection has no idea if it actually connected or not probably because ODBC was once connected and cached the connection, and you turned off the DB and the ODBC driver still thinks it has a connection, and since all you're doing is connecting to the ODBC driver, and the driver thinks it's still connected, it doesn't check and tell the JDBC driver to go away... Just a guess there...
but why are you using jdbc to odbc with Sybase??? Why not get a type 4 JDBC driver and connect to it the RIGHT way. anyway if you HAVE to do this, I would include a simple select in the makeOdbcConn which will cause the query to fail and cause an exception, if the query doesn't fail then everything is OK. you can also try the usual if(conn == null) throw new SQLException("Hey the connection didn't happen, the ODBC driver is lying to you!"); On Friday, November 22, 2002, at 05:47 PM, Susan wrote:
We are connecting to database in standard fashion, using either JDBC driver, or JDBC:ODBC bridge. Here is the problem: if we try to connect to a running database but cannot connect(e.g. due to incorrect password), exception is thrown and we trap the error. This is good. However, if the database is stopped and we attempt connection, the connection is not made ('natch), but it does not throw any type of exception. The code in the calling servlet continues to merrily execute as if nothing is amiss. Is this normal? I am using code found in various books for my connection operation. Example of one of our methods for connecting: public void makeOdbcConn() throws ClassNotFoundException, SQLException { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance(); conn = DriverManager.getConnection("jdbc:odbc:" + dsn, name, passwd); } this method would then be called inside a try block, with catch(Exception e). It does not go into the catch when database is not running. Does anyone else have this problem, or thoughts on this? We are using Sybase database, and JRun 3.1 for servlet container from which we make these database calls. Thanks in advance for advice. _______________________________________________________________________ ____ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html