Using Java's Statement executeQuery method for getting SQL select results
Questions tagged [executequery]
133 questions
0
votes
1 answer
compare two objects from same domain createCriteria Grails
Hi I have the following HQL query which I am running using executeQuery():
def q = Domain.executeQuery("Select d0 from Domain d0 where d0.id = (select min(d1.id) from Domain d1 where d1.code = d0.code and d1.service = d0.service and d1.site =…

Ameya
- 549
- 1
- 10
- 19
0
votes
2 answers
How can I print the entire database
I have a table called ClientsTable and a database called myDb .
How can I print with System.out.prinln() the entire database ? I just want to select all the rows and present all the fields to the screen .
Thanks
EDIT: what should I put instead of…

Jack cole
- 447
- 2
- 8
- 24
0
votes
3 answers
execute SQL statement using executeQuery in servlet
I have servlet -
@WebServlet("/servlet123")
public class servlet123 extends HttpServlet {
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
…

URL87
- 10,667
- 35
- 107
- 174
-1
votes
2 answers
my query is fast in SSMS but goes over 1 hour in my app
I have an issue with a slow query in my app, but it is so fast in SSMS . After I saw some answer, I noticed that the execution plan seems to be different.
I noticed that when I use SSMS something is called [Parallelism (Repartition Streams)] is used…

Muhannad
- 467
- 4
- 28
-1
votes
1 answer
How long process executeQuery() method?
I have new simple SELECT query in Oracle.
If i run on SQL tool it takes 1~3 second.
But on java jdbc using executeQuery() method, it takes 30~40 second
Why its takes so long? what I consider to solve this problem?
please help for newbie
i just…

kiton lee
- 9
- 1
-1
votes
2 answers
JDBC incorrect syntax at or near "." executeQuery
This is of course parts of a larger code. It will compile with no problem, but when I call this method I get the error
"syntax error near or at "."" at the position of stmt.executeQuery(SQL).
I would really appreciate the help!
private void…

gheithen
- 11
- 4
-1
votes
1 answer
Statement.executeQuery taking same amount of time for every SQL query
I'm trying to compare the performance of 2 queries by getting a connection, prepare the statement and execute query.
Capturing the time taken using System.currentTimeMillis() before and after executeQuery().
Ironically whatever may be the query,…

user2697360
- 1
- 3
-1
votes
1 answer
Resultset does not return any result from SQL Server 2012 View or Table
Previously, I connected to SQL Server 2012 Views and Tables properly, but few days ago, I tried to select from a Stored Procedure, with the help of my good friends here, but no chance.
So i forgot about Stored Procedure and tried a View.
I want to…

Alireza
- 89
- 2
- 15
-1
votes
2 answers
Save result of ExecuteCommand in a string
I want to execute a SQL command from c#
I have:
ccDc = getDataContext();
int MD5 = ccDc.ExecuteCommand("SELECT HASHBYTES('MD5', ChunkData) FROM dbo.x where id={0}", Id);
When I run this
SELECT HASHBYTES('MD5', ChunkData) FROM dbo.x where Id =…

laila
- 15
- 1
- 2
- 7
-1
votes
2 answers
JavaScript function that waits until executeQueryAsync is ready?
Is there a possibility to make some delay? I call a function in a while loop. This function calls executeQueryAsync which has to finish before the loop continues. When I use an alert my code works but without it doesn't.
while…

pyTh0n-M4nning
- 77
- 1
- 9
-1
votes
1 answer
executeQuery not returning result for Hive
I am trying to export data from Hive to Teradata. Below is the code I have for the same:
/* Code Start */
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import…

Chirag Bansal
- 11
- 5
-1
votes
1 answer
pdo query not executing when passing a variable as the query
I have a pdo command like this $sql = $pdoObj->execute($query) but it does not work, 0 result returning. I echo'ed out the $query variable just before calling execute() and then pasted it inside the execute() and the code ran successfully. I can't…

user2513485
- 25
- 1
- 4
-2
votes
1 answer
executeQuery NullPointerException Error
I'm begginer at this that's probably why I'm having this error while I'm trying to do something very simple.
I just want to get the current user ID and use it in other classes. But I'm getting NullPointerException Error for the ExecuteQuery()…

Lito
- 17
- 2