Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

problem with Connection object in a servlet  RSS feed

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I need to retrieve data from oracle table. So i have established the conection in a class(pck1.dbcon)
Connection dbcon = DriverManager.getConnection("jdbc racle ci:@orcl", "scott", "tiger");

When i try to retrieve data from a servlet which imports this package, it gives error saying dbcon cannot be resolved.

Please Explain ?

Thanks
Geetu
 
Ranch Hand
Posts: 489
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


So i have established the conection in a class(pck1.dbcon)
Connection dbcon = DriverManager.getConnection("jdbc racle ci:@orcl", "scott", "tiger");



You should have done this in a public (and static) method of the class.



ram.
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not a servlet question.

Edited:
Its a crosspost. Same thread.
[ April 14, 2005: Message edited by: Adeel Ansari ]
 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I didnt used OCI for connecting Oracle databse,but the probelom may comes lots of conditions...(userid,driver probelom,etc..,)

But i might suggest one possiblity of accessing Oracle databse,by using oracle thin driver(this is pure type-4 driver).

Try this option

cheers
vasu
 
Geetu Bahl
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks everyone, specially ram
 
Ranch Hand
Posts: 225
IBM DB2 Eclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by ramprasad madathil:


ram.


Hi Ram..
Do u think that after Class.forName(".....");
DriverManager,gerConcetion(".....");


Will work fine ...then y to do all these gossip in esply in public staic mtd..

Let me know if it is not OK for u.. or if u have any comments...

Thx and Regards
G R Ganesh Gowtham
grgowtham_cse@yahoo.com
Capricornsys inc, Hyderabad
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!