Hello,
I would like to access MySQL DB using java, but I don't know how. I found this:
But it doesn't work. I think it is because of the driver, but I don't know which one I should use.Code:import java.sql.*; class prueba { public static void main (String[] args) { try { // Step 1: Load the JDBC driver. Class.forName("com.mysql.jdbc.Driver"); // Step 2: Establish the connection to the database. //String url = "jdbc:msql://www.myserver.com:1114/contact_mgr"; String url = "jdbc:msql://linuxfire:3306/sismosprueba"; Connection conn = DriverManager.getConnection(url,"admsismos","rzambrano"); } catch (Exception e) { System.err.println("Got an exception! "); System.err.println(e.getMessage()); } } }
Thanks
Adriana



Reply With Quote

Bookmarks