Having a problem connecting to Oracle using JDBC type 2 OCI driver
posted 12 years ago
Hi, Im writing a servlet which should connect to an oracle database and retrieve some data. When i do this from a java application it runs fine but it doesnt work when i use the same code in a servlet. Is it that Type 2 drivers dont work with servlets ? What are my alternatives ? Am pasting relavent code: String sConn = "jdbc racle ci8:admin/admin@FRAME";
I can guess that this is probably a classpath issue. It looks like the container is not providing the Oracle driver classes to your application. In general, command line applications make use of the CLASSPATH environment variable, or a classpath specified as a command-line parameter when the application is started. Servers, on the other hand, usually ignore the system CLASSPATH and have their own mechanism for providing classes to contained applications. You probably need to put the Oracle driver classes either in the container "lib" directory (to be shared between all loaded applications), or into WEB-INF/lib (if a jar file) or WEB-INF/classes (if a bunch of regular class files) in your web application.