sorted!
thanks brian, i'll buy u a drink if i ever go to the states!! cheers >From: Brian Adams <[EMAIL PROTECTED]> >Reply-To: "Tomcat Users List" <[EMAIL PROTECTED]> >To: 'Tomcat Users List' <[EMAIL PROTECTED]> >Subject: RE: JDBC >Date: Mon, 11 Feb 2002 06:53:58 -0600 > >where did you put your jdbc driver jar? mine is named jdbc7.0-1.2.jar and >it is in my tomcat's common\lib directory. >B > >-----Original Message----- >From: vinny patel [mailto:[EMAIL PROTECTED]] >Sent: Monday, February 11, 2002 6:48 AM >To: [EMAIL PROTECTED] >Subject: RE: JDBC > > >this is the error message > >************************** >Cant find database Driver class: java.lang.ClassNotFoundException: >postgresql.Driver >SQL Exception java.sql.SQLException: No suitable driver >************************** > >and heres the coding > >************************* >import java.io.*; >import java.sql.*; >import javax.servlet.*; >import javax.servlet.http.*; > > public class hotellist extends HttpServlet > { > public void doGet(HttpServletRequest req, > HttpServletResponse res) > throws ServletException, IOException > { > res.setContentType("text/html"); > PrintWriter out = res.getWriter(); > String url = > "jdbc:postgresql://dcsun2/dwt"; > String query = " select name,city from hotels order by city,name"; > > out.println("<HTML>"); > out.println("<BODY>"); > > > try > { > Class.forName("postgresql.Driver"); > } > catch(java.lang.ClassNotFoundException ex1) > { > out.println("Cant find database Driver class: " + ex1 +"<BR>"); > } > > try{ > Connection con = >DriverManager.getConnection(url,"wwwuser","wwwuser"); > Statement stmt = con.createStatement(); > ResultSet rs =stmt.executeQuery(query); > out.println("<P> <STRONG>Hotel --- City</STRONG>"); > while (rs.next()) > { > String hotelName = rs.getString(1); > String cityName = rs.getString(2); > out.println("<BR> " + hotelName + " , " + cityName); > } > out.println("</P>"); > stmt.close(); > con.close(); > } > catch(SQLException ex2) > { > out.println("SQL Exception " + ex2); > } > out.println("</HTML>"); > out.println("</BODY>"); > } >} > > >******************************* > >i believe it's something to do with the postgres driver? > >cheers > > > >From: Brian Adams <[EMAIL PROTECTED]> > >Reply-To: "Tomcat Users List" <[EMAIL PROTECTED]> > >To: 'Tomcat Users List' <[EMAIL PROTECTED]> > >Subject: RE: JDBC > >Date: Mon, 11 Feb 2002 06:33:35 -0600 > > > >what problems are you having? can you post an error or code or both? > >B > > > >-----Original Message----- > >From: vinny patel [mailto:[EMAIL PROTECTED]] > >Sent: Monday, February 11, 2002 3:48 AM > >To: [EMAIL PROTECTED] > >Subject: JDBC > > > > > >I am having problems with my servlets that connect to a postgres > >database. I am using the Tomcat 4, if anyone has any suggestions, i would > >be > > > >gratefull! > > > >thanks > > > >_________________________________________________________________ > >Join the world's largest e-mail service with MSN Hotmail. > >http://www.hotmail.com > > > > > >-- > >To unsubscribe: <mailto:[EMAIL PROTECTED]> > >For additional commands: <mailto:[EMAIL PROTECTED]> > >Troubles with the list: <mailto:[EMAIL PROTECTED]> > > > >-- > >To unsubscribe: <mailto:[EMAIL PROTECTED]> > >For additional commands: <mailto:[EMAIL PROTECTED]> > >Troubles with the list: <mailto:[EMAIL PROTECTED]> > > > > >_________________________________________________________________ >Join the world's largest e-mail service with MSN Hotmail. >http://www.hotmail.com > > >-- >To unsubscribe: <mailto:[EMAIL PROTECTED]> >For additional commands: <mailto:[EMAIL PROTECTED]> >Troubles with the list: <mailto:[EMAIL PROTECTED]> > >-- >To unsubscribe: <mailto:[EMAIL PROTECTED]> >For additional commands: <mailto:[EMAIL PROTECTED]> >Troubles with the list: <mailto:[EMAIL PROTECTED]> > _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- To unsubscribe: <mailto:[EMAIL PROTECTED]> For additional commands: <mailto:[EMAIL PROTECTED]> Troubles with the list: <mailto:[EMAIL PROTECTED]>