java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:910)
at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3923)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1273)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2031)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:718)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:302)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:282)
at java.sql.DriverManager.getConnection(DriverManager.java:579)
at java.sql.DriverManager.getConnection(DriverManager.java:190)
at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
at org.hibernate.tool.hbm2ddl.SuppliedConnectionProviderConnectionHelper.prepare(SuppliedConnectionProviderConnectionHelper.java:27)
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:127)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:296)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1176)
at com.lyq.util.HibernateFilter.init(HibernateFilter.java:51)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4072)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4726)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
01:23:36,548 ERROR SchemaUpdate:165 - could not complete schema update

解决方案 »

  1.   

    没有连上数据库,可以考虑以下方法:
    一、检查用户名与密码是否正确;
    二、检查localhost是否有root用户
      

  2.   

    在myeclipse里面有配置数据库的 到那可以测试数据库连得正确与否
      

  3.   

    同样的程序在别人那里可以,在你这里报这个错误,你可以去检查下MYSQL数据库的root用户是不是开放了登陆IP。root'@'localhost,默认ROOT只能在localhost登陆
      

  4.   


    import java.security.Key;import java.security.Security;import javax.crypto.Cipher;public class EncryptionDecryption { private static String strDefaultKey = "tourhb";
    /** 加密工具 */
    private Cipher encryptCipher = null;
    /** 解密工具 */
    private Cipher decryptCipher = null;
    /**  
     * 将byte数组转换为表示16进制值的字符串, 如:byte[]{8,18}转换为:0813, 和public static byte[]  
     * hexStr2ByteArr(String strIn) 互为可逆的转换过程  
     *  
     * @param arrB  
     * 需要转换的byte数组  
     * @return 转换后的字符串  
     * @throws Exception  
     *    
     */ public static String byteArr2HexStr(byte[] arrB) throws Exception {
    int iLen = arrB.length;
    // 每个byte用两个字符才能表示,所以字符串的长度是数组长度的两倍  
    StringBuffer sb = new StringBuffer(iLen * 2);
    for (int i = 0; i < iLen; i++) {
    int intTmp = arrB[i];
    // 把负数转换为正数  
    while (intTmp < 0) {
    intTmp = intTmp + 256;
    }
    // 小于0F的数需要在前面补0  
    if (intTmp < 16) {
    sb.append("0");
    }
    sb.append(Integer.toString(intTmp, 16));
    }
    return sb.toString();
    }
    /**  
     * 将表示16进制值的字符串转换为byte数组, 和public static String byteArr2HexStr(byte[] arrB)  
     * 互为可逆的转换过程  
     *  
     * @param strIn 需要转换的字符串  
     * @return 转换后的byte数组  
     * @throws Exception  
     *  
     */ public static byte[] hexStr2ByteArr(String strIn) throws Exception { byte[] arrB = strIn.getBytes();
    int iLen = arrB.length;
    // 两个字符表示一个字节,所以字节数组长度是字符串长度除以2  
    byte[] arrOut = new byte[iLen / 2];
    for (int i = 0; i < iLen; i = i + 2) {
    String strTmp = new String(arrB, i, 2);
    arrOut[i / 2] = (byte) Integer.parseInt(strTmp, 16);
    }
    return arrOut;
    }
    /**  
     * 默认构造方法,使用默认密钥  
     *  
     * @throws Exception  
     */ public EncryptionDecryption() throws Exception {
    this(strDefaultKey);
    }
    /**  
     * 指定密钥构造方法  
     *  
     * @param strKey  
     * 指定的密钥  
     * @throws Exception  
     */
    public EncryptionDecryption(String strKey) throws Exception { Security.addProvider(new com.sun.crypto.provider.SunJCE());
    Key key = getKey(strKey.getBytes());
    encryptCipher = Cipher.getInstance("DES");
    encryptCipher.init(Cipher.ENCRYPT_MODE, key);
    decryptCipher = Cipher.getInstance("DES");
    decryptCipher.init(Cipher.DECRYPT_MODE, key);
    }
    /**  
     * 加密字节数组  
     * @param arrB  
     * 需加密的字节数组  
     * @return 加密后的字节数组  
     * @throws Exception  
     */ public byte[] encrypt(byte[] arrB) throws Exception {
    return encryptCipher.doFinal(arrB);
    }
    /**  
     * 加密字符串  
     *  
     * @param strIn  
     * 需加密的字符串  
     * @return 加密后的字符串 
     * @throws Exception  
     */ public String encrypt(String strIn) throws Exception {
    return byteArr2HexStr(encrypt(strIn.getBytes()));
    }
    /**  
     * 解密字节数组  
     *  
     * @param arrB  
     * 需解密的字节数组  
     * @return 解密后的字节数组  
     * @throws Exception  
     */ public byte[] decrypt(byte[] arrB) throws Exception {
    return decryptCipher.doFinal(arrB);
    }
    /**  
     * 解密字符串  
     *  
     * @param strIn  
     * 需解密的字符串  
     * @return 解密后的字符串  
     * @throws Exception  
     */ public String decrypt(String strIn) throws Exception {
    try {
    return new String(decrypt(hexStr2ByteArr(strIn)));
    } catch (Exception e) {
    return "";
    }
    } /**  
     * 从指定字符串生成密钥,密钥所需的字节数组长度为8位 不足8位时后面补0,超出8位只取前8位  
     *  
     * @param arrBTmp  
     * 构成该字符串的字节数组  
     * @return 生成的密钥  
     * @throws java.lang.Exception  
     */ private Key getKey(byte[] arrBTmp) throws Exception { // 创建一个空的8位字节数组(默认值为0)  
    byte[] arrB = new byte[8];
    // 将原始字节数组转换为8位  
    for (int i = 0; i < arrBTmp.length && i < arrB.length; i++) {
    arrB[i] = arrBTmp[i];
    }
    // 生成密钥  
    Key key = new javax.crypto.spec.SecretKeySpec(arrB, "DES");
    return key;
    }
    }
    挺好用的,是可逆的,但是长度不符合你的要求,这个我觉得你自己改一下吧,或者将密码后的你自己处理一下就行了。
      

  5.   


    1、首先检查你的数据库用户名和密码是否正确、2、检查你连接的数据库名是否正确、是否有这个数据库3、检查你的sql语句是否隔好了空格
      

  6.   

    LZ很明显的错误,要不就是连接数据库的参数有问题:URL,用户名和密码,检查是否正确
    还有就是权限,是否允许远程连接。你可以使用myeclipse里的db brower检查下数据库连接是否正常。