Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 60016 invoked from network); 10 Jun 2002 12:56:22 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 10 Jun 2002 12:56:22 -0000 Received: (qmail 8718 invoked by uid 97); 10 Jun 2002 12:56:02 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@jakarta.apache.org Received: (qmail 8596 invoked by uid 97); 10 Jun 2002 12:56:01 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 8467 invoked by uid 98); 10 Jun 2002 12:56:01 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) Message-ID: <00eb01c2107d$bb6b8f20$a347fc93@dmc.dit.ie> From: "John McAuley" To: Subject: Urgent help -- Microsoft SQL SERVER connection Date: Mon, 10 Jun 2002 13:52:52 +0100 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_00E8_01C21086.1D282EF0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N ------=_NextPart_000_00E8_01C21086.1D282EF0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi folks, I am trying to use Microsoft's jdbc driver for ms sql with Tomcat = and am running into trouble with the JNDI lookup method. I look for a = datasource and get null. If I use the class.forname method the driver = is found and works perfectly but I am unable to get it working with the = JNDI look up, This is very frustrating and seems to crop up a couple of = times with fellow users. Any thoughts ?? Help much appreciated. John Server.xml user user password password driverClassName = com.microsoft.jdbc.sqlserver.SQLServerDriver driverName = jdbc:microsoft:sqlserver://IP-ADDRESS-of-server:1433 web.xml Resource reference to a factory for = java.sql.Connection instances that may be used for talking to a particular database that is configured in the server.xml file. jdbc/ToolsDB javax.sql.DataSource Container Code Snippet Context ctx =3D new InitialContext(); Context envCtx =3D = (Context)ctx.lookup("java:comp/env"); out.println("Got first context."); NamingEnumeration enum = =3Dctx.listBindings("java:comp/env/jdbc"); while( enum.hasMore() ) { out.println("Binding: " + = ((Binding)enum.next()).toString() + "
"); } DataSource ds =3D = (DataSource)envCtx.lookup("jdbc/ToolsDB"); out.println("Got the second context." + "
" + = "
"); if (ds !=3D null) { out.println("Getting the connection from the = context."); Connection connection =3D ds.getConnection(); }else{ out.println("not working"); } ------=_NextPart_000_00E8_01C21086.1D282EF0--