Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.sql.Statement;
- public class test_class
- {
- public static void main(String[] args){
- Connection conn = null;
- try {
- conn = DriverManager.getConnection("jdbc:mysql://localhost/world?" + "user=root&password=warpten");
- Statement stmt = null;
- ResultSet rs = null;
- // Do something with the Connection
- stmt = conn.createStatement();
- rs = stmt.executeQuery("SELECT * FROM city");
- // or alternatively, if you don't know ahead of time that
- // the query will be a SELECT...
- if (stmt.execute("SELECT * FROM city")) {
- rs = stmt.getResultSet();
- }
- System.out.print("FFFFFFFFFFF");
- } catch (SQLException ex) {
- // handle any errors
- System.out.println("SQLException: " + ex.getMessage());
- System.out.println("SQLState: " + ex.getSQLState());
- System.out.println("VendorError: " + ex.getErrorCode());
- }
- }
- }
Add Comment
Please, Sign In to add comment