i would strongly suggest you re-consider *not* publishing the username/password 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)
suppose: your host is NewOrleansCommandCenterHost your DB name is DeepWaterHorizonDB your username is TonyHayward your password is PlugTheHole then the dbUrl = //jdbc:msql://NewOrleansCommandCenterHost:3306/DeepWaterHorizonDB?user=TonyHayward&password=PlugTheHole //and you could connect in using a thin Type4 driver with java.util.Properties urlProps = new com.mysql.jdbc.NonRegisteringDriver().parseURL(dbUrl, null); something to think about Martin Gainty ______________________________________________ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > From: ch...@chrismiles.org > Date: Wed, 26 May 2010 09:39:54 -0400 > Subject: Re: PersistenceFacade > To: user@struts.apache.org > > Hi, > > You would need to post your strack trace and where the problem happens. > > Chris > > > 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, DK > > > > > > > > The Code: > > > > > > > > package nc.persistence; > > > > > > > > import java.sql.Connection; > > > > import java.sql.SQLException; > > > > import javax.servlet.http.HttpServlet; > > > > import java.sql.DriverManager; > > > > > > > > public class PersistenceFacade { > > > > > > > > //----------- fields ---------// > > > > > > > > public static final String CONNECTION_DRIVER = > > "org.gjt.mm.mysql.Driver"; > > > > public static final String CONNECTION_USER = > > "username"; > > > > public static final String CONNECTION_PASS = > > "password"; > > > > public static final String CONNECTION_URL = > > "url"; > > > > > > > > static { > > > > try { > > > > Class.forName(CONNECTION_DRIVER); > > > > } catch (ClassNotFoundException ex) { > > > > > > ex.printStackTrace(); > > > > } > > > > } > > > > > > > > private String connectionUrl = null; > > > > private String connectionUser = null; > > > > private String connectionPass = null; > > > > > > > > > > > > > > > > //------------ constructors -----------// > > > > > > > > //public PersistenceFacade() {} > > > > > > > > public PersistenceFacade(HttpServlet servlet) { > > > > connectionUser = > > servlet.getInitParameter(CONNECTION_USER); > > > > connectionPass = > > servlet.getInitParameter(CONNECTION_PASS); > > > > connectionUrl = > > servlet.getInitParameter(CONNECTION_URL); > > > > } > > > > > > > > //------------- public methods -----------// > > > > > > > > public Connection getConnection() throws > > SQLException > > { > > > > if(connectionUser == null) { > > > > throw new > > SQLException("Missing parameter "+CONNECTION_USER); > > > > } else if(connectionPass == > > null) { > > > > throw new > > SQLException("Missing parameter "+CONNECTION_PASS); > > > > } else if(connectionUrl == > > null) > > { > > > > throw new > > SQLException("Missing parameter "+CONNECTION_URL); > > > > } > > > > return > > DriverManager.getConnection( > > > > > > connectionUrl, > > > > > > connectionUser, > > > > > > connectionPass > > > > ); > > > > } > > > > > > > > public void closeConnection(Connection conn) { > > > > try { > > > > if(!conn.isClosed()) { > > > > conn.close(); > > > > } > > > > } catch (SQLException ex) { > > > > > > ex.printStackTrace(); > > > > } > > > > } > > > > > > > > //------------ private methods ----------// > > > > } > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > _________________________________________________________________ The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail. http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4