• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How i can reach Resultset Connection variables outside Class or from inner method

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know I telled true or not(i know resultset not a variable).But after see my code you can understand.I have a connect database class.I have a method for connection and execute queries.



I plan use a lot of different methods using this connection.But i don't want to use Classforname,Connection codes in every single method.I tryed to make a constructor but did not worked.I mean how i can make this possible and how i can reach Cnctdb , sqldb ... from another class(i succesed in swing objects but failed in connection).

Thanks in advance...
 
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should move that, "getting a connection" code in to factory class which will initialize when the application starts and can be used to get connections.

Here is just a brief guide to get started. You may add many features/functions to enhance or make it more usable later.



And You know how to use this class in client code right ?
 
ozhan kaya
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot Vijitha Kumara.I even tryed this > static Resultset
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

ozhan kaya wrote:I tryed to make a constructor but did not worked.


It will work if you code it the right way and removed the 'static' modifier.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

ozhan kaya wrote:Thanks a lot Vijitha Kumara.I even tryed this > static Resultset


Very bad idea. Go back to your basic Java book/tutorial and carefully learn what the 'static' modifier does.
reply
    Bookmark Topic Watch Topic
  • New Topic