This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of Darcy DeClute's Scrum Master Certification Guide: The Definitive Resource for Passing the CSM and PSM Exams and have Darcy DeClute on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

SQL exception when using datasource

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using 2 databases.
One is mysql and c3p0 datasource is created for it in hibernate.properties file. The contents of properties file are pasted below:

hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.connection.driver_class=com.mysql.jdbc.Driver
hibernate.connection.username=root
hibernate.connection.password=ENC(7Ba39G6WIPTVKJ1wpe8nSg==)
hibernate.connection.url=jdbc:mysql://localhost:3306/xyz?autoreconnect=true&zeroDateTimeBehavior=convertToNull&jdbcCompliantTruncation=false


Another is oracle and a datasource is created for it in weblogic. Configuration for using this datasource is in separate configuration file abc.configuration.xml file. I am creating a separate session factory using this configuration file when server starts up. The file is like this.

<hibernate-configuration>
<session-factory>
<property name="connection.datasource">ABC0DS</property>
<property name="show_sql">true</property>
<property name="default_schema">SD01</property>
<property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
<property name="jndi.url">t3://localhost:7001</property>;
<property name="jndi.class">weblogic.jndi.WLInitialContextFactory</property>
</session-factory>
</hibernate-configuration>

In the process of initializing this session factory hibernate is somehow using user name and password defined in hibernate.properties file and ofcourse the authentication fails. Session factory does not get created.

Can anyone tell me why this may be happening?
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ashish,

The last time I used Hibernate I discovered that it cannot handle 2 data sources. I don't believe Hibernate has been updated since.

Are you sure you can use 2 data sources?

-Shannon
 
Ashish Sathaye
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh yes you can. We have overcome this problem of multiple databases. Indeed you can use as many DB as you want. But i am still wondering why hibernate would use user name and password from one factory into other for authentication. Also it used user name and password for authentication of app server managed datasource. Hence i posted it here.

-Ashish
 
Thank you my well lotioned goddess! Here, have my favorite tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic