When an exception is thrown in logcat, the system prompts: The driver connection is successful, and the database connection fails. Couldnotfindclass & #39; javax. naming. StringRefAddr & #39;, referencedfrommethodcom. mysql. jdbc. connectionproperti. Please help me. the error revolves around connecting code & quot; to the database publicstaticConnectiongetCon () {Conn mysqljdbc database android
If an exception is thrown at logcat, the system prompts: The driver connection is successful, and the database connection fails. cocould not find class 'javax. naming. StringRefAddr ', referenced from method com. mysql. jdbc. ConnectionPropertiesImpl $ ConnectionProperty. storeTo. Please help me. the error has been around for a long time.
Connection code
// Connect to the database public static Connection getCon () {Connection conn = null; try {Class. forName ("org. gjt. mm. mysql. driver "); System. out. println ("successful driver connection");} catch (ClassNotFoundException e1) {// TODO Auto-generated catch block System. out. println ("driver connection failed");} String dbUrl = "jdbc: mysql: // localhost: 3306/student"; String username = "root "; string PSWs = "1234"; try {conn = DriverManager. getConnection (dbUrl, username, psw);} catch (SQLException e) {// TODO Auto-generated catch block System. out. println ("database connection failed" + e);} return conn ;}