Return-Path: Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 32293 invoked from network); 3 Sep 2003 20:00:39 -0000 Received: from unknown (HELO web10303.mail.yahoo.com) (216.136.130.81) by daedalus.apache.org with SMTP; 3 Sep 2003 20:00:39 -0000 Message-ID: <20030903200042.20893.qmail@web10303.mail.yahoo.com> Received: from [217.81.130.167] by web10303.mail.yahoo.com via HTTP; Wed, 03 Sep 2003 22:00:42 CEST Date: Wed, 3 Sep 2003 22:00:42 +0200 (CEST) From: =?iso-8859-1?q?Bruno=20Armand?= Subject: Re: jdbcodbc database connection problem (access-DB,jsp,tomcat,eclipse)! To: Tomcat Users List In-Reply-To: <3F564301.7060101@mkodo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Hello Jon, In the file tomcat../log/stdout, this error information can be found: " SQLException: SQLState: IM002 Nachricht: [Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben. Anbieter: 0 there was error " By testing myself, i realise that, after the Connection con = .... statement, no html-code can be displayed. But before it, it`s possible. The problem is now to know to make the connection to the database correctly. But at this level, i don`t have so many experience, only because i am a beginner... I hope you understand what i mind. Thank! Bruno --- Jon Wingfield schrieb: > Very difficult to tell ;) > > Do you have any errors in the tomcat logs? > Does your debug in the SQLException catch clause get > written to std out > or catalina.out? > If a SQLException did get thrown during the > inserts/select the output > would be: > > > > > > > > Not quite sure how that would be rendered in a > browser. > > Are you sure you can load the jdbc driver? A > ClassNotFoundException can > be thrown from Class.forName(...) > > Are you sure you are getting a connection to the > database? Is your > connection url correct? Also, the JdbcOdbcBridge has > always been flaky > at best. > > > I would recommend removing as much java code as > possible from the jsp > and use Beans or taglibs for the database access. It > should make the jsp > code a lot cleaner. For another thing it makes > testing a lot easier :) > > HTH, > > Jon > > Bruno Armand wrote: > > > Now, > > > > i correct all the errors (As you see n the code > > below), but the jsp-page ist displayed, but > without > > anything written (from html or database.). Can you > > know why please? > > > > Thank! > > > > --- Jon Wingfield > schrieb: > > > >>try > >><%= rs.getString(i) %> > >>instead of > >><% = rs.getString(i) %> > >> > >> > >>Bruno Armand wrote: > >> > >> > >>>Please i try since one week to become this > program > >>>without error, but without success. Perrhaps can > >> > >>you > >> > >>>help me! > >>> > >>>I write a jsp-file for calling and saving data > >> > >>from an > >> > >>>access existing database which i connect with a > >>>odbc-driver. > >>>The adrList.jsp ist in the directory > >>>c:\eclipse\workspace\projectX\ > >>>I try to start it from tomcat with > >>>http://localhost:8080/student. > >>>The file HelloWorld.jsp in the same directory > runs > >>>without problem. > >>> > >>>Please here are: > >>>1. The code of the adrList.jsp and > >>>2. The displayed errormessage. > >>>__________________________________- > >>>1. > >>> > >>> > >>><%@ page language="java" import = "java.sql.*" %> > >>><%@ page import = "java.lang.*" %> > >>><% > >>>try > >>>{ > >>> Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); > > > > String username = ""; > > String password = ""; > > String url = "jdbc:odbc:Bruno_Adress_odbc"; > > Connection con = > DriverManager.getConnection(url, > > username,password); > > > > > >>>String sql1 = "INSERT INTO Adressen (Nachname, > >>>Adresse," + > >>> " Postleitzahl, Land, Ort)" + > >>> " VALUES ('Bruno Armando', 'Am Vaihingen 20', > >>>'70187', " + > >>>"'Deutschland', 'Stuttgart')"; > >>> > >>>String sql2 = "INSERT INTO Adressen (Nachname, > >>>Adresse,"+ > >>> " Postleitzahl, Land, Ort) " + > >>> "VALUES ('Becker Marlise', 'Koenigstr 78', > >> > >>'70174', > >> > >>>"+ > >>>"'Deutschland', 'Stuttgart')"; > >>> > >>>String query = "SELECT * FROM Adressen"; > >>> > >>>Statement stmt = con.createStatement(); > >>> > >>>stmt.executeUpdate(sql1); > >>>stmt.executeUpdate(sql2); > >>>ResultSet rs = stmt.executeQuery(query); > >>>ResultSetMetaData rsmd = rs.getMetaData(); > >>>int columnCount = rsmd.getColumnCount(); > >>>%> > >>> > >>>Details-Adressen von den 5 Besten > >>> > >>> > >>> > >>> >>>cellSpacing=5 cellPadding=2 bgcolor="#0000FF" > >>>bordercolor="#000000"> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>><% > >>>while (rs.next()) > >>>{ > >>>%> > >>> > >>> > >>> > >>><% > >>> for (int i = 2; i <= columnCount; i++) > >>>%> > >>> > >>><% > >>>} > >>>%> > >>>
> >>><% > >>>} > >>>rs.close(); > >>>stmt.close(); > >>>con.close(); > >>>} > >>>catch (SQLException ex) > >>>{ > >>> System.out.println("SQLException:"); > >>> while (ex != null) > >>> { > >>> System.out.println("SQLState: " + > >>>ex.getSQLState()); > >>> System.out.println("Nachricht: " + > >>>ex.getMessage()); > >>> System.out.println("Anbieter: " + > >>>ex.getErrorCode()); > >>> ex = ex.getNextException(); > >>> System.out.println(""); > >>>} > > > > } > > > >>>%> > >>>
  > >>>   > >>> Name Street Zip Town Country
    > >>> <%= rs.getString(i) %> > >>>
> >>> > >>> > === message truncated === __________________________________________________________________ Gesendet von Yahoo! Mail - http://mail.yahoo.de Logos und Klingelt�ne f�rs Handy bei http://sms.yahoo.de