How can I connect to mysql database using jdbc?
Location: http://www.jguru.com/faq/view.jsp?EID=444472 Created: Jun 24, 2001 Modified: 2001-06-30 20:04:35.74 Author: Luigi Viggiano (http://www.jguru.com/guru/viewbio.jsp?EID=101985) Question originally posed by vikrant charde (http://www.jguru.com/guru/viewbio.jsp?EID=433268 Use something like: // loads the JDBC driver Class.forName(“org.gjt.mm.mysql.Driver”).newInstance(); // get a database connection Connection conn = DriverManager.getConnection( “jdbc:mysql://hostname/databaseName”, “user”, “password”); obviously the JDBC driver “org.gjt.mm.mysql.Driver” must be in classpath. You can download it from here.