Ubuntu下有关Java和数据库的一些工作记录

import java.sql.*; public class DBConnector { static Connection conn; public static void main(String[] args) { try { Class.forName("com.mysql.jdbc.Driver"); System.out.println("Load mysql driver success!"); } catch(Exception err) { System.out.print("Load mysql driver failed!"); err.getStackTrace(); } try { conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "wings", null); System.out.println("Connect success!"); } catch(Exception err) { System.out.println("Connect failed!"); err.getStackTrace(); } } }

 

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/19631.html