wood burning stoves*
The moose likes JSP and the fly likes I still haven't had an answer for this... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "I still haven Watch "I still haven New topic
Author

I still haven't had an answer for this...

Richard Vagner
Ranch Hand

Joined: Jun 26, 2001
Posts: 107
I have installed tomacat to set up Oracle JDBC-ODBC driver,
data source... but ran into some problmes:
The database connection with Oracle only works with .java
files but does not work with jsp files.
For example: test.java would work but test.jsp would not.
This is the error message I got when running with test.jsp:
"OCI.DLL: One of the library files needed to run this
appliction cannot be found". Can anyone tell me what might
be the problem? I checked the dll dependency for OCI.DLL,
all dll files are there.
Please help
Roland
This is my test.jsp program:

<%@ page info="database handler"%>
<%@ page import="java.io.*"%>
<%@ page import="java.util.*"%>
<%@ page import="java.sql.*"%>
<%@ page import="javax.servlet.*"%>
<%@ page import="javax.servlet.http.*"%>
<%
try
{
Connection con=null;
Statement stmt=null;
ResultSet rs=null;
String createString=null;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url="jdbc dbc:test";
con = DriverManager.getConnection(url,"scott", "tiger");
createString="select FIRST_NAME,EMPLOYEE_ID,SALARY from
emp";
stmt=con.createStatement(); ;
rs = stmt.executeQuery(createString);
while (rs.next())
{
String col1 = rs.getString(1);
String col2 = rs.getString(2);
out.println("<tr><td>"+col1+"</td><td>"+col2+"</td></tr>");
}
out.println("</table>");
}
catch (Exception e) {}
%>
Roy Ben Ami
Ranch Hand

Joined: Jan 13, 2002
Posts: 732
what do u mean it works with java and not jsp files?
the connection should be the same no? whats the differnce?
how did u try to run it as jsp?
Richard Vagner
Ranch Hand

Joined: Jun 26, 2001
Posts: 107
Thanks, Roy,
I finally got a response from you. What I mean by test.java is I created a file called test.java. it contains jdbc code used to connect to Oracle database using JDBC-ODBC bridge. I compiled it and run it and it works. However I could not have it work in test.jsp which has basically the same code as test.java but with jsp format. When test.jsp is activated:
http://localhost:8080/jsp/test.jsp I got the error metioned in the previous message. I am trying to figure out what library files are missing. It seems to me after checking the OCI.DLL dependency with MS's dependency walker, all required dll files are there. So what is the problem?
Thanks for your help
Roland
Roy Ben Ami
Ranch Hand

Joined: Jan 13, 2002
Posts: 732
ok.
listen i dont understand in this much but i did a little hunting across the web.
your problem is a common one and i saw couple of solutions.
its a problem witht he oracle database.
here is one solution:

Connection problems
The 32bit applications all connect directly to Oracle using the OCI (Oracle Call Interface.) Our applications are sensitive to incorrect Oracle settings in your registry (more so than Oracle's applications which are generally installed in the same directory as SQLNet/Net8.)
Possible Quickfix:
There is a new 'Options...' button on the login window (you have to click the More>> button first to see it.) If you click the options button you will see the 'Login Window Options' window. There is a field called 'OCI DLL' which you should set to the correct value. The correct value should be something like 'ora73.dll' or 'ora805.dll' depending upon what version of Oracle's required support files you have installed. You can usually just look in your [oracle_home]\bin directory and use the highest oraxxx.dll file that you find.
Other suggestions:
Make sure that you create an alias for your database using Easy Config or Net8 Assistant. If you are using Oracle Names then make sure that it is setup correctly.
Use TNSPING.EXE to ping your alias. (i.e. tnsping aliasname.) TNSPING.EXE should be in your ORACLE_HOME\bin directory.
Make sure that you have a registry key called HKey_Local_Machine\Software\Oracle (This can be missing when SQLNet/Net8 is installed by hand or with a script and not from the Oracle CD.

In general our products will check your machine's registry settings to determine the correct Oracle Home directory and then search that directory for the correct Oracle OCI .dll file to use. Incorrect registry settings and 'orphaned' OCI dll files can sometimes confuse our products. A cleanly installed SQLNet or Net8 should always work! Oracle does not clean up its registry settings when you uninstall products, so be aware that if you install Net8.1 and then remove it, that those settings are still in your registry and can cause problems.

if it doesnt help try searching in http://google.com for the oci.dll u mentioned.
you'll find a lot of links about that.
 
 
subject: I still haven't had an answer for this...
 
Similar Threads
Trouble connecting to MS Access via ODBC
small question for a e-store problem
Drop down box
getObject () not returning values
problem in browsing