Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Jconnector, ODBC connector security

Status
Not open for further replies.

mes123

Programmer
Jul 29, 2005
62
GB
If I have a remotly hosted database and I'm using either the ODBC or JConnectors to access it, how secure are those connections? Can I setup a SSL link? How would I do that?


i'm using:

Code:
public void makeConnection (String url, String userName, String passWord) throws DbException{
        if (url.equalsIgnoreCase("")){
            throw new DbException(4, "DbConnector", "getConnection", "No URL specified. Unable to connect.", null);
        }
        try {
            // Load Sun's jdbc-odbc driver
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
            
        } catch (ClassNotFoundException cnfea){ // driver not found
            DbException my = new DbException(0, "DbConnector", "getConnection",
            "ClassNotFoundException. Cause/message: " +
            cnfea.getCause() + "/" + cnfea.getMessage(), null);
            throw new DbException(1, "DbConnector", "getConnection", "ODBC: Unable to load database driver.", my);
        } catch (InstantiationException ie2){
            DbException my = new DbException(0, "DbConnector", "getConnection",
            "InstantiationException. Cause/message: " +
            ie2.getCause() + "/" + ie2.getMessage(), null);
            throw new DbException(2, "DbConnector", "getConnection", "Instatiation exception on ODBC driver.", my);
        } catch (IllegalAccessException iae2){
            DbException my = new DbException(0, "DbConnector", "getConnection",
            "IllegalAccessException. Cause/message: " +
            iae2.getCause() + "/" + iae2.getMessage(), null);
            throw new DbException(3, "DbConnector", "getConnection", "Failed to load driver.", my);
        }
        // driver has been loaded - attempting to gain connection to DB
        try {
            connector = DriverManager.getConnection("jdbc:odbc:" + url,
            userName, passWord);
        } catch (SQLException sqle){
            DbException my = new DbException(0, "DbConnector", "getConnection",
            "SQLException. State/error/message: " +
            sqle.getSQLState() + "/" + sqle.getErrorCode()+ "/" + sqle.getMessage(), null);
            throw new DbException(4, "DbConnector", "getConnection", "Failed to get connection.", my);
            
        }

        
    }
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top