Downloaded <a href="https://dev.mysql.com/downloads/connector/j/5.0.html" target="_new">mysql-connector-java-3.1.13-bin.jar</a> from the MySQL site and double clicked the mysql-connector-java-3.1.13.tar.gz on my desktop. Dragged the resulted file folder to my Library/Java/Extensions/ directory. I then dragged the mysql-connector-java-3.1.13-bin.jar out of the mysql-connector-java-3.1.13 and into the Library/Java/Extensions/ directory. Copied a little mySql connection test java code from the internet, and it successfully connected.
Here is the test code I used:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class JdbcExample2 {
public static void main(String args[]) {
Connection con = null;
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
con = DriverManager.getConnection("jdbc:mysql:///test",
"root", "");
if(!con.isClosed())
System.out.println("Successfully connected to " +
"MySQL server using TCP/IP…");
} catch(Exception e) {
System.err.println("Exception: " + e.getMessage());
} finally {
try {
if(con != null)
con.close();
} catch(SQLException e) {}
}
}
}
Next I moved mysql-connector-java-3.1.13-bin.jar into System/Library/Java/Extensions/ directory and found that my test code continued to work. While looking for the mysqlJDBC.jar file, I noticed several postings dealing with connection problems when placing the jar file into this directory. Now I don’t know why it worked for me but it did. It’s definitely an unusual experience for me. Typically this type of operation would require hours of fiddling to find some little thing I failed to do.
It’s time to celebrate…