Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package mysqldatabaseaccess;
- import java.sql.*;
- import java.io.*;
- /**
- *
- * @author Administrator
- */
- public class MySQLDatabaseAccess {
- public static void openConnection() {
- // Prompt for password to access MySQL
- InputStreamReader istream = new InputStreamReader(System.in);
- BufferedReader buffRead = new BufferedReader(istream);
- try {
- System.out.println("Please enter the password: ");
- String prompt = buffRead.readLine();
- }
- catch (IOException err) {
- System.out.println("An error occured reading buffer.");
- }
- Connection conn = null;
- String url = "jdbc:mysql://localhost:3306/";
- String dbName = "jdbc";
- String drive = "com.mysql.jdbc.Driver";
- String userName = "root";
- String password = prompt; // <-- this is where i get red zig-zags
Add Comment
Please, Sign In to add comment