:(my pc is installed with fedora-8,LMAP is running.
i installed netbeans 6.1 ide,the databases detected and the tables expanded
easily.project ->java deskstop->databases->jdbc:mysqldriver->compile and run well.
But when come to scripting :(from the tutorial)
import java.sql.*;
public class MysqlConnect{
public static void main(String[] args) {
System.out.println("MySQL Connect Example.");
Connection conn = null;
String url = "jdbc:mysql://localhost:3306/";
String dbName = "jdbctutorial";
String driver = "com.mysql.jdbc.Driver";
String userName = "root";
String password = "root";
try {
Class.forName(driver).newInstance();
conn = DriverManager.getConnection(url+dbName,userName,pa ssword);
System.out.println("Connected to the database");
conn.close();
System.out.println("Disconnected from database");
} catch (Exception e) {
System.out.println("Connection fails");
}
}
}
results :MySQL Connect Example.
Connection fails.
why?please help!!
thank you.

