Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.PreparedStatement;
- import java.sql.ResultSet;
- public class Main {
- public static void main(String[] args) throws Exception {
- // Accessing driver from the JAR file
- Class.forName("com.mysql.jdbc.Driver");
- // Creating a variable for the connection called "con"
- Connection conn = DriverManager.getConnection("jdbc:mysql://184.154.73.113:3306", "davidlno_student",
- "ez24get!");
- // Hostname: 184.154.73.113
- // Port: 3306
- // Username: davidlno_student
- // Password: ez24get!
- PreparedStatement statement = conn.prepareStatement("select * from TickerHistory");
- ResultSet result = statement.executeQuery();
- while (result.next()) {
- System.out.println(result.getString(1) + " " + result.getString(2));
- } // end while
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement