Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package worksheet3;
- import java.io.*;
- import java.sql.*;
- public class query1 {
- public static void main(String[] args) throws IOException{
- try {
- Class.forName("com.mysql.jdbc.Driver");
- Connection c = DriverManager.getConnection(
- "jdbc:mysql://localhost:3306/db_na8g09", "na8g09", "");
- Statement s = c.createStatement();
- s.executeQuery("select * from tb01");
- ResultSet r = s.getResultSet();
- while(r.next()) {
- System.out.println(r.getString("fld01") + " " + r.getString("fld02"));
- }
- } catch(Exception e) {
- System.err.println("Error: " + e.toString());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement