execute « SQL « Java Database Q&A

1. view SQL executed by Jasper report    stackoverflow.com

When running a Jasper report in which the SQL is embedded in the report file (.jrxml), is it possible to see the SQL that is executed? Ideally, I'd also like to ...

2. Execute SQL on CSV files via JDBC    stackoverflow.com

I need to apply an SQL query to CSV files (comma-separated text files). My SQL is predefined from another tool, and is not eligible to change. It may contain embedded selects ...

3. iBatis get executed sql    stackoverflow.com

Is there any way where I can get the executed query of iBatis? I want to reuse the query for an UNION query. For example:

<sqlMap namespace="userSQLMap">
   <select id="getUser" resultClass="UserPackage.User">

4. execute sql which is placed in an xml file using Java code    stackoverflow.com

how to execute sql which is placed in an xml file using Java code?

5. Executing a .sql file through Java    stackoverflow.com

I have a sql script file, i need to execute commands present in that through java. I searched in internet regarding the same, i got some code defining parsers to split ...

6. How to execute a set of related SQL instructions with JDBC?    stackoverflow.com

I'm trying to execute this script through JDBC (it's SQL Server):

SET @var = "test"
INSERT INTO foo (name) VALUES (@var)
It's just an example, in my business case I have a ...

7. Executing SQL in a Gradle task?    stackoverflow.com

How can I execute SQL in a Gradle task?

configurations {
repositories {
dependencies {
    compile 'postgresql:postgresql:9.0-801.jdbc4'
task sql << {

8. Is it possible to view the SQL that got executed?    coderanch.com

Originally posted by Robert Brunner: Actually, there is a tool called a JDBC spy driver, which actually shows the SQL that is being used by the database (which may be different than what is in your java code. Merant provides a version (not sure who actually wrote it). Basically, the spy driver does the normal stuff, but also logs what it ...

9. how to execute .sql file using java    coderanch.com

Originally posted by Lasse Koskela: I see two ways of doing this. 1) Execute the .sql file using Oracle's command line client (if there is one, that is) and the Runtime.exec() method. 2) Execute the individual statements within the .sql file by reading the .sql file and executing the pieces of SQL using java.sql.Statement. You'll have to do a bit parsing ...

10. Load and execute SQL from multiple line file?    coderanch.com

Kindly I would like to ask what is the preferred way of loading a file containing multiple sql-statements (CREATEs and INSERTs) into a (MySQL) database? In the setUp()-method of a JUnit-test, I would like to freshen up the test-database by dropping all tables and loading a new default state. Since some of the INSERT-statements contain quotes (") or other special characters, ...

11. executing .sql file from java program    coderanch.com

12. how to execute sqlplus and sql commands using java    coderanch.com

Hmm. The SQL is no problem - you just let JDBC pass that to the database and handle the results. The SQLPlus commands however are a different matter. Its SQLPlus, not Oracle that interprets them so you'd have to ape that behaviour in your GUI application. So I'd imagine something like a lot of regular expressions to parse the incoming SQL/SQLPlus ...

13. Execute sql in a loop    coderanch.com

Hi All, We are using Spring frmaework and NamedParameterJdbcDaoSupport for all data access operations. I need to execute a select statement in a loop multiple times supplying it different values each time. I am aware of how to do this with plain jdbc, taken from : http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html PreparedStatement updateSales; String updateString = "update COFFEES " + "set SALES = ? where ...

14. execute method in SQl    coderanch.com

hi all i am trying to create a login form in which i take user name ,email id and password. if the user is registered user the name ,id and password are stored into database in table.So when the user logs in i wanted to check by traversing through the database that the name and password are right so previuosly i ...

15. Execute .sql file using java    coderanch.com

Hello, Thanks for replies. Yes my scripts only includes DML operations like drop the tables and load tables with default tables and check all tables are created properly or not like stuff. No procedure or functions. My .sql scripts do kind of security check for database before deploying my actual application. Many thanks, Sirish

16. Execute SQL Scripts with Java    coderanch.com

I have previously posted this topic in the JDBC section, but not sure whether it's appropriate, so think i might as well post it here, hopefuly can get more comments. As part of eliminating the need to run the sql scripts manually in order to update existing database, im going to develop a functionality which can take the scripts from certain ...

17. could not execute sql command    coderanch.com

We are using JDK 1.3 and DB2 8.1. During the INSERT / UPDATE we are getting the following exception. It is ver inconsistent. During the execution i am getting the following SQL error. This is URGENT. What could be the reason. Is it driver problem? Refer below Error: [2/25/09 18:48:26:982 IST] 7c72e426 SystemOut O -- PrzJdbcRetrieveData -- in update with 4 ...

18. executing an sql through java    coderanch.com

Hi All, I also wanted to execute an sql script through java but had one more requirement. I wanted to ensure that the password that i am using to connect to the database as well as the arguments to the script are not visible through ps commands. Can you suggest me a way in which i can redirect the password as ...

19. how to execute multiple sql commands on a database simultaneously...?    coderanch.com

Hi all, I want to execute multiple sql commands in a single program. But one command is a "select" and another is a "insert". Next thing is that both commands uses different tables of same database. How can I do this task.... I tried it using batch but is not working. Below is my trial code.. <% try { Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection ...

20. How can i continue executing other SQL Statments , even if one of them fails    coderanch.com

I am executing , some sql statements , now the requirement is such that , even if a single statement execution fails ,i want to continue executng the others . But right now the condition is such that , even if a single SQL Statement fails the execution is currently stopped at that Line . Please let me know how can ...

21. Executing and waiting for Sql job to finish.    coderanch.com

Hi, I am trying to execute an SQL job using PreparedStatement which went sucessful. The problem is, I want my program to wait untill my SQL job finishes. I am able to achieve this using try/catch and recursion.But i am not satisfied with it. The logic goes like this 1. Call the job and wait for few seconds. 2. Using recursion ...

22. Executing a batch of SQL commands    coderanch.com

Hi, In my application,I'm actually need to collect a list of SQL commands(Normal update,delete as well as Calls to Stored Procedure) together by then execute the selected ones from the list and execute them to the Database and commit. I collect these statements after I execute each of them,see their effect and rollback immediately.Then the user can look at the commands ...

23. Execute .sql file using JDBC    forums.oracle.com

25. Not doing anything? (SQL executing)    forums.oracle.com

You're finding out that ResultSets do not override toString(). This means that you'll have to extract the pertinent data from the ResultSet object and then display it as you see fit. You may need to use a loop and iterate through the rows of the ResultSet as well: [Retrieving Values from Result Sets|http://java.sun.com/docs/books/tutorial/jdbc/basics/retrieving.html] Edited by: Encephalopathic on Jun 24, 2010 7:08 ...

26. How to execute .sql file in java    forums.oracle.com

Hi. The reason for generating an sql file is My boss gave me an Peoplesoft trace file which consists of lots of sql statements bind variables and lot more other variables..He asked me to filter all those sql statements...and execute them to get execution time for the sql statement. For this i am keeping all the sql statements in .sql file ...

27. Problem in executing SQL at runtime.    forums.oracle.com

28. SQL error in Java in executing Stored Proc    forums.oracle.com

29. Executing SQL command in Java on Linux OS    forums.oracle.com