Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main;
- import java.sql.*;
- public class Connectionclass {
- public static void main(){
- try{
- Class.forName("com.mysql.jdbc.Driver");
- Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/sakila","root","root");
- Statement stmt= con.createStatement();
- ResultSet rs=stmt.executeQuery("select * from actor");
- while(rs.next())
- System.out.println("Hello"+rs.next());
- con.close();
- }
- catch(Exception e)
- {
- System.out.println(e);}
- }
- }
Add Comment
Please, Sign In to add comment