Hi,
Did you try to run a stand alone test application to communicate from your
server(being a client) to Oracle just to see if everything is set up properly
like classpath to jdbcdriver.zip file try this
//start
import java.io.*;
import java.sql.*;
import java.util.*;
public class TestJDBCconn
{
public static void main(String[] args)
throws ClassNotFoundException, SQLException, IOException
{
// Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = null;
try
{
// Connect to the Development Database
// Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@url where
the database can be found:the database port:the database sid", "username",
"password");
// }catch(SQLException e) {System.out.println("Error "+e);}
// Register the driver
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver
());
// DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
// con =
DriverManager.getConnection("jdbc:oracle:thin:@your_oracle_server_host_name:2714
:hoststring","yourlogin","yourpassword");
System.out.print ("Connecting to the database ...");
System.out.flush ();
System.out.println ("Connecting...");
con =
DriverManager.getConnection("jdbc:oracle:thin:your_oracle_server_host_name:2714:
hoststring","yourlogin","yourpassword");
System.out.println ("Connectied");
//creating statement
Statement stmt = con.createStatement();
ResultSet rset = stmt.executeQuery("select 'Hello World'
from dual");
while (rset.next ())
System.out.println (rset.getString(1));
System.out.println ("Your JDBC installation is correct");
//Clear the existing table and create a new one
}
catch (SQLException e) {System.out.println ("Error "+ e); }
finally {
if (con !=null)
con.close();
}
}
}
//finish
> -----Original Message-----
> From: Ravi Shankar Jagarapu [SMTP:[EMAIL PROTECTED]]
> Sent: Monday, June 11, 2001 2:23 PM
> To: [EMAIL PROTECTED]
> Subject: JDBC error: java.lang.IllegalArgumentException
>
> Hi,
>
> I am new to servlets and since one week have been
> bogged down with this problem.
>
> I have been reading lots of documentation and since
> then modified my classpath etc but still getting
> errors.
>
> I want to connect to my oracle database using servlet.
>
> However on running my servlet on the TOMCAT server, I
> get the following error:
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> Error: 500
>
> Location: /hdd/servlet/EmpNo
>
> Internal Servlet Error:
>
> java.lang.IllegalArgumentException:
> oracle:jdbc.driver.OracleDriver
> at EmpNo.doGet(Compiled Code)
> at
> javax.servlet.http.HttpServlet.service(Compiled Code)
> at
> javax.servlet.http.HttpServlet.service(Compiled Code)
> at
> org.apache.tomcat.core.ServletWrapper.doService(Compiled
> Code)
> at
> org.apache.tomcat.core.Handler.service(Compiled Code)
> at
> org.apache.tomcat.core.ServletWrapper.service(Compiled
> Code)
> at
> org.apache.tomcat.core.ContextManager.internalService(Compiled
> Code)
> at
> org.apache.tomcat.core.ContextManager.service(Compiled
> Code)
> at
> org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(Compile
> d
> Code)
> at
> org.apache.tomcat.service.TcpWorkerThread.runIt(Compiled
> Code)
> at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(Compiled
> Code)
> at java.lang.Thread.run(Compiled Code)
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>
> Here is the code that I am using:
>
> import java.io.*;
> import java.sql.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
>
> public class EmpNo extends HttpServlet {
>
> public void doGet( HttpServletRequest req,
> HttpServletResponse res)
> throws ServletException, IOException {
>
> Connection con = null;
> Statement stmt = null;
> ResultSet rs = null;
>
> res.setContentType("text/html");
>
> //return early if this is a HEAD request
> if( req.getMethod().equals("HEAD") ) return;
>
> PrintWriter out = res.getWriter();
>
> try {
>
> // Load and therefore register the Oracle Driver
> //Class.forName("oracle:jdbc.driver.OracleDriver");
> DriverManager.registerDriver(new
> oracle.jdbc.driver.OracleDriver());
>
> // Get a connection to the database
> con = DriverManager.getConnection(
> "jdbc:oracle:thin:@server-name:1521:sid",
> "scott", "tiger" );
>
> // Create a statement object
> stmt = con.createStatement();
>
> // Execute a SQL query and get the result set
> rs = stmt.executeQuery("Select deptno from dept");
>
> // Display the result set as a combo list
> out.println("<html><head><title>Select the Model of
> Disk Drive</title></head>");
> out.println("<div><p>Select the Model Number of the
> Disk Drive to display Info.");
>
> // Display a FORM with the combo box
> out.println("<form action=\"/servlet/ModelNoInfo\"
> method=\"get\">");
> out.println("<select name=\"modelno\">");
>
> while( rs.next() ) {
>
> out.print("<option>" + rs.getString("modelno") );
> out.println("</option>");
>
> }//end of while
>
> out.println("<select></br>");
> out.println("<input type=\"submit\" value=\"
> GetInfo \">");
> out.println("</p></form></div>");
>
> out.println("</body></html>");
>
> }//end of try
> catch ( ClassNotFoundException e ) {
> out.println( "Couldn't load database Driver: " +
> e.getMessage() );
> }
> catch ( SQLException e ) {
> out.println( "SQLException caught: " +
> e.getMessage() );
> }
> finally {
> // Always close the database connection.
> try {
> if ( con != null ) {
> con.close();
> }
> }//end of try
> catch (SQLException ignored) { }
> }//end of finally
>
> }//end of doGet
>
> public void doPost( HttpServletRequest req,
> HttpServletResponse res)
> throws ServletException, IOException {
>
> doGet( req, res );
>
> }
>
> public String getServletInfo() {
>
> return "A servlet that returns all the model
> numbers available"
> + " in the Deliverables table";
> }//end of getServletInfo
>
> }//end of class
>
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>
> I have been trying to see the archives, but didn't
> find a solution and I am stuck with my work since I
> can't communicate with my database. Please help me!!!!
>
> Thanks in advance,
> Ravi Shankar.
>
>
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail - only $35
> a year! http://personal.mail.yahoo.com/
>
> ___________________________________________________________________________
> 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