Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JSP connect to OracleDatabase

843838Dec 20 2006 — edited Dec 21 2006
Hi,
sorry but my writing English ist verry bad.
I have a problem with the connecting to my db.
If i'll connect over a Java standalone application it works without any problems.
But now i've a JSP application and if I effect this i get the following error message:
This side isn't available. Possibly technical difficulties arose or you should examine the settings of the web-Browser ...
ERROR: Server or DNS cannot be found Internet Explorer 
Here is my code:
sqlTest.jsp:
<%@ page import="java.sql.*" %>
<%@ page import="javax.sql.DataSource" %>
<%@ page import="javax.naming.*" %>

<h1>Test</h1>
<%

try 
{ 
	Context initContext = new InitialContext();
	Context envContext  = (Context)initContext.lookup("java:/comp/env");
	DataSource ds = (DataSource)envContext.lookup("jdbc/myoracle");
	Connection conn = ds.getConnection();
	Statement stmt = conn.createStatement ();
	ResultSet rset = stmt.executeQuery("select * from ordner");
	out.println("<table><tr><td>Nr</td><td>Name</td></tr>");
	while (rset.next()) 
	{
		out.println("<tr><td>"+rset.getInt("id")+"</td><td>"+rset.getString("bezeichnung"));
	}
	out.println("</table>");
} 
	catch (Exception e) 
	{
		out.print("<font color=red>Exception</font><br>");
	    out.println(e);
	    out.print("<br><font color=red>Stacktrace</font><br>");
	    e.printStackTrace();
	}
%>
part of server.xml:
<Context path="/strutsTest" docBase="C:\Dokumente und Einstellungen\febelsha\Eigene Dateien\workspace\strutsTest"
            debug="5" reloadable="true" crossContext="true" antiResourceLocking="false" antiJARLocking="false">

 <Resource  name="jdbc/myoracle" auth="Container"
            type="javax.sql.DataSource" 
            driverClassName="oracle.jdbc.driver.OracleDriver"
            url="jdbc:oracle:oci:@geheim.de"
            username="test" password="testpw"
            maxActive="20" maxIdle="10" maxWait="-1"/> 
</Context>
I use the Tomcat 5.5.20 with JDK 1.5.0_09. Is ist possible, that either Tomcat or JDK is defect?
Otherwise i have no idea.

I hope you can solve the problem or can give me any information

Sorry because of my English

regards
KalleWirsch
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 18 2007
Added on Dec 20 2006
2 comments
83 views