Вы находитесь на странице: 1из 2

TIBCO Designer Tutorial - Query Database Table - Xmarter TIBCO Training Center - TIBCO Tutorials - TIBCO Trainer 28/10/10

28/10/10 01:21

TIBCO Designer Tutorial - Query Database Table


This TIBCO tutorial shows you how to use TIBCO Designer to connect to a database and
query a table. The target audience are TIBCO developers or those interested in becoming
one. You will really enjoy how easy this is to do in TIBCO Designer. In TIBCO, the task can
be performed without having to know the correct syntax for connecting to a database and
performing the query. TIBCO Designer only requires that you configure a JDBC Connection
shared resource and a JDBC Query activity.

In this tutorial, we will use an Oracle database and a BOOK table in that database. Here is
the script to create the BOOK table if you would like to follow along:

CREATE TABLE BOOK


(
BOOK_ID NUMBER,
CATEGORY VARCHAR2(50 BYTE),
TITLE VARCHAR2(100 BYTE),
LANG VARCHAR2(50 BYTE),
AUTHOR VARCHAR2(300 BYTE),
YEAR NUMBER,
PRICE NUMBER,
CONSTRAINT BOOK_PK PRIMARY KEY (BOOK_ID) ENABLE
) ;

INSERT INTO BOOK


(BOOK_ID, CATEGORY, TITLE, LANG, AUTHOR, YEAR, PRICE)
VALUES
(1, 'Sales', 'Soft Selling in a Hard World',
'en', 'Jerry Vass', 1998, 11);

INSERT INTO BOOK


(BOOK_ID, CATEGORY, TITLE, LANG, AUTHOR, YEAR, PRICE)
VALUES
(2, 'Self-Development', 'Thinkertoys',
'en', 'Michael Michalko', 2006, 13.57);

INSERT INTO BOOK


(BOOK_ID, CATEGORY, TITLE, LANG, AUTHOR, YEAR, PRICE)
VALUES
(3, 'Persuasion', 'Subliminal Persuasion',
'en', 'Dave Lakhani', 2008, 16.47);

Now open up TIBCO Designer, and follow these steps:

1. Create a new empty project called XmarterTIBCOTutorials.


2. For the sake of good project organization, create the following directory structure on
your project:
Inside the XmarterTIBCOTutorials root folder, create a folder called
QueryDBTable.
Inside the XmarterTIBCOTutorials root folder, create a folder called
SharedResources.
Inside the SharedResources folder, create a folder called Connections.
Inside the SharedResources/Connections folder, create a folder called JDBC.
3. Inside the SharedResources/Connections/JDBC folder, add a JDBC Connection
shared resource. Configure the resource as follows:
Rename the resource to JDBCConnection (no space).
In the JDBC Driver dropdown box, choose
tibcosoftware.jdbc.oracle.OracleDriver.
Enter your Oracle database parameters in the Database URL textbox. For our
case, we have a value of

http://www.xmarter.com/tibco-training-center/tibco-businessworks-devel…/tibco-designer-tutorial-query-database-table-text.jsp?printerfriendly Página 1 de 2
TIBCO Designer Tutorial - Query Database Table - Xmarter TIBCO Training Center - TIBCO Tutorials - TIBCO Trainer 28/10/10 01:21

jdbc:tibcosoftwareinc:oracle://localhost:1521;SID=XE.
Enter your Oracle database username in the User Name textbox.
Enter your Oracle database password in the Password textbox.
Click on the Test Connection button. If you have entered the correct values in
the JDBC Connection shared resource, you should see a message saying
"JDBC connection test successful."
4. Inside the QueryDBTable folder, create a new process definition called GetBooks.
5. In the GetBooks process definition, add a JDBC Query activity. Configure the JDBC
Query activity as follows:
In the Configuration tab of the activity:
Change the Name of the activity from JDBC Query to Get Books.
In the JDBC Connection field, click on the Browse resources button.
On the Select a Resource dialog box that comes up, select the
JDBCConnection shared resource, and click OK.
In the SQL Statement field, enter: SELECT * FROM BOOK
Go to the Output tab of the activity:
You will see a resultSet warning. Click on the Fetch button below.
This will fetch the resultSet structure of the SQL statement. After you
click the button, the warning should be replaced with a resultSet
structure. If not, check to make sure your SQL Statement in the
Configuration tab does not contain a misspelling.
Click on the Apply button on the activity, and then save the project.
6. Create a transition line from the Start activity to the JDBC Query activity and another
from the JDBC Query activity to the End activity.
7. Validate the resource and make sure there are no errors before testing the process.
To do this, deselect all the activities by clicking on a white space inside the
process definition. Then click on the Validate Resource button on the top
section of TIBCO Designer.
8. Go to the Tester tab on the left-hand side of TIBCO Designer. Click on the Start
testing button. In the dialog box that comes up, click on the Load & Start Current
button.
The process should now execute.
9. To check the output, click on the JDBC Query activity, and go to the Output tab. You
should see three book records in that tab.

Now, wasn't that easy? No coding required! Once you are familiar with the use of TIBCO
Designer, this entire task of connecting to a database and querying a table could've been
accomplished in less than five minutes. The beautiful thing is the fact that you did not need
to know any programming language syntax for database operations. All you had to do was
add and configure a JDBC Connection and a JDBC Query activity, and you're done. As I've
said in previous tutorials, this is one of the reasons why I truly enjoy my work as a TIBCO
consultant. TIBCO Software, Inc. deserves great credit for creating a wonderful tool for
application developers.

[Normal Version]

www.xmarter.com
©2010 Xmarter, Inc. All Rights Reserved.

http://www.xmarter.com/tibco-training-center/tibco-businessworks-devel…/tibco-designer-tutorial-query-database-table-text.jsp?printerfriendly Página 2 de 2

Вам также может понравиться