Why I'm getting error "cannot find symbol: createStatement()"? My goal is to create a t1 Tab
object in a TestClass and calls t1.Cr()
with a String
parameter.
I'm not forgetting the import java.sql.*;
public void Cr() throws Exception {
try {
ConexaoPlus con = new ConexaoPlus();
con.conect();
Statement st = con.createStatement();
st.execute("CREATE TABLE " + getName() + "();");
st.execute("DROP TABLE " + getName() + "();");
st.close();
} catch (Exception e) {
e.printStackTrace();
}
}
Thanks in advance!
A cannot find symbol error may occur for many reasons. You can read this post.
From what I see from the code you have provided, your class ConexaoPlus does not contain the method createStatement() or you might have not defined it.
java sql packages will have these methods already defined which you can use. For more help you will need to share the class ConexaoPlus.