for a jdbc program, im required to make a connection an excel database. the connection is successfully made but wen entering values into it, its giving an "Operation must use an updateable query" exception.
here s the code:
String url="jdbc:odbc:Sample"; //CHANGE THE DATABASE NAME
Connection conn= DriverManager.getConnection(url,"","");
PreparedStatement prepstat = null;
String insert="INSERT INTO [Sheet1$] ([AccountID], [ProjectID], [PositionID]) VALUES (?,?,?)";
prepstat= conn.prepareStatement(insert);
prepstat.setString(1, accountID);
prepstat.setString(2, projectID);
prepstat.setString(3, positionID);
prepstat.executeUpdate(); // this is where the exception occurs
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…