我创建了一个带有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反编译器都会非常简单.我怎么能阻止他们找到密码或用户名呢?