Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //java -classpath "~/JConnector/mysql-connector-java-5.1.18;." SQLTest password
- import java.sql.*;
- public class SQLTest{
- public static void main(String[] args){
- Connection myCon = null;
- try{
- Class.forName("com.mysql.jdbc.Driver").newInstance();
- myCon = DriverManager.getConnection("jdbc:mysql:///test", "root", args[0]); //args[0] being password
- if(!myCon.isClosed())
- System.out.println("SUCCESS");
- }catch(Exception e){
- System.out.println(e);
- }finally{
- try{
- if(myCon != null)
- myCon.close();
- }catch(SQLException er){
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment