paulio macmurray wrote:the error shown is :Exception: com.mysql.jdbc.Driver
i also made a slightly different script which is below. The error message in that is my own "Cannot connect to database"
Just print the exact error you are getting by printing it (ie: e.printStackTrace()) inside the catch block and post that error here? You have the JDBC Driver in your classpath?
paulio macmurray wrote:Just a note to let you know i managed to get the script to work, but only by dumping the connection file in the same directory as the java file, and then javac ing it in a command prompt.
If you set the classpath properly (which should includes the required jar files and the class files you are executing) no need to have them in the same place.
Is there anyway to avoid this in netbeans?
To run this inside the IDE you should set those jars in the build path of the IDE.