We are doing a android mobile application that will recognize the car plate numb
ID: 3799287 • Letter: W
Question
We are doing a android mobile application that will recognize the car plate number from the image capture to text(a code to extract and recognize the numbers to text view field).These information will be collected in a data base as records in tabels ,We want to create a data base with the tabels:tabel1 (member id-member name-member type-car plate number)tabel2(car plate number-car model-car color),We want to ask how to link the recognized plate number from the text view field to enter it in the data base as a record(the record will add automatically the extracted plate number for the user using the mobile application and let him in the same time add related fields in an interface (member name-member type-car model-car color)and each will be added automatically to the same fields in the data base.
We figured out how to recognize the number and add it to text view but we need help in the second part how to link to a database and add related information as a record in the tabels.
We are doing a android mobile application that will recognize the car plate number from the image capture to text(a code to extract and recognize the numbers to text view field).These information will be collected in a data base as records in tabels ,We want to create a data base with the tabels:tabel1 (member id-member name-member type-car plate number)tabel2(car plate number-car model-car color),We want to ask how to link the recognized plate number from the text view field to enter it in the data base as a record(the record will add automatically the extracted plate number for the user using the mobile application and let him in the same time add related fields in an interface (member name-member type-car model-car color)and each will be added automatically to the same fields in the data base.
We figured out how to recognize the number and add it to text view but we need help in the second part how to link to a database and add related information as a record in the tabels.
We are doing a android mobile application that will recognize the car plate number from the image capture to text(a code to extract and recognize the numbers to text view field).These information will be collected in a data base as records in tabels ,We want to create a data base with the tabels:tabel1 (member id-member name-member type-car plate number)tabel2(car plate number-car model-car color),We want to ask how to link the recognized plate number from the text view field to enter it in the data base as a record(the record will add automatically the extracted plate number for the user using the mobile application and let him in the same time add related fields in an interface (member name-member type-car model-car color)and each will be added automatically to the same fields in the data base.
We figured out how to recognize the number and add it to text view but we need help in the second part how to link to a database and add related information as a record in the tabels.
Explanation / Answer
you are developing an android applcation that is front end, in backend if you are using java the following code will help you how to connect database.
you didn't specify the database i assumed it mysql database. connection statement will vary according to database
//STEP 1. Import required packages
import java.sql.*;
public class MySQLJDBCConnection {
// JDBC driver name and database URL
static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
static final String DB_URL = "jdbc:mysql://localhost:3306/Car_DB"; //here Car_DB is database
// Database credentials
static final String USER = "username";
static final String PASS = "password";
public static void main(String[] args) {
Connection conn = null;
Statement stmt = null;
try{
//STEP 2: Register JDBC driver
Class.forName("com.mysql.jdbc.Driver");
//STEP 3: Open a connection
System.out.println("Connecting to a selected database...");
conn = DriverManager.getConnection(DB_URL, USER, PASS);
System.out.println("Connected database successfully...");
//STEP 4: Execute a query
System.out.println("Inserting records into the table1...");
stmt = conn.createStatement();
//Make sure table is created before nserting in selected database
String sql = "INSERT INTO table1 " +
"VALUES (member_id, 'member_name', 'member_type', car_plate_number)";
stmt.executeUpdate(sql);
System.out.println("Inserted records into the table...");
}catch(SQLException se){
//Handle errors for JDBC
se.printStackTrace();
}catch(Exception e){
//Handle errors for Class.forName
e.printStackTrace();
}finally{
//finally block used to close resources
try{
if(stmt!=null)
conn.close();
}catch(SQLException se){
}// do nothing
try{
if(conn!=null)
conn.close();
}catch(SQLException se){
se.printStackTrace();
}//end finally try
}//end try
System.out.println("Goodbye!");
}//end main
}//end JDBCExample
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.