about:  I am desperate to get my java servlet to connect to our Oracle database...

Hello,

I am new to servlets, but this is some generally useful help.  Try doing your first
database connect as a standalone java program first, not as a servlet.  I believe that
the 500 Internal Error is a simply that the servlet is not compiling successfully when
hit the first time - this is the same error you get when you run a CGI/Perl script and
you have a syntax error - forgot a semicolon at end of a line or whatever.  I always
recommend to people that they run the Perl script at the command line first also, then
if any errors you get an exact error and line number, easy to fix.  Likewise if you
create standalone java program with database connect, then run it at the command line,
you will get to see all the errors.  I don't think, in your case, you even know that
the problem is the database connect, it could be any problem.  Also, ALWAYS use
connect, class.for.name, etc. in try - catch blocks, with the appropriate exception
caught and printed, then you will see the error for sure.

david hall


John Hicks wrote:

> Hi Steven:
>
> If this example helps, our servlets connect to DB2 v6 from WebSphere v3 on
> Windows 2000 Server like so:
>
>         //from .props file
>         fConnectionPool.fJDBCdriver = fJDBCdriver;
>         fConnectionPool.fDatabase = fDatabase;
>         fConnectionPool.fDBUser = fDBUser;
>         fConnectionPool.fDBUserPassword = fDBUserPassword;
>       ...
>
> #
> #    JDBC
> #
> #JDBCdriver=COM.ibm.db2.jdbc.app.DB2Driver
> JDBCdriver=COM.ibm.db2.jdbc.app.DB2Driver
> #Database(or "JDBCConnectionURL")=jdbc:db2:SAMPLE
> Database=jdbc:db2:TFHDEV
> #UserId
> User=<UserID>
> #password
> Using=<password>
>         ...
>
>         //check properties
>         if(fJDBCdriver == null)
>             throw new Exception( iTimeStamp.getString() + " JDBCDriver property not
> found.");
>
>         if(fDatabase == null)
>             throw new Exception( iTimeStamp.getString() + " Database
> (JDBCConnectionURL) property not found.");
>       ...
>
>         //echo our settings
>         trace("JDBCdriver = " + fJDBCdriver);
>         trace("Database (JDBCConnectionURL) = " + fDatabase);
>       ...
>
>         // when instantiated, driver registers with the DriverManager
>         trace("Registering " + fJDBCdriver);
>         Class.forName(fJDBCdriver).newInstance();
>
>       PooledConnection pooledConnection = new PooledConnection();
>         pooledConnection.fConnection =
> java.sql.DriverManager.getConnection(fDatabase,fDBUser,fDBUserPassword);
>       ...
>
> John Hicks
> ceriumworks.com
> XMLOutline XMLdb XMLServlet
>
> -----Original Message-----
> From: A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
> Stephen Casey
> Sent: Wednesday, September 13, 2000 2:59 PM
> To: [EMAIL PROTECTED]
> Subject: JDBC desperation
>
> I am fighting a war here to introduce Java Servlets as an alternative to
> CGI/Active Server Pages.
>
> I am desperate to get my java servlet to connect to our Oracle database. My
> environment is as follows:
>
> Oracle 8.16 on IBM RS6000 (Unix) (with TCP/IP listner)
> Microsoft Win2000 Adv Server running IIS 5 web server
> JRun 3.0 Servlet engine
> JRE 1.2 (from JRun 3 install)
> Visual Cafe 3c IDE
>
> Can you tell me what JDBC driver (OCI/Thin?) I should use in my servlets to
> connect to Oracle 8i? I have tried using the 8.16 thin driver. I have placed
> both zipped and unzipped paths in my CLASSPATH and PATH environmental
> variables.
> I have tried both DriveManager.registerDriver and Class.forName.
>
> DriveManager.registerDriver( new oracle.jdbc.driver.OracleDriver()); will
> produce the following error:
>
> 500 Internal Server Error
> javax.servlet.ServletException: oracle/jdbc/driver/OracleDriver
> java.lang.NoClassDefFoundError: oracle/jdbc/driver/OracleDriver
>
> Any ideas or anyplace you can recommend for help?
>
> ?'s - Stephen 1-907-263-4315
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to