Installation environment: UbuntuLinux1. Install JDK2 first. Install MySQL JDBC driver Connector/J (1) Search Connector/J (2) in the new Ubuntu software management package and install JDK2 (3) find the mysql-connector-java-n.n.n file in ubuntu and put it under/usr/lib/java (?), Install it and copy it to your java installation directory.
Installation environment: Ubuntu Linux
1. Install JDK first
2. Install MySQL JDBC driver Connector/J
(1) Search for Connector/J in the new software management package of Ubuntu
(2) Find and install
(3) Find the mysql-connector-java-n.n.n file under ubuntu and put it under/usr/lib/java (?), Install it and copy it to your java installation directory. java under ubuntu is only a link file, so you should obtain/usr/lib/jvm/java-6-sun/jre/lib/ext
3. When performing a jdbc link, you must first load the Connector/J driver statement: Class. forName ("com. mysql. jdbc. Driver"). getInstance ();
4. Create a link: Connection con = DriverManager. getConnection (url, username, password );
The url type is as follows:
Jdbc: mysql: // host name/Database Name? CharacterEncoding = utf8
Username is the user name that can log on to the database and perform operations on it. It is set in mysql.
Password is the login password corresponding to the user name.