prepared-statement

ORA-00604: error occurred at recursive SQL level 1

最后都变了- 提交于 2019-12-22 00:34:25
问题 I started getting the below SQL exception and I don't know what's the root cause for this exception? I am also closing dbconnection and prepared statement too. Then what's the problem? java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1 ORA-01000: maximum open cursors exceeded ORA-00604: error occurred at recursive SQL level 1 ORA-01000: maximum open cursors exceeded ORA-01000: maximum open cursors exceeded Below is my code which I am using. Anything wrong in my code?

Execute two different queries in one transaction

落爺英雄遲暮 提交于 2019-12-21 09:19:27
问题 I am trying to execute two insert queries in one Statement , putting them together in one transaction. I was looking at the addBatch method, but if I understand correctly it can be used with a single PreparedStatement to execute the same insert multiple times with different parameters, or be used on a Statement object to add more queries to the batch, but without the ability to add parameters (so I might be able to add the values in the sql string. SQL injection style). I also tried a naive

MySQLi prepared statement with dynamic update query

我是研究僧i 提交于 2019-12-21 06:27:05
问题 I'm busy changing from normal mysql_queries to prepared statements, now I found a function that generated a dynamic query based on how many fields were not empty. I managed to convert it so it runs each field as a separate query, but is there a way to put all these queries into one query without converting to PDO ? public function edit($ticket_id, $department_id = '', $location_id = '', $ticketcat_id = '', $ticketsta_id = '', $ticketmed_id = '', $ticketpri_id = '', $ticket_assigned = '',

do I need a connection.commit() after executeBatch()?

China☆狼群 提交于 2019-12-21 05:08:23
问题 I have to check the code of a fellow coworker and I stumble on this piece of code: private void pdate(JdbcTemplate jdbcTemplate, List<Long> saisineIdsToUpdate,Connection connection) throws SQLException { String sqlUpdate = "UPDATE SAISINES SAI WHERE SAI.IDSAISINE = ?"; //request simplified PreparedStatement psUpdate = connection.prepareStatement(sqlUpdate); for (Long saisineId : saisineIdsToUpdate) { psUpdate.setLong(1, saisineId ); psUpdate.addBatch(); } psUpdate.executeBatch(); psUpdate

Why does this MySQLI prepared statement allow SQL injection?

醉酒当歌 提交于 2019-12-21 05:01:24
问题 As I was teaching students how to prevent SQL injection today, I was mildly embarrassed. In professional projects I've used prepared statements / parameterized queries as one layer of prevention against SQL injection (although I've never used mySQL professionally). In theory, I thought SQL injection was impossible when using a prepared statement. But then this worked... $Search = $_GET['s']; $stmt = $mysqli->prepare("SELECT * FROM products WHERE id = ?"); $stmt->bind_param("i", $Search);

Java JDBC prepared statement maximum parameter markers

空扰寡人 提交于 2019-12-20 11:56:22
问题 Im building a large database call using PreparedStatement that has 2000+ parameter markers. Im getting this error Caused by: java.sql.SQLException: Prepared or callable statement has more than 2000 parameter markers. at net.sourceforge.jtds.jdbc.SQLParser.parse(SQLParser.java:1139) at net.sourceforge.jtds.jdbc.SQLParser.parse(SQLParser.java:156) at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.<init>(JtdsPreparedStatement.java:107) Caused by: java.sql.SQLException: Prepared or callable

Prepared statement expects 0 params with 1 given .., using php manual example

倾然丶 夕夏残阳落幕 提交于 2019-12-20 06:57:53
问题 I took this straight from php manual example -- it was almost identical to what I needed but I am still getting this error. Can someone tell me what I am missing? $stmt = $link->prepare("SELECT obitBody, Photo FROM tnObit WHERE obitID = ?"); if ($stmt->execute(array($_POST['obitID']))) { while ($row = $stmt->fetch()) { print_r($row); } } mysqli_stmt::execute() expects exactly 0 parameters, 1 given in 回答1: execute (the object-based one, as opposed to the older less-favored variant) doesn't

Prepared statement expects 0 params with 1 given .., using php manual example

感情迁移 提交于 2019-12-20 06:56:53
问题 I took this straight from php manual example -- it was almost identical to what I needed but I am still getting this error. Can someone tell me what I am missing? $stmt = $link->prepare("SELECT obitBody, Photo FROM tnObit WHERE obitID = ?"); if ($stmt->execute(array($_POST['obitID']))) { while ($row = $stmt->fetch()) { print_r($row); } } mysqli_stmt::execute() expects exactly 0 parameters, 1 given in 回答1: execute (the object-based one, as opposed to the older less-favored variant) doesn't

Java: creating a date object from a string and inserting into MySQL

本秂侑毒 提交于 2019-12-20 06:27:47
问题 Anytime I have to handle dates/times in java it makes me sad I'm trying to parse a string and turn it into a date object to insert in a preparepared statement. I've been trying to get this working but am having no luck. I also get the helpful error message when I go to compile the class. "Exception in thread "main" java.lang.Error: Unresolved compilation problem: The method setDate(int, Date) in the type PreparedStatement is not applicable for the arguments (int, Date)" Eh WTF? Here is the

MySql Connector prepared statement only transfers 64 bytes

风格不统一 提交于 2019-12-20 05:26:09
问题 I am using the MySql Connector C++ to store a JPEG image from a file into the database. I am using the prepared statement. After execution of the prepared statement, only the first 64 bytes of the file are copied into the database. My research of examples show that no iteration is necessary and the examples assume that the prepared statement loads the entire file. Here is my code: std::string statement_text("INSERT INTO "); statement_text += "picture_image_data"; statement_text += " (";