Skip to content

anonymous /gist:4654434
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication3;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.swing.JFrame;
import javax.swing.JPanel;
/**
*
* @author HP Pavilion
*/
public class JavaApplication3 {
public static void main(String[] args) throws SQLException, ClassNotFoundException {
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql://localhost/mysql?"
+ "user=root&password=onelife");
stmt = conn.createStatement();
rs = stmt.executeQuery("SELECT host,user,password from user");
while (rs.next()) {
String host = rs.getString("host");
String user = rs.getString("user");
String pass = rs.getString("password");
System.out.println("Host:\t\t" + host);
System.out.println("Usert:\t\t" + user);
System.out.println("Password:\t" + pass);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.