-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Interactive login with Hibernate
PostPosted: Sun Apr 10, 2005 4:27 am 
Newbie

Joined: Sun Apr 10, 2005 4:09 am
Posts: 1
Location: Finland
Hi,
I'm trying to enable interactive login to my hibernate application. The application work otherwise, but when use enters a wrong username or password I cannot catch that during buildSessionFactory(). Log shows the SQLException, but it never gets to main application.

Question: How can I find out if login failed?

Hibernate version: 2.1.8
Name and version of the database you are using: Oracle 9.1.4.2

Code excerpt:[b]
try {
getIDandPassword(); // asks for id and passwd in dialog sets userID and userPassword
config.setProperty("hibernate.connection.username",userID);
config.setProperty("hibernate.connection.password",userPassword);
System.out.println("***** buildSessionFactory");
this.sessionFactory = config.buildSessionFactory();
} catch (HibernateException hie) {
if ((hie.getCause() != null) && (hie.getCause() instanceof SQLException)) {
SQLException se = (SQLException) hie.getCause();
System.out.println("***** Login failed");

}
}
System.out.println("***** endtry");


[b]Full stack trace of any exception that occurs:


***** buildSessionFactory
11:26:34,956 INFO Configuration:641 - processing one-to-many association mappings
11:26:34,956 INFO Configuration:650 - processing one-to-one association property references
11:26:34,956 INFO Configuration:675 - processing foreign key constraints
11:26:35,066 INFO Dialect:86 - Using dialect: net.sf.hibernate.dialect.OracleDialect
11:26:35,086 INFO SettingsFactory:70 - Maximim outer join fetch depth: 1
11:26:35,096 INFO SettingsFactory:74 - Use outer join fetching: true
11:26:35,106 INFO DriverManagerConnectionProvider:42 - Using Hibernate built-in connection pool (not for production use!)
11:26:35,106 INFO DriverManagerConnectionProvider:43 - Hibernate connection pool size: 1
11:26:35,126 INFO DriverManagerConnectionProvider:77 - using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@harri:1521:toha
11:26:35,136 INFO DriverManagerConnectionProvider:78 - connection properties: {user=foo, password=bar}
11:26:35,156 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
11:26:36,007 WARN SettingsFactory:107 - Could not obtain connection metadata
java.sql.SQLException: ORA-01017: invalid username/password; logon denied

at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:170)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:218)
at oracle.jdbc.ttc7.O3log.receive1st(O3log.java:430)
at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:247)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:269)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:375)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:266)
at java.sql.DriverManager.getConnection(DriverManager.java:525)
at java.sql.DriverManager.getConnection(DriverManager.java:140)
at net.sf.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:101)
at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:84)
at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1172)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:803)
at fi.ideal.PDMLink2.toha.TohaPanel.initDB(TohaPanel.java:421)
at fi.ideal.PDMLink2.toha.TohaPanel.<init>(TohaPanel.java:47)
at fi.ideal.PDMLink2.PDMLink.initComponents(PDMLink.java:112)
at fi.ideal.PDMLink2.PDMLink.<init>(PDMLink.java:48)
at fi.ideal.PDMLink2.PDMLink$2.run(PDMLink.java:146)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
11:26:36,017 INFO SettingsFactory:114 - Use scrollable result sets: false
11:26:36,017 INFO SettingsFactory:117 - Use JDBC3 getGeneratedKeys(): false
11:26:36,017 INFO SettingsFactory:120 - Optimize cache for minimal puts: false
11:26:36,017 INFO SettingsFactory:126 - echoing all SQL to stdout
11:26:36,017 INFO SettingsFactory:129 - Query language substitutions: {no='N', true=1, yes='Y', false=0}
11:26:36,428 INFO SettingsFactory:140 - cache provider: net.sf.hibernate.cache.EhCacheProvider
11:26:36,438 INFO SettingsFactory:152 - query cache factory: net.sf.hibernate.cache.StandardQueryCacheFactory
11:26:36,448 INFO Configuration:1130 - instantiating and configuring caches
11:26:36,478 WARN Configurator:125 - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/I:/Axles_custom11/PDMLink2/lib/hibernate-2.1/lib/ehcache-0.9.jar!/ehcache-failsafe.xml
11:26:36,578 INFO SessionFactoryImpl:119 - building session factory
11:26:38,241 INFO SessionFactoryObjectFactory:82 - Not binding factory to JNDI, no JNDI name configured
11:26:38,251 INFO UpdateTimestampsCache:35 - starting update timestamps cache at region: net.sf.hibernate.cache.UpdateTimestampsCache
11:26:38,251 WARN EhCacheProvider:97 - Could not find configuration [net.sf.hibernate.cache.UpdateTimestampsCache]; using defaults.
11:26:38,311 INFO StandardQueryCache:41 - starting query cache at region: net.sf.hibernate.cache.StandardQueryCache
11:26:38,311 WARN EhCacheProvider:97 - Could not find configuration [net.sf.hibernate.cache.StandardQueryCache]; using defaults.
***** endtry


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.