Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 50242 invoked from network); 26 May 2010 13:54:16 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 26 May 2010 13:54:16 -0000 Received: (qmail 54282 invoked by uid 500); 26 May 2010 13:54:14 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 54247 invoked by uid 500); 26 May 2010 13:54:14 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 54238 invoked by uid 99); 26 May 2010 13:54:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 May 2010 13:54:14 +0000 X-ASF-Spam-Status: No, hits=2.6 required=10.0 tests=AWL,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mgainty@hotmail.com designates 65.55.111.100 as permitted sender) Received: from [65.55.111.100] (HELO blu0-omc2-s25.blu0.hotmail.com) (65.55.111.100) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 May 2010 13:54:07 +0000 Received: from BLU142-W20 ([65.55.111.73]) by blu0-omc2-s25.blu0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 26 May 2010 06:53:46 -0700 Message-ID: Content-Type: multipart/alternative; boundary="_2e8fc435-b386-4f48-8981-354bd10b55c3_" X-Originating-IP: [71.232.74.24] From: Martin Gainty To: Struts Users Mailing List Subject: RE: PersistenceFacade Date: Wed, 26 May 2010 09:53:46 -0400 Importance: Normal In-Reply-To: <10091.194.6.79.200.1274881194.squirrel@mail.chrismiles.org> References: <20100526133051.A5436816018@nike.apache.org>,<10091.194.6.79.200.1274881194.squirrel@mail.chrismiles.org> MIME-Version: 1.0 X-OriginalArrivalTime: 26 May 2010 13:53:46.0859 (UTC) FILETIME=[DCA8A3B0:01CAFCDA] --_2e8fc435-b386-4f48-8981-354bd10b55c3_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable i would strongly suggest you re-consider *not* publishing the username/pass= word to your database.. in fact changing the username/password asap (if someone can ping your mailing address IP and append 3306 they can might= be able access your database) =20 suppose: your host is NewOrleansCommandCenterHost your DB name is DeepWaterHorizonDB your username is TonyHayward your password is PlugTheHole =20 then the dbUrl =3D //jdbc:msql://NewOrleansCommandCenterHost:3306/DeepWater= HorizonDB?user=3DTonyHayward&password=3DPlugTheHole =20 //and you could connect in using a thin Type4 driver with java.util.Properties urlProps =3D new com.mysql.jdbc.NonRegisteringDriver()= .parseURL(dbUrl=2C null)=3B =20 something to think about Martin Gainty=20 ______________________________________________=20 Verzicht und Vertraulichkeitanmerkung/Note de d=E9ni et de confidentialit= =E9 Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaeng= er sein=2C so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiter= leitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient l= ediglich dem Austausch von Informationen und entfaltet keine rechtliche Bin= dungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen w= ir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut =EAtre privil=E9gi=E9. Si vous n'=EAtes= pas le destinataire pr=E9vu=2C nous te demandons avec bont=E9 que pour sat= isfaire informez l'exp=E9diteur. N'importe quelle diffusion non autoris=E9e= ou la copie de ceci est interdite. Ce message sert =E0 l'information seule= ment et n'aura pas n'importe quel effet l=E9galement obligatoire. =C9tant d= onn=E9 que les email peuvent facilement =EAtre sujets =E0 la manipulation= =2C nous ne pouvons accepter aucune responsabilit=E9 pour le contenu fourni= . =20 > From: chris@chrismiles.org > Date: Wed=2C 26 May 2010 09:39:54 -0400 > Subject: Re: PersistenceFacade > To: user@struts.apache.org >=20 > Hi=2C >=20 > You would need to post your strack trace and where the problem happens. >=20 > Chris >=20 > > Hi. > > > > > > > > I have used the following code with struts 1.2x and it works just fine. > > Now > > I have upgraded to Struts 1.3.10. > > > > > > > > Now I get the following error when I try to login to my Struts app. > > > > > > > > Can anybody point me in the right direction. > > > > > > > > Soren=2C DK > > > > > > > > The Code: > > > > > > > > package nc.persistence=3B > > > > > > > > import java.sql.Connection=3B > > > > import java.sql.SQLException=3B > > > > import javax.servlet.http.HttpServlet=3B > > > > import java.sql.DriverManager=3B > > > > > > > > public class PersistenceFacade { > > > > > > > > //----------- fields ---------// > > > > > > > > public static final String CONNECTION_DRIVER =3D > > "org.gjt.mm.mysql.Driver"=3B > > > > public static final String CONNECTION_USER =3D > > "username"=3B > > > > public static final String CONNECTION_PASS =3D > > "password"=3B > > > > public static final String CONNECTION_URL =3D > > "url"=3B > > > > > > > > static { > > > > try { > > > > Class.forName(CONNECTION_DRIVER)=3B > > > > } catch (ClassNotFoundException ex) { > > > > > > ex.printStackTrace()=3B > > > > } > > > > } > > > > > > > > private String connectionUrl =3D null=3B > > > > private String connectionUser =3D null=3B > > > > private String connectionPass =3D null=3B > > > > > > > > > > > > > > > > //------------ constructors -----------// > > > > > > > > //public PersistenceFacade() {} > > > > > > > > public PersistenceFacade(HttpServlet servlet) { > > > > connectionUser =3D > > servlet.getInitParameter(CONNECTION_USER)=3B > > > > connectionPass =3D > > servlet.getInitParameter(CONNECTION_PASS)=3B > > > > connectionUrl =3D > > servlet.getInitParameter(CONNECTION_URL)=3B > > > > } > > > > > > > > //------------- public methods -----------// > > > > > > > > public Connection getConnection() throws > > SQLException > > { > > > > if(connectionUser =3D=3D null) { > > > > throw new > > SQLException("Missing parameter "+CONNECTION_USER)=3B > > > > } else if(connectionPass =3D=3D > > null) { > > > > throw new > > SQLException("Missing parameter "+CONNECTION_PASS)=3B > > > > } else if(connectionUrl =3D=3D > > null) > > { > > > > throw new > > SQLException("Missing parameter "+CONNECTION_URL)=3B > > > > } > > > > return > > DriverManager.getConnection( > > > > > > connectionUrl=2C > > > > > > connectionUser=2C > > > > > > connectionPass > > > > )=3B > > > > } > > > > > > > > public void closeConnection(Connection conn) { > > > > try { > > > > if(!conn.isClosed()) { > > > > conn.close()=3B > > > > } > > > > } catch (SQLException ex) { > > > > > > ex.printStackTrace()=3B > > > > } > > > > } > > > > > > > > //------------ private methods ----------// > > > > } > > > > >=20 >=20 > --------------------------------------------------------------------- > To unsubscribe=2C e-mail: user-unsubscribe@struts.apache.org > For additional commands=2C e-mail: user-help@struts.apache.org >=20 =20 _________________________________________________________________ The New Busy is not the too busy. Combine all your e-mail accounts with Hot= mail. http://www.windowslive.com/campaign/thenewbusy?tile=3Dmultiaccount&ocid=3DP= ID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4= --_2e8fc435-b386-4f48-8981-354bd10b55c3_--