• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

hibernate code and data source

 
Ranch Hand
Posts: 375
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I created a data source in a pplication server. My hibernate code is stand alone java code. can I use that data source to access database without deploying my hibernate code to the server ? How ?

Thanks.
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ben,

I assume you mean that you configured a JNDI datasource on your application server. I'm assuming that you are asking if you can access the datasource with non-hibernate code.

JNDI is not a hibernate-only technology: I've used it with vanilla JDBC plenty of times. This is a bit Off-Topic for the ORM forum, but the code would look something like this (without exception checking):



If this isn't what you were asking, my apologies.

Jason



Originally posted by ben oliver:
I created a data source in a pplication server. My hibernate code is stand alone java code. can I use that data source to access database without deploying my hibernate code to the server ? How ?

Thanks.

 
ben oliver
Ranch Hand
Posts: 375
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jason, you got me right partially. yes I created a datasource inside an application server. Meanwhile I have a standalone java code (it IS hibernate) that I do NOT want to deploy to the server. For example, I can write a simple table query and print-out code using hibernate but I do NOT deploy this code to the application server. The code is not a j2ee code, it is just a print out type code. Ok ?

Now for the code it has the hibernate configuration file. In the file I intend to specify a datasource that is configured on the application server so that the code can use. can I do that and how ? I am sure I can do it if the code is deployed as a j2ee app to the server. but i am not sure if it is ok if the hibernate code is not deployed to the server ?

Got it ?

Thanks !
 
Jason Ferguson
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay, I understand now... you want to use the JNDI Datasource that you configured on the application server with a local application (with a remote database).

I've never tried this before... can anyone else shed some light on this?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic