Sqlite connection in android via servlet

I am trying to connect to a database in my Android emulator, the problem is that I am making a servlet program that includes an SQL connection in it, but when I load the war file and run it from the berth server, I get the following error: " org.sqlite.jdbc java.lang.classnotfound exeption "

I have been trying for several days, but I can’t get this database connection from my Android emulator, can someone please help me, Here is my code,

Class.forName("org.sqlite.JDBC"); Connection conn=DriverManager.getConnection("jdbc:sqlite:webapps/DbTes/TestData.db"); Statement stat=conn.createStatement(); stat.executeUpdate("drop table if exists tbl_countries;"); stat.executeUpdate("create table tbl_countries (id INTEGER PRIMARY KEY AUTOINCREMENT, country_name TEXT);"); PreparedStatement prep = conn.prepareStatement("insert into tbl_countries(country_name) values (?);"); prep.setString(1, "a"); prep.addBatch(); prep.setString(1, "b"); prep.addBatch(); prep.setString(1, "c"); prep.addBatch(); conn.setAutoCommit(false); prep.executeBatch(); conn.setAutoCommit(true);" 

Thanks...

+6
source share
1 answer

Using the jetty, send the information to your mobile in any format, such as JSON or XML. Sort data at the end of the mobile application. Create a database and save it using SQLITE.

+1
source

Source: https://habr.com/ru/post/910779/


All Articles