my dog learned polymorphism*
The moose likes JDBC and the fly likes can we use an static method to return connections when we need them ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "can we use an static method to return connections when we need them ?" Watch "can we use an static method to return connections when we need them ?" New topic
Author

can we use an static method to return connections when we need them ?

raminaa niilian
Ranch Hand

Joined: Jul 14, 2005
Posts: 551
Hi
thank you for reading my post
I have an static method that i create some JDBC connection inside it.
when ever i need a connection i call that method and the method will go tru connection creation scenario ( class.forname.....)
I have doubt that it does not create new connections and always return the same connection because the connection returns some unknown errors like : table aa does not exists..

What is task of an static method , we can call it from the class instead of creating an object of that class , does it have some other features that affect my job ?

thanks
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Yes, you can create connections from static methods, although it looks like your error table aa does not exist is referring to some other problem.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: can we use an static method to return connections when we need them ?
 
Similar Threads
JDBC Question
Is this good approach to design DB i/f?
Tomcat, MySQL,JSP/Servlets -> Connection Pooling
DB connection from servlets
What does it mean when we say a class is first loaded?