• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Jsp databse connectivity problem

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic