三个驱动jar包我也加进去了   数据库的pack3补丁也打上了   就是连不上   请师傅们 给个说法
import org.hibernate.cfg.Configuration;
import org.hibernate.tool.hbm2ddl.SchemaExport;public class Test {

public static void main(String[] args) {
Configuration cfg=new Configuration().configure();
SchemaExport se=new SchemaExport(cfg);
se.create(true, true);

}
}
Hibernate 3.1.3
hibernate.properties not found
using CGLIB reflection optimizer
using JDK 1.4 java.sql.Timestamp handling
configuring from resource: /hibernate.cfg.xml
Configuration resource: /hibernate.cfg.xml
Reading mappings from resource: com/qiancheng/struts/pojo/Banlixinyongka.hbm.xml
Mapping class: com.qiancheng.struts.pojo.Banlixinyongka -> banlixinyongka
Reading mappings from resource: com/qiancheng/struts/pojo/Hangyedongtai.hbm.xml
Mapping class: com.qiancheng.struts.pojo.Hangyedongtai -> hangyedongtai
Reading mappings from resource: com/qiancheng/struts/pojo/Jiedaichangshi.hbm.xml
Mapping class: com.qiancheng.struts.pojo.Jiedaichangshi -> jiedaichangshi
Reading mappings from resource: com/qiancheng/struts/pojo/Users.hbm.xml
Mapping class: com.qiancheng.struts.pojo.Users -> users
Reading mappings from resource: com/qiancheng/struts/pojo/Wangzhangonggao.hbm.xml
Mapping class: com.qiancheng.struts.pojo.Wangzhangonggao -> wangzhangonggao
Reading mappings from resource: com/qiancheng/struts/pojo/Woyaofangkuan.hbm.xml
Mapping class: com.qiancheng.struts.pojo.Woyaofangkuan -> woyaofangkuan
Reading mappings from resource: com/qiancheng/struts/pojo/Woyaojeiqian.hbm.xml
Mapping class: com.qiancheng.struts.pojo.Woyaojeiqian -> woyaojeiqian
Reading mappings from resource: com/qiancheng/struts/pojo/Woyaorongzi.hbm.xml
Mapping class: com.qiancheng.struts.pojo.Woyaorongzi -> woyaorongzi
Configured SessionFactory: null
Using dialect: org.hibernate.dialect.SQLServerDialect
Running hbm2ddl schema export
exporting generated schema to database
Using Hibernate built-in connection pool (not for production use!)
Hibernate connection pool size: 20
autocommit mode: false
using driver: com.microsoft.jdbc.sqlserver.SQLServerDriver at URL: jdbc.microsoft:sqlserver://127.0.0.1:1433;databaseName=QianChengDB
connection properties: {user=sa, password=****}
schema export unsuccessful
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
at org.hibernate.tool.hbm2ddl.ManagedProviderConnectionHelper.prepare(ManagedProviderConnectionHelper.java:28)
at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:178)
at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:131)
at Test.main(Test.java:9)

解决方案 »

  1.   

    1 需要SP4 不是 SP3
    2 java.sql.SQLException: No suitable driver 
    这个错误说明你的驱动是JDBC 2.0的,可是你的链接字符串写的却是 JDBC 3.0的写法,导致驱动找不到。看看这个
    http://www.java2000.net/p4754
      

  2.   

    hibernate.properties not found 
    Configured SessionFactory: null 
    java.sql.SQLException: No suitable driver 自己找找原因
      

  3.   

    呵呵 无论什么补丁 暂且不说   我终于找到问题之所在了     是在hibernate.cfg.xml里面    
    字串要写在<property>************</property>之间  
    因为我是手写的
    写成 <property>
             ****************
         </property>
    所以报错了  说的没有合适的驱动      在此之前我打过补丁3    谢谢各位的回复  非常感谢!
      

  4.   

    <property>************ </property>和
    <property>
            ****************
    </property> 应该没区别吧
      

  5.   

    url = "jdbc.microsoft:sqlserver://127.0.0.1:1433;databaseName=QianChengDB";你的url是不是写错了.