Related Posts

  • MySql Installation

    Hello Friends,   This is one of my tutorials related to database. You all must be familiar with MySQL, but still for those who have not learned about this, for them I will recall it in short. MySQL is a relational database management system (RDBMS) that runs as a server providing multi-user access to a number of databases.The…

  • Abstract Class In JAVA

    Hello Friends, This tutorial is for all the Java followers. One of the best feature that is widely used is the term ‘Abstract’. This term can be used as either class or a simple method. An abstract method is any method that is just declared but not instantiated. In other words one can just create…

  • Threads in Java.

    Hello Friends, This is the tutorial for the java developers. One of the most significance feature of core java is Threading. Threading deals with the processing of Threads in a single java program. Let us learn what actually are Threads. *What are Threads? Threads are independently running processes that are isolated from each other upto…

  • Collections In Java.

    Hello friends, Welcome to another tutorial for java followers. You all may have heard about Collections, it is one of the amazing feature in java. Collections are the object for the group of elements, these elements are nothing but the different data structures like as Array Lists, Linked Lists, Vectors, Hash tables,Hash List, Trees, Hash…

6 Comments

  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.