*
The moose likes JDBC and the fly likes Jsp databse connectivity problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Jsp databse connectivity problem" Watch "Jsp databse connectivity problem" New topic
Author

Jsp databse connectivity problem

Satish Kumar
Greenhorn

Joined: Feb 18, 2005
Posts: 23
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
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Its a JDBC question.

- What driver are you using.
- Post some code snippet.
Satish Kumar
Greenhorn

Joined: Feb 18, 2005
Posts: 23
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

Joined: Aug 15, 2004
Posts: 2874
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?
rahul V kumar
Ranch Hand

Joined: May 20, 2003
Posts: 82
Can you make sure you have got the entry for the database in tnsnames.ora
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Jsp databse connectivity problem
 
Similar Threads
java.lang.Class NotFoundException
Problem in websphere Connection pool
Websphere Connection Pool problem
Websphere Connection Pool problem
storing images in the database