运行时不停的出现这样的错误   一般都是什么错误呀  代码写的没有错的 (这项目是用SSH做的)java.sql.SQLException: 用户 'sa' 登录失败。
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:365)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2781)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2224)
at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.java:599)
at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:331)
at net.sourceforge.jtds.jdbc.ConnectionJDBC3.<init>(ConnectionJDBC3.java:50)
at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:178)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:68)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:87)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1.acquireResource(C3P0PooledConnectionPool.java:83)
at com.mchange.v2.resourcepool.BasicResourcePool.assimilateResource(BasicResourcePool.java:884)
at com.mchange.v2.resourcepool.BasicResourcePool.acquireUntil(BasicResourcePool.java:601)
at com.mchange.v2.resourcepool.BasicResourcePool.access$400(BasicResourcePool.java:31)
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1079)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:354)

解决方案 »

  1.   

    直接在DOS上用改用户登录数据库,看看能否登上去
      

  2.   

    我也不知道 到底怎么回事  我感觉hibernate那块好像有不对的地方吧
    这是我hibernate的配置文件
    <?xml version='1.0' encoding='UTF-8'?>
    <!DOCTYPE hibernate-configuration PUBLIC
              "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
              "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><!-- Generated by MyEclipse Hibernate Tools.                   -->
    <hibernate-configuration> <session-factory>
    <property name="connection.username">sa</property>
    <property name="connection.url">
    jdbc:microsoft:sqlserver://localhost:1433
    </property>
    <property name="dialect">
    org.hibernate.dialect.SQLServerDialect
    </property>
    <property name="myeclipse.connection.profile">SQL</property>
    <property name="connection.password">123456</property>
    <property name="connection.driver_class">
    com.microsoft.jdbc.sqlserver.SQLServerDriver
    </property>
    <mapping
    resource="org/better/hr/entity/SalaryGrantDetails.hbm.xml" />
    <mapping resource="org/better/hr/entity/Users.hbm.xml" />
    <mapping
    resource="org/better/hr/entity/ConfigFileFirstKind.hbm.xml" />
    <mapping resource="org/better/hr/entity/SalaryGrant.hbm.xml" />
    <mapping resource="org/better/hr/entity/EngageAnswer.hbm.xml" />
    <mapping resource="org/better/hr/entity/HumanFile.hbm.xml" />
    <mapping
    resource="org/better/hr/entity/ConfigQuestionFirstKind.hbm.xml" />
    <mapping resource="org/better/hr/entity/HumanFileDig.hbm.xml" />
    <mapping
    resource="org/better/hr/entity/ConfigPrimaryKey.hbm.xml" />
    <mapping
    resource="org/better/hr/entity/EngageMajorRelease.hbm.xml" />
    <mapping
    resource="org/better/hr/entity/ConfigMajorKind.hbm.xml" />
    <mapping
    resource="org/better/hr/entity/ConfigQuestionSecondKind.hbm.xml" />
    <mapping resource="org/better/hr/entity/EngageResume.hbm.xml" />
    <mapping resource="org/better/hr/entity/Training.hbm.xml" />
    <mapping resource="org/better/hr/entity/ConfigMajor.hbm.xml" />
    <mapping resource="org/better/hr/entity/EngageExam.hbm.xml" />
    <mapping
    resource="org/better/hr/entity/ConfigPublicChar.hbm.xml" />
    <mapping resource="org/better/hr/entity/MajorChange.hbm.xml" />
    <mapping resource="org/better/hr/entity/SalaryStandard.hbm.xml" />
    <mapping
    resource="org/better/hr/entity/ConfigFileThirdKind.hbm.xml" />
    <mapping
    resource="org/better/hr/entity/ConfigFileSecondKind.hbm.xml" />
    <mapping resource="org/better/hr/entity/EngageSubjects.hbm.xml" />
    <mapping
    resource="org/better/hr/entity/SalaryStandardDetails.hbm.xml" />
    <mapping
    resource="org/better/hr/entity/EngageExamDetails.hbm.xml" />
    <mapping
    resource="org/better/hr/entity/EngageAnswerDetails.hbm.xml" />
    <mapping resource="org/better/hr/entity/Bonus.hbm.xml" />
    <mapping
    resource="org/better/hr/entity/EngageInterview.hbm.xml" /> </session-factory></hibernate-configuration>大家帮忙看看
      

  3.   

    java.sql.SQLException: 用户 'sa' 登录失败。1)能连上,否则是网络问题
    2)数据库运行正常所以原因可能是,sa用户被lock或者密码错误。解决方法:
       新建一个数据库用户并赋予正确的权限(简单的可以给管理员),然后测试看看。
      

  4.   


    hibernate连接sqlServer语句应该是这样的。。我配置的hibernate.cfg.xml如下。。
    <hibernate-configuration> 
        <session-factory> 
           <property name="connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>
             <property name="connection.url">jdbc:jtds:sqlserver://localhost:1433;databaseName=myBlog_ssh_005</property>
            <property name="connection.username">sa</property>
            <property name="connection.password">123456</property>
            <property name="dialect">org.hibernate.dialect.SQLServerDialect</property>
      
              
            <property name="show_sql">true</property>
         
            <property name="hbm2ddl.auto">update</property>        <mapping resource="com/chengge/bean/User.hbm.xml"/>
            <mapping resource="com/chengge/bean/Comment.hbm.xml"/>       
        </session-factory>
    </hibernate-configuration>
    而且要导入jstl.jar包。。应该是可以的。。
      

  5.   

    打错了。。是导入jtds.jar包。。