• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with Jdbc connection object  RSS feed

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

I have established JDBC connection in a class named as Dbcon in package conn.

Connection dbcon = DriverManager.getConnection("jdbc racle : oci : @orcl", "username", "password")

Now i import this package in a servlet and try to use dbcon but it gives an error saying dbcon can not be resolved.

Kindly tell how to correct this

Thanks
Geetu
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37399
531
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Geetu,
dbConn is a local variable. It goes out of scope at the end of the block/method it is defined in. Try moving this code to the place where you actually use dbConn.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!