Explore your Imagination

Blog of Joeby Zaldivar Keep in touch…

8May/110

The Truth

Bakit kaya ang pinoy mahilig mangutang.. saka ang bilis bilis pa. Kung bayaran na, mahirap hagilapin, siya pa ang galit... Minsan kw na lng mahiya na nagpautang. Haiks...... Pinoy nga talaga. Magabago na tayo.

 

Bakit kaya pag-oras ng trabaho nakaka-antok? Pero,  pag oras naman ng tulugan hindi na-aantok... Baki kaya? Hirap noh..?

 

 

Filed under: Truth No Comments
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());
    }
}