aspose file tools*
The moose likes Servlets and the fly likes How do you pull a SQL query out of this servlet code? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How do you pull a SQL query out of this servlet code?" Watch "How do you pull a SQL query out of this servlet code?" New topic
Author

How do you pull a SQL query out of this servlet code?

Michele Smith
Ranch Hand

Joined: Oct 27, 2010
Posts: 418
Hello I am trying to figure out how to get the SQL query out of this servlet code.

Thanks,
---------------------
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19718
    
  20

What SQL query? I see nothing that even looks remotely like it's database related. Do you perhaps want to create an SQL query? If so, TellTheDetails. What does the query need to do? What is the table to get data from? What does the table look like? Etc.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Michele Smith
Ranch Hand

Joined: Oct 27, 2010
Posts: 418
Hello all I have is a servlet (shown above) and an xml file (there is no SQL statement in the xml file).

I am not sure what to do. I cannot find a SQL query anywhere. I was thinking if I hovered above an item in the servlet it would show me something.

I wondered if you could help me figure out where it is.

I did not create this code.

Thanks,
William P O'Sullivan
Ranch Hand

Joined: Mar 28, 2012
Posts: 859



That's what you iterate through to generate the XML.

Find out what Parent is doing and you may find your answer.

WP
Michele Smith
Ranch Hand

Joined: Oct 27, 2010
Posts: 418
Hello I am sorry, I need you to be more specific than this. I don't understand.

Thanks,
Koen Aerts
Ranch Hand

Joined: Feb 07, 2012
Posts: 344

It looks like the getHomes() method of the Parent object may runs some SQL in order to get the results that you iterate through. Also, the Parent instance is created with an BcSQLAgent object passed to its constructor: "Parent p = new Parent(agt);". I suspect the BcSQLAgent contains some details about the DB connection, transaction, etc. and the Parent object uses that in order to run a query on the DB. What creates the BcSQLAgent object... where does it come from? If you have the source code for com.bc.util.BcSQLAgent and bcc.lib.dob.Parent, it may help to start looking there as well and figure out where Parent gets its SQL from. Perhaps from a .properties file, an .xml file, or from somewhere in the BcSQLAgent object. Maybe Parent and/or BcSQLAgent contain some methods that may reveal more details about its underlying SQL or other hints that may help you (i.e. toString() method, if that is implemented and not using the default one from java.lang.Object).
William P O'Sullivan
Ranch Hand

Joined: Mar 28, 2012
Posts: 859

Koen is right.

And "Michele", I don't appreciate "I need you to be more specific than this."

What you have shown us has absolutely no SQL!
Without access to the source, your userid and password and a cut of your pay, we cannot help.

Do the research, dig in Parent.java and tell us something about what you find.

WP
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do you pull a SQL query out of this servlet code?