您能帮我组织从数据库读取数据吗?我在Windows下。 我收到此错误信息:java.sql.SQLException中:发现本地主机如何从Mysql数据库读取
没有合适的驱动程序这是我的代码的摘录:
public class JavaApplication10 {
public static void main(String[] args) {
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
Properties connInfo = new Properties();
connInfo.put("characterEncoding","UTF8");
connInfo.put("user", "root");
connInfo.put("password", "goskomstat");
conn = DriverManager.getConnection("localhost", connInfo);
作为一个在Windows命令行我可以输入: C: \ Program Files文件\的MySQL \ MySQL服务器5.6 \ BIN>的mysql -u根-p
然后我醇醚类密码 '国家统计委员会' 和可以操作我的数据库。
你能不能给我一个提示做什么?
http://dev.mysql.com/downloads/connector/j/:你需要MySQL JDBC驱动程序,你会需要使用适当的URL代码,其文档 –