I have developed a program where I do some database connections and send some queries with JDBC to MySQL database called ANU.

I have used NetBeans 6.9 under Ubuntu 11.04 as platform. When I run the app from NetBeans, it works perfectly but when I try to run it from terminal I get SQL Exception. This is the function that produces that SQL Exception. The program terminates before "Establish is ending" line.

public Connection Establish(String iname, String ipassword) throws SQLException
    {
        System.out.println("Establish...");
        if(conn == null) // conn is a Connection object in the same class with this func
        {
            conn = DriverManager.getConnection("jdbc:mysql://localhost/ANU",
                    iname, ipassword);
        }
        else
            System.out.println("Connection Already Established!");
        System.out.println("Establish is ending...");
        return conn;
    } // End of Establish

To know exact exception would be most desired. Nevertheless I expect you failed to include db driver in classpath once you called your application from command line

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.