This week's book giveaway is in the Artificial Intelligence forum.
We're giving away four copies of Pragmatic AI and have Noah Gift on-line!
See this thread for details.
Win a copy of Pragmatic AI this week in the Artificial Intelligence 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:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Jsp databse connectivity problem  RSS feed

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends ,
I am new to jsp programming and i am actually stuck up at a small point of my jsp programe.
I was actually doing a jsp prog that would connect to oracle databse and retrieve the data and show it back to the user. But when i execute it i get this error
------------------------------------------------------------------------------- -------------------------------------
javax.servlet.ServletException: Unable to get connection, DataSource invalid: "java.sql.SQLException: Io exception: The Network Adapter could not establish the connection"
------------------------------------------------------------------------------- --------------------------------------
The databse is also residing on my own system i.e on my localhost , i m not connecting to any remote server .I have set the environmental variable "classpath" to classes12.jar and also placed in lib folder of my project .But i still get the above error. The platform i use is tomcat 5.5 , operating system as windows XP and oracle 9i as my database.
I would be very eagerly awaiting for any reply as its a lil urgent .

Thank you in advance,
Satish
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its a JDBC question.

- What driver are you using.
- Post some code snippet.
 
Satish Kumar
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
heres the code , i m giving only the tag file
====================================================

<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ attribute name="ID" required="true" %>


<sql:setDataSource
var="LoginData"
driver="oracle.jdbc.driver.OracleDriver"
url="jdbc racle:thin:@localhost:1521:SATISH"
user="scott"
password="tiger"
/>
<sql:query dataSource="${LoginData}" var="l_results"

sql="SELECT * FROM LOGIN WHERE U_ID=${ID}" />
<c:forEach var="row" items="${l_results.rows}">
<c ut value="${row.PASS}" />
</c:forEach>
<c ut value="~" />
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like your DB is on remote machine.
Are you able to access the DB via some other client like, SQL Plus, TOAD, Aqua Data Studio?
 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you make sure you have got the entry for the database in tnsnames.ora
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by rahul V kumar:
Can you make sure you have got the entry for the database in tnsnames.ora



No, if you are using oracle thin driver, then you dont need to configure tnsnames. You can use SID of the DB instead.
Thanks.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!