4May/115
Connect Java to MYSQL using JDBC
Most of the System requires a back end in order to save the transactions. Here is the sample how to connect your java apps into mysql database.
import java.sql.*
public class MysqlConnect{
Connection con = null; String dbUser = "root"; String dbPwd = "password"; String selectedDb = "test"; try { Class.forName("com.mysql.jdbc.Driver").newInstance(); con = DriverManager.getConnection("jdbc:mysql://localhost/selectedDb", dbUSer, dbPwd); if(!con.isClosed()) System.out.println("Successfully connected to " + "MySQL server using TCP/IP..."); } catch(Exception e) { System.err.println("Exception: " + e.getMessage()); } }
September 5th, 2011 - 06:43
thanks i helps a lot to my web apps..
September 5th, 2011 - 06:44
i mean it really helps a lot to me..
March 8th, 2012 - 19:11
good website. i like all pages and all comments. thanks for all!!! regards!!!http://www.calculadoradocidadao.com
March 9th, 2012 - 08:25
you inspire me, thanks.http://www.magiccampusbrasil.net
April 14th, 2012 - 11:20
i think this subject is not very clear for me, can you explain it better please. thanks.http://www.pagode2011.com