The ClassPath of the http server is exactly the same as I am useing in my
command prompy environment.
I am using Suns's default http server that comes within the j2ee package.
----- Original Message -----
From: "F. Scott Johnson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, October 16, 2001 16:54
Subject: Re: ms access driver in a servlet
> Hi,
> You probably just need to make sure the classpath
> that the http server is using is the same as the
> one that you have during the command line session.
> The odbc drivers are possibly missing from the
> http server servlet environment. What http
> server are you using?
>
> -Scott
>
> ----- Original Message -----
> From: "Mehmet Gurmen" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, October 16, 2001 4:36 PM
> Subject: Re: ms access driver in a servlet
>
>
> > Attached is the code:
> > Please note that this code works within a command line if I add
> > main(string[]) function.
> > There is no problem with setting up the dsn or odbc. I havent figured
out
> > why it does not work within a servlet?
> > --------------------------------------------------------
> > import java.io.*;
> > import java.sql.*;
> > import javax.servlet.*;
> > import javax.servlet.http.*;
> >
> > public class tappDisplay extends HttpServlet {
> >
> > public void init()
> > {
> > try{
> > Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
> > }catch(Exception e){e.printStackTrace();}
> > }
> >
> > public void doGet(HttpServletRequest req, HttpServletResponse res)
> > throws ServletException, IOException {
> >
> >
> > Connection con = null;
> > Statement stmt = null;
> > String sUserType = null;
> > String sUserIsAuthorized = null;
> > ResultSet rs = null;
> > HttpSession ses = req.getSession(true);
> >
> > res.setContentType("text/html");
> > PrintWriter out = res.getWriter();
> >
> > try {
> >
> > out.println("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0
> > Transitional//EN'
> > 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>");
> > out.println("<html>");
> > out.println(" <head>");
> > out.println("<title></title>");
> > out.println("<meta http-equiv='Content-Type' content='text/html;
> > charset=windows-1252' />");
> > out.println("<meta name='Keywords' content='' />");
> > out.println("<meta name='Description' content='' />");
> > out.println("<meta http-equiv='pragma' content='no-cache' />");
> > out.println("<meta http-equiv='cache-control' content='no-cache'
> > />");
> > out.println("<link rel='stylesheet' type='text/css'
href='/std.css'
> > />");
> > out.println("</head>");
> > out.println("<body>");
> >
> >
> > //Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
> > //con =
> DriverManager.getConnection("jdbc:odbc:dsn_customers","","");
> > java.util.Enumeration en = DriverManager.getDrivers();
> > while(en.hasMoreElements())
> > {
> > Driver s = (Driver) en.nextElement();
> > out.println("["+s.toString()+"]");
> > }
> >
> > con = DriverManager.getConnection("jdbc:odbc:ex");
> >
> >
> > stmt = con.createStatement();
> > rs = stmt.executeQuery("SELECT * FROM [T_IND]");
> > out.println("<table><tr>");
> > out.println("<th>NAME</th>");
> > out.println("<th>STREET</th>");
> > out.println("<th>CITY</th>");
> > out.println("<th>STATE</th>");
> > out.println("<th>ZIP</th>");
> > out.println("<th>MYDATE</th>");
> > out.println("<th>SOURCE</th>");
> > out.println("<th>ETHNIC</th>");
> > out.println("<th>EMAIL</th>");
> > out.println("<th>PRIMID</th>");
> > out.println(" </tr><tr> ");
> > while (rs.next())
> > {
> >
> > String sNAME = rs.getString("NAME");
> > String sSTREET = rs.getString("STREET");
> > String sCITY = rs.getString("CITY");
> > String sSTATE = rs.getString("STATE");
> > String sZIP = rs.getString("ZIP");
> > String sMYDATE = rs.getString("MYDATE");
> > String sSOURCE = rs.getString("SOURCE");
> > String sETHNIC = rs.getString("ETHNIC");
> > String sEMAIL = rs.getString("EMAIL");
> > String sPRIMID = rs.getString("PRIMID");
> >
> > out.println(" <tr> ");
> > out.println("<td align=left>" + sNAME + "</td>");
> > out.println("<td align=left>" + sSTREET + "</td>");
> > out.println("<td align=left>" + sCITY + "</td>");
> > out.println("<td align=left>" + sSTATE + "</td>");
> > out.println("<td align=left>" + sZIP + "</td>");
> > out.println("<td align=left>" + sMYDATE + "</td>");
> > out.println("<td align=left>" + sSOURCE + "</td>");
> > out.println("<td align=left>" + sETHNIC + "</td>");
> > out.println("<td align=left>" + sEMAIL + "</td>");
> > out.println("<td align=left>" + sPRIMID + "</td>");
> > out.println("</tr>");
> >
> > }
> >
> > out.println("</table>");
> > out.println("</body></html>");
> > }
> >
> >
> > catch(SQLException e)
> > {
> > e.printStackTrace(out);
> > //out.println("SQL Error: "+ e.getMessage());
> > }
> > finally
> > {
> > try
> > {
> > if (con != null) con.close();
> > }
> > catch (SQLException ignored) { }
> >
> > }
> > }
> >
> > }
> >
> > --------------------------------------------------------
> >
> >
> > check
> > whether driver is there in the class path used by webserver or not.
> > check whether u have registered the driver with Database Manger or
> > not in the init or static method.
> >
> >
> > Regards
> > sathya
> >
> > -----Original Message-----
> > From: Mehmet Gurmen [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, October 16, 2001 12:04 AM
> > To: [EMAIL PROTECTED]
> > Subject: ms access driver in a servlet
> >
> >
> > Hi all,
> >
> > I have installed j2ee including Sun's web server on a win2K
> > professional.
> > I wrote a simple servlet that gets a resultset from an ms access 2000
> > database which I use the odbc-jdbc driver to connect to.
> > I included a main function into the servlet and the class seems to get
> > the
> > resultset when I run it within a command prompt. But when I call that as
> > a
> > servlet, it just puts into the error log "No Suitable Driver Found".
> > I do not think that there are any other drivers than that comes with the
> > j2ee form ms access. I have been developing server side applications
> > that
> > could easily connect to system dsn's but when it comes to the servlet I
> > get
> > this message. Does the servlet only accept SQL server in the dsn? Can't
> > I
> > use ms access database?
> >
> > Thanks
> >
> > ________________________________________________________________________
> > ___
> > 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
> >
> >
>
>
___________________________________________________________________________
> 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