I have developed a small game in which the text input by the user needs to be posted in a MS Access Database.
It all works fine in NetBeans but whenever I access it from the JAR file (which is ultimately what I need to hand to my client), it does not post anything to the database. In fact it returns the following error:
java.sql.SQLException: No suitable driver found for jdbc:ucanaccess://C:\Users\Paul\Desktop\Spelli\RispostiDB.mdb
This is the relevant code:
public void postAnsDB()
{
String tableName = "Form"+studentGroup +"_"+studentSurname+"_"+studentName+"";
answerModifier();
try{
String strurl="jdbc:ucanaccess://C:\\Users\\Paul\\Desktop\\Spelli\\RispostiDB.mdb";
Connection conn=DriverManager.getConnection(strurl, "", "");
Statement stmt=conn.createStatement();
//Post Student Details to DB
String post = "INSERT INTO "+tableName+"(ID, responses, Correct_Response, Valid_Invalid, Marks) VALUES ('"+ansID+"', '"+answer+"', '"+correct+"', '"+valid+"', '"+marks+"');";
stmt.executeUpdate(post);
}
catch(Exception e)
{
System.out.println("Exception found in postAnsDB: "+e);
}
}