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