permaculture playing cards*
The moose likes Websphere and the fly likes WSAD: SQL queries in Data Perspective Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "WSAD: SQL queries in Data Perspective " Watch "WSAD: SQL queries in Data Perspective " New topic
Author

WSAD: SQL queries in Data Perspective

Guy Leeds
Greenhorn

Joined: Nov 06, 2003
Posts: 18
How can I run SQL queries through WSAD 5.0, using my existing Database Connection?
I've tried 'SQL Statement' but this won't let me select my database.
I've tried 'SQL/DDL Script'. This seems to run but I don't see the output.
I'm sure it must be something simple...
[ November 10, 2003: Message edited by: Guy Guy ]
Guy Leeds
Greenhorn

Joined: Nov 06, 2003
Posts: 18
C'mon - can't be that hard! Any answers...?
Mahesh Chalil
Ranch Hand

Joined: Jan 24, 2002
Posts: 147
Yes, it is simple only.
Follow these steps to execute a query:
Select the statement in the Data Definition view. Right-click it and click Execute.
If you are not connected to your database, the Database Connection wizard will open. Fill in the required fields, then click Finish.
If your statement contains any host variables, the Specify variable values dialog will open. Enter the variable values that you wish to use, then click OK.
Results will be displayed in the DB Output view of the Data perspective (It will automatically open if it is not already open.). The DB Output view is divided into two parts. The left-hand part contains the following fields:
Status, which indicates the current state of the statement.
Action - this indicates what kind of action occurred
Object Name, which contains the name of the statement.
The right-hand part contains three pages - Messages, Parameters, and Results. The Results page is selected by default.
The Results page contains any results generated by executing the statement (for example, a table of sales data).
Click the Parameters tab to view any parameters passed to the statement. The name of each parameter and its input value will be listed.
Note: This page will only contain values if host variables are defined for the statement.
Click the Messages tab to view any messages returned by the database while the statement was being executed. If there are errors in your SQL statement, an error message will appear in this page. As well, the source of the statement executed is shown in this view. Note: For DELETE, INSERT, and UPDATE statements, a message is displayed here if the statement execution was successful.
Refer to your database product's SQL documentation to check the validity of the structure of your query. To edit your query, make the changes in the SQL query builder as necessary and re-execute the query.
Note: If you have a connection to a database in WebSphere Studio and that connection is cancelled in some way from outside the workbench (for example, in DB2 using the "force applications all" command), WebSphere Studio cannot detect the fact the connection has been dropped.
Some tasks you perform in WebSphere Studio depend on a live connection to your database existing - any task that requires an active connection to the database (such as executing an SQL statement in the SQL query builder) will not work properly if the connection is dropped.
To work around this problem, you will have to shut down the workbench and restart it to reconnect to the database.
Hope this helps.!
Guy Leeds
Greenhorn

Joined: Nov 06, 2003
Posts: 18
Mahesh,
Thanks for the reply.
My query appears to execute successfully, however, I still can't view the results:
ProductQuery.sql > Run on Database Server.
If I choose 'Prompt prior to commiting changes' within the Run Script Options, a pop-up windo captioned 'Confirm export results' appears telling me the query was successful and prompting for commit/rollback. Selecting either makes the window disappear but nothing shows in the DB Output window, nor do the results appear to be exported anywhere else.
Any further thoughts?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: WSAD: SQL queries in Data Perspective
 
Similar Threads
MS SQL Server and Java...
what's the syntax differnece between hibernate hql and sql?
calling bean in servlet
creating database connection
Trigger runs on some column time reached...