home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-18 | 1.3 KB | 45 lines |
- /*
- * @(#DefaultConnectFailedListener.java
- *
- * Copyright (c) 1997 Symantec Corporation. All Rights Reserved.
- *
- */
-
- package symantec.itools.db.beans.jdbc;
-
- import java.util.*;
- import java.sql.*;
- import symantec.itools.db.awt.*;
-
- public class DefaultConnectFailedListener implements ConnectFailedListener
- {
- ConnectFailedDialog m_Dialog = null;
- JdbcConnection m_Connection = null;
-
- public DefaultConnectFailedListener() {}
-
- public void connectFailed(ConnectFailedEvent event) throws Exception
- {
- if (event.getType() != ConnectFailedEvent.GENERALERROR) {
- System.out.println(event.getReason());
- return;
- }
-
- if (m_Dialog == null) {
- m_Dialog = new ConnectFailedDialog();
- }
-
- m_Connection = (JdbcConnection)event.getSource();
- m_Dialog.setURL(m_Connection.getURL());
- m_Dialog.setReason(event.getReason());
-
- m_Dialog.show();
-
- if (m_Dialog.getShouldRetry()) {
- JdbcConnection connection = (JdbcConnection)event.getSource();
- connection.setUserName(m_Dialog.getUserName());
- connection.setPassword(m_Dialog.getPassword());
- connection.connect();
- }
- }
- }