package sql;
import java.sql.*;
import java.io.*;
public class ControlTheDatabase {
/**
* @param args
*/
private static Connection con ;
private static Statement stmt ;
private static ResultSet rs ;
private static String com ;
@SuppressWarnings ( "unused" )
private static int rs1 ;
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
Class. forName ( "com.mysql.jdbc.Driver" );
getCon ();
System. out .println( " 连接数据库成功,请选择您需要的操作 ( 选择序
号)" );
System. out .println( "1:visit" +" " +"2:control" +"
" +"3:exit" );
BufferedReader br= new BufferedReader( new
InputStreamReader(System. in ));
com = br.readLine();
if ( com.equals( "1" )){ getRs ();}
if ( com.equals( "2" )){ getStmt ();}
if ( com.equals( "3" )){System. exit (0);}
} catch (Exception e){System. out .println(e.getMessage());}
}
/**
* @param con the con to set
*/
public void setCon(Connection con) {
ControlTheDatabase. con = con;
}
/**
* @return the con