我用 JDBC 创建了一个 java 程序,它成功地连接到我的计算机服务器的 MySQL 数据库,如下所示:
try
{
// The newInstance() call is a work around for some
// broken Java implementations
Class.forName("com.mysql.jdbc.Driver").newInstance();
}
catch (Exception ex)
{
// handle the error
}
try
{
conn = DriverManager.getConnection(("jdbc:mysql://191.168.1.15:3306/databasename"), "username", "password");
// Do something with the Connection
}
catch (SQLException ex)
{
// handle any errors
System.out.println("SQLException: " + ex.getMessage());
System.out.println("SQLState: " + ex.getSQLState());
System.out.println("VendorError: " + ex.getErrorCode());
}
但是,如果有人想找出密码,使用任何 java 反编译器都会非常简单。就此而言,我如何能够阻止他们找到密码或用户名?