This is my code. I get the error in the statement as a statement:
Statement st = null; Connection Con = Null; Class.forName ("com.mysql.jdbc.Driver"); Thieves = DriverManager.getConnection ("JDBC: mysql: // local host / mydb", "root", ""); St = (Statement) con.createStatement ();
How to overcome this?
createStatement will return the object item statement class, so you do not need to type casting.
I think the error is st. ("Insert into"); is the line. You must use the execute or executeQuery method of the statement class.
Ex: for st.execute ("your query here");
Comments
Post a Comment