Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

[Microsoft][ODBC Driver Manager] Data source name too long

843859Jan 5 2006 — edited Jan 6 2006
I'm connecting to a remote MySQL database using this code
        Connection con = null;
        try {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
            con = DriverManager.getConnection("jdbc:odbc://kylsoft.thhahost.info/kylsoft_mushnews", "user", "pass");
            if (!con.isClosed())
                status.setText("Successfully connected to MySQL server");
        } catch(Exception e) {
            status.setText("Exception: " + e.getMessage());
        } finally {
            try {
                if(con != null)
                    con.close();
            } catch(SQLException e) {
                status.setText("SQLException: " + e.getMessage());
            }
        }
I got the "[Microsoft][ODBC Driver Manager] Data source name too long" exception... I did some "research" and apparently... my URL is wrong...

Can sb tell me the right URL syntax?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 3 2006
Added on Jan 5 2006
3 comments
520 views