• Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting Problem In updating or deleting data in MS Access Database  RSS feed

Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
import java.sql.Connection;
import java.util.Date;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Time;
import java.util.Calendar;

public class JdbcConnection {

public static final String INSERT_QUERY =
"insert into USER_SUMMARY(user_id,login_time,login_date,LOGIN_STATUS) values(?,?,?,?)";
public static final String SELECT_QUERY =
"select * from user_summary";

public static final String FIND_USER=
"select user_id from user_summary where login_status = 'Y'";

public static final String DELETE_USER_STATUS =
"DELETE user_summary.* FROM user_summary where user_id=?";

public static void main(String[] args) {

try {
Driver d = (Driver)Class.forName
Connection conn = DriverManager.getConnection(
"jdbcdbcriver={Microsoft Access Driver (*.mdb)};DBQ=E:/DATABASE/Database3.mdb"
/*System.out.println("Begining conn");
String filename = "E:/DATABASE/Database1.mdb";
String database = "jdbcdbcriver={Microsoft Access Driver (*.mdb)};DBQ=";
database+= filename.trim() + ";PWD=test}";
Connection conn = DriverManager.getConnection( database ,"Preetish_Madalia","preetish"); */

System.out.println("Connection Obtained : " + conn );

PreparedStatement ps3 = conn.prepareStatement(DELETE_USER_STATUS);
int result2 = ps3.executeUpdate();

} catch (ClassNotFoundException e) {
} catch(SQLException sqe){
} catch(Exception e){



The above code runs fine. But, the problem is that the data in the table is not getting deleted.
Are there settings we need to make in order to delete/update data in tables.
Pls. look at my problem.
Thanks in advance.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!