dbCon=DriverManager.getConnection("jdbc:odbc:personal");
你的访问数据库的用户名和密码怎么没有指定?
参考:
public static Connection getConnection(String url,
                                       String user,
                                       String password)
Parameters:
url - a database url of the form jdbc:subprotocol:subname
user - the database user on whose behalf the connection is being made
password - the user's password
                                

解决方案 »

  1.   

    数据库服务器启动了吗?你的数据源配置好了吗?配置ODBC数据源连接数据库的时候,你用什么方式?使用用户输入登录ID和密码的SQL Server验证,然后登录ID(一般安装数据库时默认sa)和密码(安装数据库时默认为空),测试数据愿要通过!
    然后再程序中指定用户名,密码,
    假设用户ID为sa,密码为空,则有:
    dbCon=DriverManager.getConnection("jdbc:odbc:personal","sa","");