If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > help

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-08-05, 03:47
AnilKale AnilKale is offline
Registered User
 
Join Date: Feb 2005
Posts: 118
help

Hi All !

I am working on trying to analyze the performance of an internet application (using java/sqlj).
I was wondering what would be the best way to start looking at the various sql statements used by the application.
My challenge is that the developers have no concept of what happens behind the scenes. All they know is that after a sql statement is ready (in the java code), you invoke the execute method (code to execute the sql).
Therefore, I need to determine how does java code talk to db2 ? is it dynamic sql or static sql, could be either (depending on some setting) ? which setting would determine if it's a dynamic sql or a static sql ? in case, it's a static application ? how does it create a package ? what is the name of the package ?
Could someone briefly explain to me the steps involved in java working with db2 (using sqlj) ? or point me to a link that has more information on this subject.

thanks

Anil
Reply With Quote
  #2 (permalink)  
Old 11-08-05, 05:22
juliane26 juliane26 is offline
Registered User
 
Join Date: Oct 2005
Posts: 109
it is asked a lot to quickly explain you the methods for java programming against DB2.

Ressources:
Sathyaram posted a lot of useful stuff:
http://www.dbforums.com/t506495.html

check out the development guide in the Information Center:
http://publib.boulder.ibm.com/infoce...d/cjvintro.htm

a programming class probably would be useful too to get all the concepts.

Anyway, if your programmers come in with JDBC, you can assume it is dynamic SQL(Don't expect them to know about special features on how to create a package from JDBC or stuff like that - they don't know and don't care)

In SQLJ you will have packages.
AFAIK a mixed approach of dynamical and static SQL is supported as well - but usually not used.

I mean you do know whether they use SQLJ and packages or JDBC, do you ?

If you want to know how which method works: try out the samples. That is the quickest way. The radme for each method (SQLJ or JDBC) will guide you through a quickstart, which is very useful to learn how things work.

The samples are installed or you find the in the documentation or here:
http://www-306.ibm.com/software/data...8/samples.html
e.g. for SQLJ:
http://publib.boulder.ibm.com/infoce...j/s-README.htm
__________________
Juliane
Reply With Quote
  #3 (permalink)  
Old 11-08-05, 07:22
AnilKale AnilKale is offline
Registered User
 
Join Date: Feb 2005
Posts: 118
Yes, our application does use SQLJ. Does that imply, it is static SQL ?

Anil
Reply With Quote
  #4 (permalink)  
Old 11-08-05, 08:10
J Petruk J Petruk is offline
Registered User
 
Join Date: Mar 2004
Location: Toronto, ON, Canada
Posts: 513
SQLJ is always static, *but* you can easily mix in standard dynamic JDBC calls.
__________________
--
Jonathan Petruk
DB2 Database Consultant
Reply With Quote
  #5 (permalink)  
Old 11-08-05, 08:33
AnilKale AnilKale is offline
Registered User
 
Join Date: Feb 2005
Posts: 118
IF SQLJ is always static, does it create a package on the server ? how does it come up with package names ? are these packages rebound after a rebuild ?
I viewd the syscat.packages , and I could not see any packages that looked like SQLJ (application) packages.
My goal is to identify the sqlj generated packages,and the explain the packages.

thanks
Anil
Reply With Quote
  #6 (permalink)  
Old 11-08-05, 08:44
J Petruk J Petruk is offline
Registered User
 
Join Date: Mar 2004
Location: Toronto, ON, Canada
Posts: 513
I've never not supplied them, but there is a default.

From the Command Reference:

Quote:
-rootpkgname name

Specifies the root name of the packages that are to be generated by the SQLJ binder. If this option is not specified, a root name is derived from the name of the profile. Maximum length is seven characters. The digits 1, 2, 3, and 4 are appended to the root name to create the four final package names (one for each isolation level).
jono
__________________
--
Jonathan Petruk
DB2 Database Consultant
Reply With Quote
  #7 (permalink)  
Old 11-08-05, 09:30
AnilKale AnilKale is offline
Registered User
 
Join Date: Feb 2005
Posts: 118
Thanks Jonathan !
Thank you for giving me some idea on what sqlj does. However, the one thing that still continues to puzzle me is that
-if websphere does indeed perform the bind of the packages, there should be a package that I can explain.
I have explained all the packages on my server, and none seem to contain the application sql.

what am I missing ?


Anil
Reply With Quote
  #8 (permalink)  
Old 11-08-05, 09:36
J Petruk J Petruk is offline
Registered User
 
Join Date: Mar 2004
Location: Toronto, ON, Canada
Posts: 513
I'm not entirely sure.

Are you sure they're using SQLJ and not just straight JDBC? If it's sqlj, they've got to be there or the app can't run.

Maybe the developers are confused, or they're using SQLJ on a different database?
__________________
--
Jonathan Petruk
DB2 Database Consultant
Reply With Quote
  #9 (permalink)  
Old 11-08-05, 09:51
AnilKale AnilKale is offline
Registered User
 
Join Date: Feb 2005
Posts: 118
I had the exact same question. I asked the developer 'how could you be sure that you are using SQLJ (and not jdbc) ?'
And I was shown some files that are generated by the SQLJ precompiler. However, these files are on the application server.
I would think these files, if used to generate a package, would have a package entry on the server.
The db2 manual does talk about the db2sqljcustomize command which is used to determine package names and related options.
But I don't know where in webshpere (WSAD) does one specify these options. I have WSAD installed on my machine and I am not able to track down where do you play around with the db2sqljcustomize settings.


thanks
Anil
Reply With Quote
  #10 (permalink)  
Old 11-08-05, 10:01
J Petruk J Petruk is offline
Registered User
 
Join Date: Mar 2004
Location: Toronto, ON, Canada
Posts: 513
Were they ".ser" files? If so, you can run the "db2sqljprint" command to dump the package name and all the SQL.
__________________
--
Jonathan Petruk
DB2 Database Consultant
Reply With Quote
  #11 (permalink)  
Old 11-08-05, 10:07
AnilKale AnilKale is offline
Registered User
 
Join Date: Feb 2005
Posts: 118
Yes these are .ser files. I did run the db2sqljprint command.
And yes, I do see the statements.
However, all these .ser files are on the app server (WSAD).
I don't see a corresponding db2 package on the server.
If there exists a pacakge on the server, I could simply run the db2expln command on the package.
And I would get the access path for all the statements included in the .ser file.

Anil
Reply With Quote
  #12 (permalink)  
Old 11-08-05, 10:28
J Petruk J Petruk is offline
Registered User
 
Join Date: Mar 2004
Location: Toronto, ON, Canada
Posts: 513
Don't know what else to tell you, it should be on the server, otherwise the statements can't be executed.
__________________
--
Jonathan Petruk
DB2 Database Consultant
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On