From owner-freebsd-questions@FreeBSD.ORG Mon Aug 15 19:19:27 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4859E16A41F for ; Mon, 15 Aug 2005 19:19:27 +0000 (GMT) (envelope-from freezumba@terra.com.br) Received: from loncoche.terra.com.br (loncoche.terra.com.br [200.176.10.196]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9516D43D45 for ; Mon, 15 Aug 2005 19:19:26 +0000 (GMT) (envelope-from freezumba@terra.com.br) Received: from moroto.terra.com.br (moroto.terra.com.br [200.176.10.5]) by loncoche.terra.com.br (Postfix) with ESMTP id 27BCCD5005D for ; Mon, 15 Aug 2005 16:19:25 -0300 (BRT) X-Terra-Karma: -2% X-Terra-Hash: a1d2f02e5c886c70db96bc234aa6631a Received-SPF: pass (moroto.terra.com.br: domain of terra.com.br designates 200.176.10.5 as permitted sender) client-ip=200.176.10.5; envelope-from=freezumba@terra.com.br; helo=201-24-206-33.ctame704.dsl.brasiltelecom.net.br; Received: from 201-24-206-33.ctame704.dsl.brasiltelecom.net.br (201-24-206-33.ctame704.dsl.brasiltelecom.net.br [201.24.206.33]) (authenticated user freezumba@terra.com.br) by moroto.terra.com.br (Postfix) with ESMTP id DFFF114CC120 for ; Mon, 15 Aug 2005 16:19:24 -0300 (BRT) From: Zumba To: freebsd-questions@freebsd.org Content-Type: text/plain Date: Mon, 15 Aug 2005 16:21:08 -0300 Message-Id: <1124133668.89496.28.camel@paulo.com> Mime-Version: 1.0 X-Mailer: Evolution 2.2.1.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Subject: JDBC Driver & lookup Context X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2005 19:19:27 -0000 I'm trying to connect to mysql database using InitialContext and DataSource lookup but it not works on FreeBSD 5.4 + tomcat 5.5 + jdk 1.5.0 + mysql-connector-java.jar (3.1.0) installed from ports. The application seems that reads ok the JNDI Resources variables but when I invoke dataSource.getConnection() I get the message on SQLException: "Cannot create JDBC class for 'com.mysql.jdbc.Driver'. The fact is if I use DriverManager.getConnection("jdbc:mysql//localhost/mysql?params") without handle mysql-connector-java.jar and your directories it (com.mysql.jdbc.Driver) works fine. ---- META-INF/context.xml: ---- the reference on WEB-INF/Web.xml: jdbc/GridDB javax.sql.DataSource Container ---- servlet code: Context initialContext = new InitialContext(); Context env = (Context) initialContext.lookup("java:comp/env"); DataSource dataSource = (DataSource) env.lookup("jdbc/GridDB"); connection = dataSource.getConnection(); Thanks, Zumba