6 thoughts on “Login Example: JSP and Servlets: Part III.”

  1. Nikhil,

    I’ve been struggling with this type of problem for days, trying to execute a simple login/user verification routine. Your example code was the simplest I’ve found that allowed me to understand and then troubleshoot the code until I could succeed.

    I’m using Eclipse/WTP/Apache Derby Plugin and Tomcat6 on a Linux platform. Following your instructions exactly, I was continually getting connection failures – first ClassNotFoundExceptions and then SQLExceptions, because the database could not be found. These are the changes I had to make to your ConnectionManager to get the code to successfully connect to the database and verify a user’s login:

    [code]
    // changed from “jdbc:mysql://localhost:3306/”
    // then moved derby.jar to the /usr/share/tomcat6 directory,
    // my tomcat6 installation directory
    String url = “jdbc:derby:”;

    // had to include the full pathname to the database. i know this
    // should be simpler, but i’m tired of playing with it tonight.
    String dbName = “/home/gregb/Documents/Programming/Workspaces/javaeetutorial/LoginExample/data/code2java;”;

    // changed from “com.mysql.jdbc.Driver”
    Class.forName(“org.apache.derby.jdbc.EmbeddedDriver”);
    try
    {
    // changed from “url+dbName,uname,pwd”
    conn = DriverManager.getConnection( url + dbName );
    } [/code]
    I’m thrilled that it now works, and I have a template to follow for similar applications I plan to write. I hope this is helpful to someone else.

    Thanks again for your time.

  2. Hi Sir, First of all thank u for such tutorial , I am doing some task that is based on Encryption and Decryption for secure message in jsp or servlet .

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.