I was getting indications that mysql connections through the com.mysql.jdbc 
driver was not working. So I searched for a test method (included below) and 
here are the results.

* Server: mariadb100--10.0.17, jailed, tcp connection. Able to connect through 
other drivers & using same params.
* Client: mysql-connector-java-5.1.35
* Test code compiled with javac, $ java -cp . jdbc >
com.mysql.jdbc.Driver
Exception in thread "main" java.lang.ClassNotFoundException: 
com.mysql.jdbc.Driver  # I compile with OPTIONS_UNSET= NLS
        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:191)
        at jdbc.main(jdbc.java:15)

* Java Test Code:
[code]
import java.sql.*;
import java.util.Properties;
public class jdbc
{
    // The JDBC Connector Class.
    private static final String dbClassName = "com.mysql.jdbc.Driver";
    private static final String CONNECTION =
                          "jdbc:mysql://192.168.2.110/mydb";
    public static void main(String[] args) throws
                             ClassNotFoundException,SQLException
    {
        System.out.println(dbClassName);
        // Class.forName(xxx) loads the jdbc classes and
        // creates a drivermanager class factory
        Class.forName(dbClassName);
        // Properties for user and password.
        Properties p = new Properties();
        p.put("user","mydb");
        p.put("password","");
        // Now try to connect
        Connection c = DriverManager.getConnection(CONNECTION,p);
        System.out.println("It works !");
        c.close();
    }
}
[/code]


-- 
FreeBSD_amd64_11-Current_RadeonKMS
Please CC my email when responding, mail from list is not delivered.
_______________________________________________
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"

Reply via email to