java - HSQLDB INSERT Value in a Database -
Hi I have problems while inserting data into my database ...
string queries = "Include in Gothian (Code, Vert) values (" + code + "," + + + + ")"; SQLConnection sql = new SQLConnection ("Gutscheine.db"); PAS prepared place; Try {ps = sql.con.prepareStatement (query); Int i = ps.executeUpdate (); If (i == -1) {System.out.println ("db error:" + query); }} Hold (SQLException e) {e.printStackTrace (); } Sql.CloseConnection (); // My own Funktion
My error:
java.sql.SQLSyntaxErrorException: lack of user privilege or object found: org.hsqldb.jdbc On GUTSCHEINE .JDBCUtil.sqlException org.hsqldb.jdbc.JDBCUtil.sqlException (unknown source) org.hsqldb.jdbc.JDBCPreparedStatement is at & lt (unknown source);. Init & gt; (Unknown source) at org.hsqldb.jdbc.JDBCConnection.prepareStatement (org.hsqldb.HsqlException: due to user com.daniel.guthaben.Main.main (Main.java:7) (Gutschein.java33); Unknown source) at com.daniel.guthaben.Gutschein & lt; Init & gt; Lack of privilege or objection found: org.hsqldb.SchemaManager.getTable on org.hsqldb.error.Error.error (unknown source) on org.hsqldb.error.Error.error (unknown source) on GUTSCHEINE Org on org.hsqldb.ParserDQL.readRangeVariableForDataChange (unknown source) (unknown source) at qldb.ParserCommand.compilePart org.hsqldb at org.hsqldb.ParserDQL.readTableName (unknown source) org.hs at org.hsqldb.ParserDML.compileInsertStatement At org.hsqldb.Session.compileStatement at .hsqldb.StatementManager.compile org.hsqldb.ParserCommand.compileStatement (unknown source) (unknown source) (unknown source). Session Exotic (unknown source) ... 4 more
Here I am trying to add context to root user ... (You can see the table at left)
Sorry, I was using a different database ...:
Generally It is not advised to use string building for your query string query = "Gucci (code, Wert) values (" ,,?) "INSERT (?,?)";
and then it would be better to run it by preparing a secure query.
That said, the error sounds very clear? User's privilege or object was not found: GUTSCHEINE
. It does not seem that you are connecting with your code as a special user, so I suspect that when you set up a database connection, forgot to pass your username and password if that part was right, Gutscheine.db If present, then verify.
Comments
Post a Comment