Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Classes;
- import java.sql.*;
- public class SQLConnector{
- public void CreateConnection() throws SQLException{
- Connection myConn = null;
- Statement myStmt = null;
- ResultSet myRs = null;
- String user = "root";
- String pass = "";
- try {
- myConn = DriverManager.getConnection("jdbc:mysql://localhost:3306/AMYSQLsémaneve", user, pass);
- myStmt = myConn.createStatement();
- /*
- myRs = myStmt.executeQuery("SELECT * FROM TÁMLANEVE");
- while(myRs.next()){
- System.out.println(myRs.getString("OSZLOPNEVE"));
- }*/
- }
- catch (SQLException ex) {
- ex.printStackTrace();
- }
- finally{
- if(myRs != null)
- myRs.close();
- if(myStmt != null)
- myStmt.close();
- if(myConn != null)
- myConn.close();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement