File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes database connectivity in user defined function in servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "database connectivity in user defined function in servlet" Watch "database connectivity in user defined function in servlet" New topic
Author

database connectivity in user defined function in servlet

shilpa deshmukh-kadam
Ranch Hand

Joined: Jun 01, 2012
Posts: 38
Before posting this post I read topic "writing the user defined function in servlet" as per 'Ulf Dittmer' suggestion I tried to define new method for making connectivity to database and try to pass connection variable as parameter but It gives error can not find symbol below is my code


I want to call this function in anather class ...can you please help me...Thank you in advance
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61419
    
  67

Without showing what the errors are, how can we help you?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19719
    
  20

Never ever ever ever ever ever ever ever ever ever ignore exceptions without at least logging them (e.printStackTrace()). Right now you could be getting an SQLException or ClassNotFoundException and not even know it.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
shilpa deshmukh-kadam
Ranch Hand

Joined: Jun 01, 2012
Posts: 38
Sorry to say but I got answer My problem was that I could not create user defined methods in servlet but now I have solution below I put my code i.e solution for methods.

It's all my mistake I could not understand that how to do this now I got solution above are user defined methods which can be accessible in anather servlet class by creating object...
such as

Thank you both to want to help me. In future I will need your help Thank you....!
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12803
    
    5
Isn't letting a user create a database query a HUGE security risk?

Bill
Palak Mathur
Ranch Hand

Joined: Jan 29, 2007
Posts: 313

William Brogden wrote:Isn't letting a user create a database query a HUGE security risk?

Bill


Agree. Why will you want to pass the query to a public method?


Palak Mathur | My Blog | TechJaunt | What is JavaRanch? | List of All FAQs
shilpa deshmukh-kadam
Ranch Hand

Joined: Jun 01, 2012
Posts: 38
Thank you for reminding me.
now I correct my mistake i.e about function defined "public".

Thank you both of you..Palak Mathur and William Brogden.


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: database connectivity in user defined function in servlet