Using Java's Statement executeQuery method for getting SQL select results
Questions tagged [executequery]
133 questions
0
votes
2 answers
Getting TDS driver - java.lang.NullPointerException. this exception is not consistent
I am getting exception when a method is called from 3 or 4 threads. This method get a DataBase connection inside method and populate some values from DB and then connection (connection, resultset and prepareStatement) getting closed properly inside…

Santosh
- 782
- 4
- 15
- 38
0
votes
4 answers
Preventing SQL Injections on INSERT-only queries. Is it a big deal?
This is my first time creating a PHP form that will run a MySQL query using INSERT INTO to store data in a production DB. Will this pass for "secure" or is it over-kill?
$orderText =…

nipponese
- 2,813
- 6
- 35
- 51
0
votes
3 answers
Return a sql value indicating whether a file exists, using c# and ExecuteCommand
Apologies if the question has already been answered elsewhere but I look around already with no luck. I am trying to establish whether or not a database table already exists using mvc3 and c#.
And I am putting the following sql into a resx file to…

DevDave
- 6,700
- 12
- 65
- 99
0
votes
1 answer
Oracle 19c upgrade: JDBC error java.sql.SQLRecoverableException: Closed Connection
We have recently upgraded Oracle database from 11g release2 to 19c.
Now we have Oracle 19c database server, JDK 1.8 and ojdbc6.jar combination.
We have some java code to create JDBC Statement object with scrollable and concurrent read only ResultSet…

Kousik Mandal
- 686
- 1
- 6
- 15
0
votes
1 answer
PostgreSQL EXECUTE command success but no change in table
I have the following PostgreSQL script:
CREATE OR REPLACE FUNCTION merge_fields() RETURNS VOID AS $$
DECLARE
current_record airport%ROWTYPE;
new_record airport%ROWTYPE;
column_def RECORD;
old_value TEXT;
…

Klaus Nji
- 18,107
- 29
- 105
- 185
0
votes
1 answer
java.sql.SQLException:ORA -01000:maximum open cursors exceeded in JAVA
I am getting this error when I run my code
Below is the code I have used:
String sql="SELECT * FROM PERSONS WHERE PERSONJOB='ADMIN'";
Statement stmt=null;
ResultSet rs=null;
try
{
stmt=conn.createStatement();
rs=stmt.executeQuery(sql);
…

Paakiya
- 1
- 1
0
votes
1 answer
SQL statement in Java DAO method is not checking if user exists properly
I have DAO method in Java which looks like this:
private boolean validateUser(String email, String username) throws SQLException {
return stmt.execute(
"SELECT NOT EXISTS" +
"(SELECT id from Math_Hub.Users_Information " +
…

K0NST-hacker
- 1
- 1
0
votes
1 answer
How can create a table while Execute dynamic @Query
I have a dynamic query in my sp which has different columns related to the inputs that user will enter. After that, In sp I want to join the result of it to the remaining part of sp. So I should have the table for join and as I mentioned I can not…

fahime abouhamze
- 328
- 3
- 16
0
votes
1 answer
How to correctly execute a query that contains a procedure and has no return in Objectscript/Intersystems IRIS
I am trying to execute a stored procedure from my Operation, the way I have the most satisfatory result was by the following call:
Set tResult = ##Class(EnsLib.SQL.GatewayResultSet).%New()
Set tQuery = "EXEC MY_PROC @name = 'Jhon', @profession =…
0
votes
1 answer
Pass Nullable values using Preparement state
I have this query, and I would like to pass the null value. How to do this using Preparement state
The column that must be null is E.RTCA_CD_QMNUM IN (:1)
String sqlSigiop = "SELECT E.RTCA_CD_QMNUM"
+ ", E.RTIT_NR_ITEM"
…

AllPower
- 175
- 1
- 4
- 16
0
votes
0 answers
PHP Mongodb query variable it doesn't go inside foreach
The $rows variable contains the data I want, but it does not enter the foreach loop. I checked the $rows variable using var_dump() and it contains data. There is no error/warning log either.
…

Hami Kaya
- 1
- 1
0
votes
2 answers
DBCC CHECKDB did not return a result set in Java ( MS SQL )
Here is my Function:
private static void checkDatabase(String dbName, String password) {
try{
Connection con=DriverManager.getConnection(
"jdbc:sqlserver://localhost;database="+dbName+ ";user=SA;password=" +password);
…
0
votes
1 answer
executeQuery taking six times as long to run as opposed to when query is run in TOAD
I inherited a...well, I guess I can call it a piece-of-#### Struts application, and am tasked with optimizing a Levey-Jennings process that checks if our quality control standards are up to snuff.
The process itself runs fine, but there has always…

ryebr3ad
- 1,228
- 3
- 12
- 20
0
votes
0 answers
powershell execute oracle query and export csv
I am new to powershell. I have to execute a query in Oracle database and export the result to CSV and then put that in an FTP location. I've tried various options and its not working.
Please let me know how to export the result to CSV.

Joanna
- 1
- 1
0
votes
1 answer
Is there any option to terminate the execution of query after 15 seconds?
rs = pstmt.executeQuery();
I want to set timer exactly before the execute query for 15 seconds for that it should be terminated.

Sai Kumar Adulla
- 9
- 1