Installing MySQL, Java, and Connector/J 66 Testing the (Mysql webhost)
Installing MySQL, Java, and Connector/J 66 Testing the Connector/J Installation Once you ve installed both Java and the Connector/J driver, create a test file called test.java and enter the following code into the file: public class test { public static void main(String[] args) { try { Class.forName(”com.mysql.jdbc.Driver”).newInstance(); System.out.println(”Good to go”); } catch (Exception E) { System.out.println(”JDBC Driver error”); } } } Save and exit the test file and compile it with this command: javac test.java Now execute the code with this command: java test If the Java Virtual Machine was able to find your Connector/J JAR file, you will see the text Good to go on the console; otherwise, you will see JDBC Driver Error . If you get an error, check that the JAR file is in the correct directory and/or check the CLASSPATH variable to be sure the full path to the JAR file has been included. Figure 4.3 shows all of these steps. Figure 4.3 Testing the Connector/J driver. What s Next Once you have installed all of the applications shown in this chapter, you are ready to start writing all sorts of Java applications that can access a MySQL database. In the next chapter, we begin looking at how to write applications and applets to access MySQL. We explore some of the basic functionality provided in the JDBC specification and implemented in Connector/J.
Note: If you are looking for top 10 and very good webhost to host and run your jsp application check Actions jsp hosting services