connecting jsp with mysql
Hi, I am having difficulty in connecting jsp and mysql using Tomcat 7.0 . I downloaded jdbc driver mysql-connector-java-5.1.15-bin.jar and placed it in two locations: - CATALINE_HOME\lib - C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\lsc\WEB-INF\lib I tried to connect using the following code but it always says:Cannot connect to database server. Do i need to make any configurations apart from this ? I tried to connect with the following code: %@page language=java import=java.sql.*% % Connection conn = null; try { String userName = root; String password = nbuser; String url = jdbc:mysql://localhost:3306/test; Class.forName (com.mysql.jdbc.Driver).newInstance (); conn = DriverManager.getConnection (url, userName, password); out.println (Database connection established); } catch (Exception e) { out.println (Cannot connect to database server); } finally { if (conn != null) { try { conn.close (); out.println (Database connection terminated); } catch (Exception e) { /* ignore close errors */ } } } %
Re: connecting jsp with mysql
Hi, out.println (Cannot connect to database server message +e.getMessage()); This gives following error msg: Cannot connect to database server com.mysql.jdbc.Driver. I am using windows 7. On Mon, Feb 21, 2011 at 8:44 AM, Martin Gainty mgai...@hotmail.com wrote: 1)putting a lightly loaded engine light on text message is neither helpful nor delivers any useful information to those of us trying to determine your error always include the message from the exception object e.g. out.println (Cannot connect to database server message=+e.getMessage()); 2) netstat -a | grep 3306 if you dont see tcp connection displayed on your output then mysql daemon is down..restart it 3)never put username and password on emails ..this is not a secure way to do business btw try implementing the same username to get into mysql $MYSQL_HOME/bin/mysql.exe --host=localhost --user=whatever_user --password=whatever_password --host=localhost Martin Gainty __ Jogi és Bizalmassági kinyilatkoztatás/Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Ez az üzenet bizalmas. Ha nem ön az akinek szánva volt, akkor kérjük, hogy jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának készítése nem megengedett. Ez az üzenet csak ismeret cserét szolgál és semmiféle jogi alkalmazhatósága sincs. Mivel az electronikus üzenetek könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet ezen üzenet tartalma miatt. 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. Date: Mon, 21 Feb 2011 07:55:05 -0600 Subject: connecting jsp with mysql From: anup.niro...@gmail.com To: users@tomcat.apache.org Hi, I am having difficulty in connecting jsp and mysql using Tomcat 7.0 . I downloaded jdbc driver mysql-connector-java-5.1.15-bin.jar and placed it in two locations: - CATALINE_HOME\lib - C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\lsc\WEB-INF\lib I tried to connect using the following code but it always says:Cannot connect to database server. Do i need to make any configurations apart from this ? I tried to connect with the following code: %@page language=java import=java.sql.*% % Connection conn = null; try { String userName = root; String password = nbuser; String url = jdbc:mysql://localhost:3306/test; Class.forName (com.mysql.jdbc.Driver).newInstance (); conn = DriverManager.getConnection (url, userName, password); out.println (Database connection established); } catch (Exception e) { out.println (Cannot connect to database server); } finally { if (conn != null) { try { conn.close (); out.println (Database connection terminated); } catch (Exception e) { /* ignore close errors */ } } } %
hi
Hi, How can i configure my localhost:8080 tomcat so that the site could be accessible through ip address by other computers in the network. Sincerely, Anup
Re: hi
Hi, Thanx for the reply. Is there any way i can provide domain namewww.abc.cominstead of ip address to be accessed with in network. ? Sincerely, Anup On Wed, Feb 16, 2011 at 12:48 PM, Caldarale, Charles R chuck.caldar...@unisys.com wrote: From: Anup Niroula [mailto:anup.niro...@gmail.com] Subject: hi How can i configure my localhost:8080 tomcat so that the site could be accessible through ip address by other computers in the network. Assuming there are no firewalls in the way, you already have. The other computers would access your site via: http://your_ip_address:8080 Nothing else is needed. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: hi
Hi, could you please explain me in detail. How can i provide a domain name for my website like www.lsctesting.com using tomcat 7 to be accessed in the network. Sincerely, Anup On Wed, Feb 16, 2011 at 1:07 PM, David kerber dcker...@verizon.net wrote: On 2/16/2011 2:04 PM, Anup Niroula wrote: Hi, Thanx for the reply. Is there any way i can provide domain namewww.abc.cominstead of ip address to be accessed with in network. ? If your internal dns server will resolve it to the correct ip address, it will work. Sincerely, Anup On Wed, Feb 16, 2011 at 12:48 PM, Caldarale, Charles R chuck.caldar...@unisys.com wrote: From: Anup Niroula [mailto:anup.niro...@gmail.com] Subject: hi How can i configure my localhost:8080 tomcat so that the site could be accessible through ip address by other computers in the network. Assuming there are no firewalls in the way, you already have. The other computers would access your site via: http://your_ip_address:8080 Nothing else is needed. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Help needed on apache tomcat 7.0
hi, Actually, i am trying to include jar file in apache tomcat server so that i can access the classes of the jar file to use it in my jsp pages (web application). How can i do this ? Any help would be appreciated. Regards, Anup Niroula
Re: Help needed on apache tomcat 7.0
Hi, Thank you for the reply. I am new to JSP and i am using tomcat server 7.0 for the first time. could you please tell me where can i find examples of web applications importing classes from jar file ? On Fri, Jan 28, 2011 at 1:46 PM, Caldarale, Charles R chuck.caldar...@unisys.com wrote: From: Anup Niroula [mailto:anup.niro...@gmail.com] Subject: Help needed on apache tomcat 7.0 Actually, i am trying to include jar file in apache tomcat server so that i can access the classes of the jar file to use it in my jsp pages (web application). How can i do this ? Long answer: read the servlet spec; it details exactly what the structure of a webapp is, including where to place jar files for the webapp. Short answer: in your webapp's WEB-INF/lib directory. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Help needed on apache tomcat 7.0
Thanx On Fri, Jan 28, 2011 at 2:21 PM, Caldarale, Charles R chuck.caldar...@unisys.com wrote: From: Anup Niroula [mailto:anup.niro...@gmail.com] Subject: Re: Help needed on apache tomcat 7.0 could you please tell me where can i find examples of web applications importing classes from jar file ? In several of the example webapps that come with the Tomcat distribution. Look in webapps/examples. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org