|
|
|
Как в Hibernate передать имя\пароль
|
|||
|---|---|---|---|
|
#18+
Нужно передать имя\пароль в Hibernate, без hibernate.cfg.xml в 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> </session-factory> </hibernate-configuration> пишу Properties PROP = new Properties(); PROP.put("connection.driver_class", "oracle.jdbc.driver.OracleDriver"); PROP.put("connection.url", "jdbc:oracle:thin:@kh:1521:A1"); PROP.put("connection.username", "S2"); PROP.put("connection.password", "nir"); PROP.put("dialect", "org.hibernate.dialect.Oracle9Dialect"); PROP.put("show_sql", "true"); PROP.put("use_sql_comments", "true"); PROP.put("generate_statistics", "true"); Configuration cfg = new Configuration() .setProperties(PROP) .addClass(Board.class) .addClass(DeviceInFilter.class) ; sf = cfg.configure().buildSessionFactory(); при запуске выдет ... INFO: processing foreign key constraints 02.03.2006 18:49:03 org.hibernate.connection.UserSuppliedConnectionProvider configure WARNING: No connection properties specified - the user must supply JDBC connections Exception in thread "main" org.hibernate.HibernateException: database product name cannot be null at org.hibernate.dialect.DialectFactory.determineDialect(DialectFactory.java:57) at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:39) at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:374) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:110) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1463) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1004) at ru.nateks.esma.client.hibernateQuery.HibernateObjectFactory.<init>(HibernateObjectFactory.java:66) at ru.nateks.esma.client.hibernateQuery.select.MasterNSubNetwork.<init>(MasterNSubNetwork.java:17) at ru.nateks.esma.client.Launcher.createTree(Launcher.java:224) at ru.nateks.esma.client.Launcher.<init>(Launcher.java:64) at ru.nateks.esma.client.Launcher.main(Launcher.java:51) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:86) Process finished with exit code 1 plz HELP ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 02.03.2006, 18:52 |
|
||
|
Как в Hibernate передать имя\пароль
|
|||
|---|---|---|---|
|
#18+
ну неужели никто не знает? Up ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 09.03.2006, 16:02 |
|
||
|
Как в Hibernate передать имя\пароль
|
|||
|---|---|---|---|
|
#18+
а ты попробуй удалить нафик цфг ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 09.03.2006, 18:12 |
|
||
|
Как в Hibernate передать имя\пароль
|
|||
|---|---|---|---|
|
#18+
цфг? Configuration cfg? пробовал удалить hibernate.cfg.xml пишет ... Caused by: org.hibernate.HibernateException: /hibernate.cfg.xml not found ... нашел как через параметры VM передавать, но это не то ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 10.03.2006, 10:08 |
|
||
|
Как в Hibernate передать имя\пароль
|
|||
|---|---|---|---|
|
#18+
Попробуй мнесто setProperties делать setProperty для каждого свойства соединения ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 10.03.2006, 12:18 |
|
||
|
Как в Hibernate передать имя\пароль
|
|||
|---|---|---|---|
|
#18+
попробовал, непомогло... вот думаю, может в hibernate.cfg.xml какие нибуть "особые" параметры нужно прописать. Нашел статью типа "hibernate not XML" но вся стиять в несколько строк со СКРИНШОТОМ исходника, и непонят что там hibernate.cfg.xml пишут или удалить его, но без него hibernate.cfg.xml not found выдает. Может кто пример своей авторизации в hibernate выложит ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 10.03.2006, 12:49 |
|
||
|
|

start [/forum/topic.php?fid=59&tid=2149970]: |
0ms |
get settings: |
6ms |
get forum list: |
13ms |
check forum access: |
2ms |
check topic access: |
2ms |
track hit: |
138ms |
get topic data: |
9ms |
get forum data: |
2ms |
get page messages: |
39ms |
get tp. blocked users: |
1ms |
| others: | 208ms |
| total: | 420ms |

| 0 / 0 |
