<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    hibernate新手求助!!

    今天下午學習使用hibernate,跟著視頻做,可是控制臺老報這個錯誤
    02:03:12,171  WARN UserSuppliedConnectionProvider:23 - No connection properties specified - the user must supply JDBC connections
    02:03:12,171 ERROR SchemaExport:202 - schema export unsuccessful
    java.lang.UnsupportedOperationException: The user must supply a JDBC connection
     at org.hibernate.connection.UserSuppliedConnectionProvider.getConnection(UserSuppliedConnectionProvider.java:30)
     at org.hibernate.tool.hbm2ddl.ManagedProviderConnectionHelper.prepare(ManagedProviderConnectionHelper.java:28)
     at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:180)
     at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:133)
     at com.test.hibernate.ExportDB.main(ExportDB.java:15)

    視頻就能運行成功,我的就不行,很是郁悶,

    hibernate.cfg.xml配置如下:
            

                <!DOCTYPE hibernate-configuration PUBLIC
                 "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
                 "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

                <hibernate-configuration>
                 <session-factory>
                      <property name="hibernate.connection.url ">jdbc:mysql:///localhost/hibernate_first</property>
                      <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
                      <property name="hibernate.connection.username">root</property>
                      <property name="hibernate.connection.password">root</property>
                      <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
      
                      <mapping resource="com/test/hibernate/User.hbm.xml"/>
                 </session-factory>
            </hibernate-configuration>

    實體類User的映射文件配置:
    <?xml version="1.0"?>
    <!DOCTYPE hibernate-mapping PUBLIC
     "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
     "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
    <hibernate-mapping>
     <class name="com.test.hibernate.User">
      <id name="id">
       <generator class="uuid"/>
      </id>
      
      <property name="userName"/>
      <property name="password"/>
      <property name="createDate"/>
      <property name="expireDate"/>
     </class>
     
    </hibernate-mapping>

    下面是連接數據庫的類:

    package com.test.hibernate;

    import org.hibernate.cfg.Configuration;
    import org.hibernate.tool.hbm2ddl.SchemaExport;

    public class ExportDB {


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

    }


    希望路過高手不吝指導一下,感激不盡!!!!

    posted on 2008-12-30 02:23 anyStar 閱讀(1782) 評論(8)  編輯  收藏

    評論

    # re: hibernate新手求助!! 2009-03-10 14:39 222

    換個 表名  回復  更多評論   

    # re: hibernate新手求助!! 2009-03-10 19:44 xxxxx

    和你一樣的問題,不知道你能發下你的QQ么我加您,互相學習下.
    看來我們都在看,勇哥的視頻.  回復  更多評論   

    # re: hibernate新手求助!! 2009-03-13 13:20 mm

    我也是一樣的問題 頭很大  回復  更多評論   

    # re: hibernate新手求助!![未登錄] 2009-03-20 22:59 yang

    我現在也在看王勇老師的視頻,我QQ269676751,大家一起學習啊  回復  更多評論   

    # re: hibernate新手求助!! 2009-04-01 16:41 木子日京

    我也遇到了類似的問題,剛開始時還可以運行,可是我把Mysql重裝了下就不行了,提示錯誤是
    16:40:18,796 ERROR SchemaExport:202 - 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:180)
    at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:133)
    at com.ExprotDB.main(ExprotDB.java:15)
    不知道怎么弄了!  回復  更多評論   

    # re: hibernate新手求助!! 2009-04-01 18:40 木子日京

    我的問題解決了呢!我看了一下你的配置文件,
    <property name="hibernate.connection.url ">jdbc:mysql:///localhost/hibernate_first</property>改成
    <property name="hibernate.connection.url ">jdbc:mysql://localhost/hibernate_first</property>試試,還有就是你的mysql的用戶名和密碼一下要正確哦!
      回復  更多評論   

    # re: hibernate新手求助!![未登錄] 2009-12-07 22:16 ice

    same problem we meet!  回復  更多評論   

    # re: hibernate新手求助!! 2011-09-26 11:10 lbblove

    @222
    hi,我也遇到這個問題,能加我qq么,296291859,以后多多向你請教。請問最后怎么解決呢···我也在看王勇老師的視頻··  回復  更多評論   


    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    <2009年12月>
    293012345
    6789101112
    13141516171819
    20212223242526
    272829303112
    3456789

    導航

    統計

    常用鏈接

    留言簿(2)

    隨筆分類

    隨筆檔案

    文章檔案

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 久久受www免费人成_看片中文| 亚洲天堂一区二区三区四区| 国产精品69白浆在线观看免费| h视频在线免费观看| 亚洲性无码AV中文字幕| 亚洲av无码乱码国产精品fc2| 亚洲国产中文字幕在线观看| 欧洲精品成人免费视频在线观看| 久久中文字幕免费视频| 久久国产福利免费| 成人福利在线观看免费视频| 亚洲色大网站WWW永久网站| 亚洲精品国产福利片| 久久青青成人亚洲精品| 亚洲一区无码中文字幕| 亚洲AV无码不卡在线观看下载| 妞干网免费视频在线观看| 国产成人精品免费午夜app| 久爱免费观看在线网站| 中文毛片无遮挡高清免费| 一区在线免费观看| 无套内谢孕妇毛片免费看看| 亚洲一线产区二线产区区| 亚洲精品二三区伊人久久| 亚洲成人福利在线| 亚洲第一二三四区| 亚洲理论片中文字幕电影| 亚洲男人天堂av| 亚洲色欲色欲综合网站| 亚洲成a人片77777老司机| 国产亚洲成AV人片在线观黄桃| 亚洲情XO亚洲色XO无码| 国产亚洲av片在线观看16女人| 国产亚洲色婷婷久久99精品91| 国产成人亚洲精品影院| 国产精品亚洲高清一区二区 | 亚洲乱色伦图片区小说| 亚洲综合久久精品无码色欲| 亚洲日韩国产欧美一区二区三区 | 男人j进女人p免费视频| 视频免费1区二区三区|