OracleDriver
Hi,
I have been trying to connect to an Oracle 8i database using jdbc.
Initially I could not get my class to compile with the error, oracle.jdbc.oracle.OracleDriver not found.
Then after correcting my classpath, I got my class to compile.
Now when I run it, it gives NoClassDefFoundException
A small test program will just the connection code compiles and works fine.
What then is the problem with my main program, which just has some package declarations and import statements that the test program does not have?
Thanks in advance,
Vishakha
null
You need to have Oracles JDBC driver available to your web application.
That means the driver (commonly called ojdbc14.jar) should be in either the WEB-INF/lib directory of your web application, or in the [TOMCAT]/lib directory.
However it is generally accepted that Database connections from JSP pages are a bad idea.
Put this logic in java code/beans.
Even better, set up a [JNDI Datasource in Tomcat|http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html] that your web application can access. That way your code can be database independant.
Cheers,
evnafets
Similar Messages
-
A sign Applet unable to load "oracle.jdbc.OracleDriver" class
hi,
i am chiranjit , i am now working in a web based ERP. where i am using a signed applet which unable to load "oracle.jdbc.OracleDriver" class but it easily loading "sun.jdbc.odbc.JdbcOdbcDriver", i am also giving my code:
import java.sql.*;
import java.math.*;
import java.io.*;
import java.awt.*;
class JdbcTest extends Applet{
public static void main (String args[]) throws SQLException {
// Load Oracle driver
DriverManager.registerDriver (new oracle.jdbc.OracleDriver());
// Connect to the local database
Connection conn =
DriverManager.getConnection
("jdbc:oracle:thin:@192.168.16.7:1521:kris",
"plsql", "oracle");
// Query the employee names
Statement stmt = conn.createStatement ();
ResultSet rset = stmt.executeQuery ("SELECT FIRST_NAME FROM
AUTHORS");
// Print the name out
while (rset.next ())
System.out.println (rset.getString (1));
// Close the result set, statement, and the connection
rset.close();
stmt.close();
conn.close();
}Hint: The sun.jdbc.odbc.JdbcOdbcDriver is available in any JRE distribution. The Oracle driver is not.
-
Unable to load oracle.jdbc.driver.OracleDriver class
i want to connect my java application with oracle database but i m getting an error -"class not found exception oracle.jdbc.driver.OracleDriver " which is written in Class.forName() to register the driver for DriverManager.
plz help me..This is an old class, not included with the JDK anymore. It was made obsolete by
DataSource which is a connection pool and not a single connection. -
Help - Could not load 'oracle.jdbc.driver.OracleDriver ...
I'm using oci8 to connect to the Oracle database.
URL: jdbc:oracle:oci8:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(PORT=1527)(HOST=testhost)))(CONNECT_DATA=(SID=fnoe2pa)))
When I tried to start the weblogic server, I got the following errors:
Can you suggest what I should do next (step-wise)??? Thanks, Bobby
<Sleeping in createResource()>
####<15/08/2002 14:09:43> <Error> <JDBC> <qawebmethods> <myserver>
<main> <system> <> <001060> <Cannot startup connection pool
"pool/test_myapp" weblogic.common.ResourceException:
Could not load 'oracle.jdbc.driver.OracleDriver
If this is a type-4 JDBC driver, it could occur if the JDBC
driver is not in the system CLASSPATH.
If this is a type-2 JDBC driver, it may also indicate that
the Driver native layers(DBMS client lib or driver DLL)
have not been installed properly on your system
or in your PATH environment variable.
This is most likely caused by one of the following:
1. The native layer SO, SL, or DLL could not be found.
2. The file permissions on the native layer SO, SL, or DLL
have not been set properly.
3. The native layer SO, SL, or DLL exists, but is either
invalid or corrupted.
For more information, read the installation documentation
for your JDBC Driver, available from:
http://e-docs.bea.com
at weblogic.jdbc.common.internal.ConnectionEnvFactory.makeConnection(ConnectionEnvFactory.java:212)
at weblogic.jdbc.common.internal.ConnectionEnvFactory.createResource(ConnectionEnvFactory.java:134)
at weblogic.common.internal.ResourceAllocator.makeResources(ResourceAllocator.java:705)
at weblogic.common.internal.ResourceAllocator.<init>(ResourceAllocator.java:282)
at weblogic.jdbc.common.internal.ConnectionPool.startup(ConnectionPool.java:650)
at weblogic.jdbc.common.JDBCService.addDeployment(JDBCService.java:107)
at weblogic.management.mbeans.custom.DeploymentTarget.addDeployment(DeploymentTarget.java:360)
at weblogic.management.mbeans.custom.DeploymentTarget.addDeployments(DeploymentTarget.java:285)
at weblogic.management.mbeans.custom.DeploymentTarget.updateServerDeployments(DeploymentTarget.java:239)
at weblogic.management.mbeans.custom.DeploymentTarget.updateDeployments(DeploymentTarget.java:199)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMBeanImpl.java:636)
at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl.java:621)
at weblogic.management.internal.ConfigurationMBeanImpl.invoke(ConfigurationMBeanImpl.java:360)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1557)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1525)
at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:468)
at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:209)
at $Proxy31.updateDeployments(Unknown Source)
at weblogic.management.configuration.ServerMBean_CachingStub.updateDeployments(ServerMBean_CachingStub.java:2977)
at weblogic.management.mbeans.custom.ApplicationManager.startConfigManager(ApplicationManager.java:372)
at weblogic.management.mbeans.custom.ApplicationManager.start(ApplicationManager.java:160)
at java.lang.reflect.Method.invoke(Native Method)
at weblogic.management.internal.DynamicMBeanImpl.invokeLocally(DynamicMBeanImpl.java:636)
at weblogic.management.internal.DynamicMBeanImpl.invoke(DynamicMBeanImpl.java:621)
at weblogic.management.internal.ConfigurationMBeanImpl.invoke(ConfigurationMBeanImpl.java:360)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1557)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1525)
at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:468)
at weblogic.management.internal.MBeanProxy.invoke(MBeanProxy.java:209)
at $Proxy42.start(Unknown Source)
at weblogic.management.configuration.ApplicationManagerMBean_CachingStub.start(ApplicationManagerMBean_CachingStub.java:480)
at weblogic.management.Admin.startApplicationManager(Admin.java:1234)
at weblogic.management.Admin.finish(Admin.java:644)
at weblogic.t3.srvr.T3Srvr.start(T3Srvr.java:524)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:207)
at weblogic.Server.main(Server.java:35)
>
####<15/08/2002 14:09:43> <Info> <JDBC> <qawebmethods> <myserver>
<main> <system> <> <001082> <Creating Data Source named
jdbc/test_myapp for pool pool/test_myapp>
####<15/08/2002 14:09:43> <Info> <JDBC> <qawebmethods> <myserver>
<main> <system> <> <001070> <Checking existence of connection pool
pool/test_myapp requested by user system>
####<15/08/2002 14:09:43> <Error> <JDBC> <qawebmethods> <myserver>
<main> <system> <> <001059> <Error during Data Source creation:
weblogic.common.ResourceException: DataSource(jdbc/test_myapp) can't
be created with non-existent Pool (connection or multi)
(pool/test_myapp)>
####<15/08/2002 14:09:50> <Info> <EJB> <qawebmethods> <myserver>
<main> <system> <> <010008> <EJB Deploying file: myapp-ejb.jar>
####<15/08/2002 14:09:50> <Warning> <J2EE> <qawebmethods> <myserver>
<main> <system> <> <160007> <You are running WebLogic Server with J2EE
1.3 features enabled. The implementation of specific J2EE 1.3 features
(EJB 2.0, JSP 1.2, Servlet 2.3, and J2EE Connector Architecture 1.0)
in BEA WebLogic Server 6.1 is of a non-final version of the
appropriate specification. It is subject to change in future releases
once the specification becomes finalized. This may cause application
code developed for BEA WebLogic Server 6.1 that uses the new features
of J2EE 1.3 to be incompatible with the J2EE 1.3 platform supported in
future releases of BEA WebLogic Server.>
####<15/08/2002 14:09:59> <Error> <J2EE> <qawebmethods> <myserver>
<main> <system> <> <160001> <Error deploying application myapp-ejb:
Unable to deploy EJB: Counter from myapp-ejb.jar:
The DataSource with the JNDI name: jdbc/test_myapp could not be
located. Please ensure that the DataSource has been deployed
successfully and that the JNDI name in your EJB Deployment descriptor
is correct.
>
####<15/08/2002 14:09:59> <Info> <HTTP> <qawebmethods> <myserver>
<main> <system> <> <101053> <[HTTP myserver] Loading web app: myapp>
####<15/08/2002 14:09:59> <Info> <HTTP> <qawebmethods> <myserver>
<main> <system> <> <101059> <[myserver] Loading myapp from WAR file:
C:\bea\wlserver6.1\.\config\mydomain\applications\.wlnotdelete\wlap31483\myapp.war>
####<15/08/2002 14:09:59> <Warning> <J2EE> <qawebmethods> <myserver>
<main> <system> <> <160007> <You are running WebLogic Server with J2EE
1.3 features enabled. The implementation of specific J2EE 1.3 features
(EJB 2.0, JSP 1.2, Servlet 2.3, and J2EE Connector Architecture 1.0)
in BEA WebLogic Server 6.1 is of a non-final version of the
appropriate specification. It is subject to change in future releases
once the specification becomes finalized. This may cause application
code developed for BEA WebLogic Server 6.1 that uses the new features
of J2EE 1.3 to be incompatible with the J2EE 1.3 platform supported in
future releases of BEA WebLogic Server.>
####<15/08/2002 14:09:59> <Info> <HTTP> <qawebmethods> <myserver>
<main> <system> <> <101031>
<[WebAppServletContext(1412030,myapp,/myapp)] extracting classfiles to
C:\bea\wlserver6.1\config\mydomain\applications\.wlnotdelete\wlap31483\WEB-INF\_tmp_war_myapp:>
####<15/08/2002 14:10:04> <Info> <HTTP> <qawebmethods> <myserver>
<main> <system> <> <101032>
<[WebAppServletContext(1412030,myapp,/myapp)] extracted classfiles
successfully...>
####<15/08/2002 14:10:04> <Info> <HTTP Session> <qawebmethods>
<myserver> <main> <system> <> <100037> <Creating SessionContext of
type: memory for webapp: /myapp>
####<15/08/2002 14:10:04> <Info> <HTTP> <qawebmethods> <myserver>
<main> <system> <> <101047>
<[WebAppServletContext(1412030,myapp,/myapp)] registering classpath
servlet with initArgs 'null'>
####<15/08/2002 14:10:04> <Info> <HTTP> <qawebmethods> <myserver>
<main> <system> <> <101047>
<[WebAppServletContext(1412030,myapp,/myapp)] registering getior
servlet with initArgs 'null'>
####<15/08/2002 14:10:04> <Info> <HTTP> <qawebmethods> <myserver>
<main> <system> <> <101047>
<[WebAppServletContext(1412030,myapp,/myapp)] registering tunneling
servlets with initArgs 'wl-dispatch-policy=direct'>
####<15/08/2002 14:10:04> <Info> <HTTP> <qawebmethods> <myserver>
<main> <system> <> <101047>
<[WebAppServletContext(1412030,myapp,/myapp)] registering JSPServlet
with initArgs '[JspConfig:
verbose=true,packagePrefix=jsp_servlet,-compiler=javac,compileFlags=,workingDir=C:\bea\wlserver6.1\config\mydomain\applications\.wlnotdelete\wlap31483\WEB-INF\_tmp_war_myapp,pageCheckSeconds=1,superclass=null,keepgenerated=false,precompileContinue=false,compilerSupportsEncoding=true,encoding=null,defaultfilename=index.jsp,compilerclass=null,noTryBlocks=false]'>
####<15/08/2002 14:10:04> <Debug> <HTTP> <qawebmethods> <myserver>
<main> <system> <> <101097> <Registering ServletContext:
"myapp:/myapp">
####<15/08/2002 14:10:04> <Info> <J2EE> <qawebmethods> <myserver>
<main> <system> <> <160003> <Deployed : myapp>
####<15/08/2002 14:10:04> <Info> <HTTP> <qawebmethods> <myserver>
<main> <system> <> <101133> <Initializing WEB server myserver>
####<15/08/2002 14:10:04> <Notice> <Management> <qawebmethods>
<myserver> <main> <system> <> <141052> <Application Poller started for
development server.>
####<15/08/2002 14:10:04> <Notice> <WebLogicServer> <qawebmethods>
<myserver> <ListenThread> <system> <> <000202> <ListenThread listening
on port 7001>
####<15/08/2002 14:10:04> <Info> <NT Performance Pack> <qawebmethods>
<myserver> <ListenThread> <system> <> <000000> <NATIVE: NTSocketMuxer
was built on Nov 1 2001 16:39:28
>
####<15/08/2002 14:10:04> <Notice> <WebLogicServer> <qawebmethods>
<myserver> <SSLListenThread> <system> <> <000202> <SSLListenThread
listening on port 7002>
####<15/08/2002 14:10:05> <Notice> <Management> <qawebmethods>
<myserver> <main> <system> <> <141030> <Starting discovery of Managed
Server... This feature is on by default, you may turn this off by
passing -Dweblogic.management.discover=false>
####<15/08/2002 14:10:05> <Notice> <WebLogicServer> <qawebmethods>
<myserver> <main> <system> <> <000331> <Started WebLogic Admin Server
"myserver" for domain "mydomain" running in Development Mode>
####<15/08/2002 14:10:11> <Info> <NT Performance Pack> <qawebmethods>
<myserver> <ExecuteThread: '14' for queue: 'default'> <> <> <000000>
<Allocating: '2' NT reader threads>
####<15/08/2002 14:10:13> <Info> <HTTP> <qawebmethods> <myserver>
<ExecuteThread: '1' for queue: '__weblogic_admin_html_queue'> <system>
<> <101047> <[WebAppServletContext(5367844,console,/console)] actions:
init>
####<15/08/2002 14:10:18> <Info> <HTTP> <qawebmethods> <myserver>
<ExecuteThread: '1' for queue: '__weblogic_admin_html_queue'> <system>
<> <101047> <[WebAppServletContext(5367844,console,/console)]
FileServlet: init>
####<15/08/2002 14:10:18> <Info> <HTTP> <qawebmethods> <myserver>
<ExecuteThread: '1' for queue: '__weblogic_admin_html_queue'> <system>
<> <101047> <[WebAppServletContext(5367844,console,/console)]
FileServlet: Using standard I/O>"thorick" <[email protected]> wrote in message news:<[email protected]>...
Most likely, the OCI libraries could not be loaded.
Before continuing down this path, is there any reason
why you want to use an OCI based Driver as opposed to the
all Java Oracle thin driver ?There is indeed a valid reason for my choice.
I am currently connecting to the Oracle "Rdb" 7.0 database (located on
VMS) - not Oracle Oracle.
The SQL Service software we're currently using is version 7.1. This
version works well with the OCI8 driver (when connecting to the
database from Windows NT). This version of SQL Service however does
NOT work for the THIN driver (unless we upgrade the SQL Service to
version 7.1.5.5 - which we're not prepared to do so because it is not
stable enough from our previous test/trials). SQLSRV Version 7.1.5.5
works for THIN driver but it will result in uncommitted
transactions/unresolved connection/stopping of listener issues and
there is a need to restart the service from time to time. Oracle has
since confirmed that this is a bug that they have yet to resolve...
So we have to stick to OCI8 (THICK) for the time being. I would really
appreciate it very much if you can tell me the various OCI libraries
that I need to load (in terms of WebLogic Server config file settings
etc..).
By the way I have already installed the Oracle 8 client software on
the NT server (where WebLogic Server is) and I have also set up the
relevant SID (using the Net8 Assistant) that points to the Oracle Rdb
database on the VMS. I have also tried using SQL*Plus to connect to
the database and I can connect properly to the database. But WebLogic
simply doesn't seem to load the software.
Help...
Regards,
Bobby Brown, writing from Australia. -
Oracle.jdbc.driver.OracleDriver not found in Sun ONE Studio
I get this message when I try to connect to the database while creating an EJB. I have tried adding the path to my CLASSPATH, and to adding it to the various CLASSPATHs within Sun ONE Studio. IDE_HOME is defined correctly but OracleDriver.class is still not found. Anyone know what my problem might be?
Thanks,
Michael A. MoranHi Sujatha,
Thanks for responding. My CLASSPATH is as follows:
madonna% echo $CLASSPATH
/export/oracle/jdbc/lib:/export/oracle/jlib:/export/oracle/jsp/lib:/export/oracle/sqlj/lib/runtime.zip:/export/oracle/oem_webstage:/export/oracle/lib/aurora_client.jar:/export/oracle/jdbc/lib/classes12.zip:/export/oracle/sqlj/lib/translator.zip:/export/oracle/sqlj/lib/runtime12.jar:/export/oracle/lib/vbjorb.jar:/export/oracle/lib/vbjapp.jar:/export/oracle/lib/mts.jar:/export/oracle/javavm/lib/aurora.zip:/export/oracle/javavm/utl/ejb/lib/vbj30ssl.jar:/export/oracle/jlib/javax-ssl-1_2.jar:/export/oracle/jlib/jssl-1_2.jar:/export/oracle/lib/servlet.jar:/export/oracle/lib/http_client.jar:/export/oracle/lib/http_server.jar:/export/oracle/oem_webstage/oracle/jdbc/OracleDriver.class:/export/oracle:/export/oracle/jdbc/lib/nls_charset12.jar
Which as you can see includes classes12.zip and /export/oracle/oem_webstage/oracle/jdbc/OracleDriver.class
I have also set all the IDE internal classpath variables to the same settings. It has no effect. I still get the same message.
Michael -
S not found: oracle.jdbc.driver.OracleDriver
In the log I get this error:
15:17:14,503 INFO [STDOUT] **** Initilizing HibernatePlugIn **********
15:17:14,972 INFO [STDOUT] Error while initializing hibernate: JDBC Driver cla
s not found: oracle.jdbc.driver.OracleDriver
15:17:14,972 INFO [STDOUT] *************************************fixed it by putting the jdbc jar files from oracle lib to the jboss lib
-
Cannot resolve symbol: class OracleDriver
Attempting to compile a servlet on Apache Server using same jdeveloper jdbc libraries:
classes12.jar & nls_charset12.jar
Error message:
$compilejava2.sh ProdJobs
ProdJobs.java:361: cannot resolve symbol
symbol : class OracleDriver
location: package driver
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Am I missing something else?
JeffreyEnter this code into your program and then put the Oracle jar file that contains the driver in your run-time classpath.
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
catch(ClassNotFoundException cnfe) {
// driver not found
}The effect of this is that the classloader will load the Oracle driver for you then call it's static initiailizer that does a bunch of magic that results in the Java runtime knowing that there's a JDBC driver out there.
It is a little weird - but that's the way it works. -
Hi.
I've got this piece of code into a servlet:
<%@page language="java" import="java.sql.*"%>
<%
Driver DriverRecordset1 = (Driver)Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
Connection Conn = DriverManager.getConnection("jdbc:oracle:thin:@myserver:1521:SID","system","manager");
When starting Tomcat, I included into startup.bat:
set CLASSPATH=%CLASSPATH%;d:\orant\jdbc\classes102.zip (it exists)
But when executing the code, I get this error message:
javax.servlet.ServletException: oracle.jdbc.driver.OracleDriver
What am I doing wrong?
Thank you very much.The whole message:
javax.servlet.ServletException: oracle.jdbc.driver.OracleDriver
at org.apache.jasper.runtime.PageContextImpl.handlePageException(Unknown Source)
at mypage_1._jspService(mypage_1.java:112)
at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source)
at org.apache.tomcat.core.Handler.invoke(Unknown Source)
at org.apache.tomcat.core.Handler.service(Unknown Source)
at org.apache.tomcat.facade.ServletHandler.service(Unknown Source)
at org.apache.tomcat.core.ContextManager.internalService(Unknown Source)
at org.apache.tomcat.core.ContextManager.service(Unknown Source)
at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown Source)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source)
at java.lang.Thread.run(Thread.java:484)
================
If I write only:
Class.forName("oracle.jdbc.driver.OracleDriver");
I get the same error. -
Java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
Hi everyone,
Can any one plz help me with this problem in connection with the database...im unable to connect from the servlet where my jdbc connectivity code is written when i compile it gives me this error:
Ljava.lang.String;@e53220java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1352)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at shoppingcart.shoppingcartservlet.doit(shoppingcartservlet.java:83)
at shoppingcart.shoppingcartservlet.doPost(shoppingcartservlet.java:30)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)Hi
The server is not able to load the jdbc driver path. Place your driver in server classpath
Venkat -
Re: OracleDriver cannot be resolved to a type
I still have the same problem which was reported in the first post.
I tried all the changes mentioned above but doesn't help as I am totally new to jsp please suggest me a way out in detail.
An error occurred at line: 6 in the jsp file: /one.jsp
oracle.jdbc.driver.OracleDriver cannot be resolved to a type
<%
try{
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@10.145.2.142:1521:MESNEW","MESAPUSER", "mesdev");
String query1="Select OWNER,TABLE_NAME FROM ALL_TAB_PRIVS_MADE ";
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:366)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:468)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
Thanking you in advance.1) you don't want to do that in a JSP
2) did you actually add the correct jars to the classpath of your web application? Because if you did, you'd not get this error.
That means adding it to the proper location in your WAR file, as you should have learned when you studied tutorials and books about web application development. -
OracleDriver cannot be resolved to a type
Hi all..
Iam new to this forum...Actually i have a problem.please help me..
Now iam working with tomcat6.0.16 and oracle10g.
<%@page import="java.sql.*" %>
<%
//Register the drivers
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
//Establish connection with the database
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","manager");
//create a sql statement
Statement st=con.createStatement();
//execute the statement
ResultSet rs=st.executeQuery("select * from emptab");
//all rows of emptab are in rs.Now retrive column data
//from rs and display
while(rs.next())
out.println(rs.getInt(1));
out.println(rs.getString(2));
out.println(rs.getFloat(3));
out.println("................");
//close the connection
con.close();
%>
this is my program...then iam getting following error.please any one can help me?
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 4 in the jsp file: /oradata.jsp
oracle.jdbc.driver.OracleDriver cannot be resolved to a type
1: <%@page import="java.sql.*" %>
2: <%
3: //Register the drivers
4: DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
5: //Establish connection with the database
6: Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","manager");
7: //create a sql statement
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:423)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:316)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:294)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:281)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.16 logs.
Apache Tomcat/6.0.16You need to have Oracles JDBC driver available to your web application.
That means the driver (commonly called ojdbc14.jar) should be in either the WEB-INF/lib directory of your web application, or in the [TOMCAT]/lib directory.
However it is generally accepted that Database connections from JSP pages are a bad idea.
Put this logic in java code/beans.
Even better, set up a [JNDI Datasource in Tomcat|http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html] that your web application can access. That way your code can be database independant.
Cheers,
evnafets -
Hi,
I have installed the Oracle Data Integrator Public Web Services on Apache Tomcat 5.5 application server with Apache Axis2
When I try to call the web service OdiInvoke using the operation "listScenario" using only the JdbcDriver as input parameter, the response I get back from the web service call is:
java.lang.ClassNotFoundException: Class Not found : oracle.jdbc.driver.OracleDriver
Using the operator "getWebServiceVersion" I get a successfull response back som the connection seems fine.
Obviously the error has to do with the driver not beeing available but where should I put the driver? Or how do I make it available? When working from Topology Manager, all connections are fine.
Best regards
MSolved it on my own by putting ojdbc14.jar in the following directory: <Apache-Tomcat install dir>/webapps/axis2/WEB-INF/lib/
Thought I'd share in case some one else has same issue
/M -
Oracle.jdbc.driver.OracleDriver cannot be found !
Hi,
I'm using VisualAge 4.0 and WebSphere Application Server 3.5.5
I have an error when i execute my application (with java -jar myapp.jar) :
"Impossible to find jdbc driver class oracle.jdbc.driver.OracleDriver which has been specified"
I have installed an Oracle driver in WebSphere, so what is the problem ??
It's working very well if i start my application in VisualAge
Thanks in advance
SteveIf you use the -jar Option with your application No classpath setting is used. Either place the classes12.zip in the ext directory or class your application without the -jar option.
See also:
http://java.sun.com/j2se/1.3/docs/tooldocs/win32/java.html#options
Uwe -
Oracle.jdbc.driver.OracleDriver
Hi,
i am new webservice. i had develop the one webservice example. in this example i am retrieving the data from the database and retreive it as string format(all the rows). when i am calling the webseriveclient as passing the parameter query as string , its giving the error. while i am calling the same from the main method its coming fine.
the error is
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1340)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:140)
at com.hcl.test.webservice.HelloService.getAccounts(HelloService.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:388)
at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:283)
at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:536)
i already added the classes111.jar file in tomcat lib as well as jdk lib. still its givng the same error.....
what can i do to solve this problem
regards
ramThe class is present in the classes12.jar file. Add that to your classpath.
cheers,
vidyut -
I ran into an NPE when using Oracle thin client 11.1.0.6.0 (ojdbc6.jar) to connect to a 10g server. It is not easy to reproduce though. The following is the stack trace, any suggestions?
java.lang.NullPointerException
at java.util.Hashtable.get(Hashtable.java:334)
at java.util.Properties.getProperty(Properties.java:932)
at oracle.jdbc.driver.PhysicalConnection.parseConnectionProperty_String(PhysicalConnection.java:2037)
at oracle.jdbc.driver.PhysicalConnection.parseConnectionProperty_int(PhysicalConnection.java:2072)
at oracle.jdbc.driver.PhysicalConnection.readOCIConnectionPoolProperties(PhysicalConnection.java:1936)
at oracle.jdbc.driver.PhysicalConnection.readConnectionProperties(PhysicalConnection.java:1927)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:471)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:202)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:33)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:474)
at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:37)
at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:290)
at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:877)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:851)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:113)
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:79)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:382)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:458)
at com.verisign.uaservice.dbverify.dao.DBVerifyDAOImpl.getRecordAsPair(DBVerifyDAOImpl.java:255)
at com.verisign.uaservice.dbverify.Verifier.verify(Verifier.java:37)
at sun.reflect.GeneratedMethodAccessor54.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:276)
at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:260)
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86)
at org.quartz.core.JobRunShell.run(JobRunShell.java:203)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)What is the exact 10g version?
According to MOS note 207303.1, for connection between 11g client and 10g server, there is a minimum version requirement on 10g server side. -
I have written a java stored procedure. The method can be executed properly in local PC environment.
but when the java program is load into Oracle DB JVM by loadjava command. such method is called in SQL> prompt as a java stored procedure. I got
java.lang.NullPointerException
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:379)
at java.sql.DriverManager.getConnection(DriverManager.java:573)
at java.sql.DriverManager.getConnection(DriverManager.java:187)
at WCZSynchronizer.testLocalConn(WCZSynchronizer:901)
as shown in the trace file.
The line in my own java program WCZSynchronizer is simply
Connection conn = java.sql.DriverManager.getConnection(db_connection_string,username,password);
I am sure that the db_connection_string, username and password are correct as it works in my local PC.
I even try to get default connection by
Connection conn = java.sql.DriverManager.getConnection("jdbc:default:connection:");
and
Connection conn = new oracle.jdbc.driver.OracleDriver().defaultConnection();
I got the same NullPointerException in both cases too.
In fact, the java stored procedure worked before. but suddenly it's failed! The Oracle DB server is under my control and I did not change any configuration nor setting on it.
I can't find similar case from this forum. Do any one know why?
thanks.First try debugging the test case by making sure that none of the parameters passed to getConnection is null.
When you are sure that none of the parameters are null, if the issue still reproduces. Let us know
- The driver version
- The jar file you are using
cheers
Ashok
Maybe you are looking for
-
Boot Camp - Windows 7 (64-bit) - Catalyst Control Center
Hi, This topic is all about running Catalyst Control Center on your Mac in Boot Camp. Setup: Mac Pro 2.66 (early 2009) ATI Radeon HD 5870 Boot Camp 3.2 Windows 7 (64-bit) SP1 Case: First I uninstalled all graphic drivers that came with Mac OS disc. A
-
Hi Expert, by creating a colored workbook i notice the color was disappearing after the refresh. I decide to built a makro which can fix the color in each line. I done that manually. But i am looking for a makro which can dynamically color the cells.
-
I recently synced my iPhone 4 to a new computer, after completion, the thumbnails were blacked out. I could click at random and the pictures would show up(I could scroll through them fine as well). Also, new pictures I have taken, thumbnails were the
-
Validation Amount fields WRBTR
Hi All, Validate the format of the fields in the BI for "Amounts" WRBTR (integer ciphers, comma, decimal ciphers) if u people have any code or idea for this validation I look forward to your reply Thanks & Regards SEK
-
How to find no. of hits on the documents in KM
hello eperts, i need to find i a way to get the number of hits on particular documents which have been uploaded in km.