I am developing a J2ME application and have no idea how to connect it with the database. I tried it doing, as given in some books but was unsuccessful. I included the following code in the constructor of MIDLET class String url = "jdbc:odbc:db1"; String userID = "cse1"; String password = "jss"; Statement DataRequest; ResultSet Results; Connection Db; try { Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver"); Db = DriverManager.getConnection(url,userID,password); } catch (ClassNotFoundException error) { System.err.println("Unable to load the JDBC/ODBC bridge." + error); System.exit(1); } catch (SQLException error) { System.err.println("Cannot connect to the database." + error); System.exit(2); } try { String query = "SELECT * FROM login"; DataRequest = Db.createStatement(); Results = DataRequest.executeQuery (query); //Place code here to interact with the ResultSet DataRequest.close(); } catch ( SQLException error ){ Syst...
About Java and it's related concepts..