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.  [ 5 posts ] 
Author Message
 Post subject: DataSource Configuration for Standalone application
PostPosted: Mon Oct 08, 2007 3:32 am 
Newbie

Joined: Mon Oct 08, 2007 2:56 am
Posts: 3
Hi All,

Im new to Hibernate.I have a doubt on using Datasource name in hibernate.cfg.xml.
I have a standalone java application which uses hibernate configuration.
I have been given only the datasource name configured in oc4j.I need to use that datasource name for connecting to database.
So how can i configure my hibernate configuration file.



Please help me out..

Thanks in advance....


Bye,
Sc


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 08, 2007 5:10 am 
Newbie

Joined: Mon Oct 01, 2007 8:59 am
Posts: 18
Change the code in Bold letters according to your Database

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

<session-factory>

<!-- Database connection settings -->
<property name="connection.driver_class">org.hsqldb.jdbcDriver</property>
<property name="connection.url">jdbc:hsqldb:hsql://localhost</property>
<property name="connection.username">sa</property>
<property name="connection.password">sdf</property>

<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.HSQLDialect</property>


<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>


<mapping resource="events/Event.hbm.xml"/>

</session-factory>

</hibernate-configuration>


Top
 Profile  
 
 Post subject: DataSource Configuration for Standalone application
PostPosted: Mon Oct 08, 2007 9:30 am 
Newbie

Joined: Mon Oct 08, 2007 2:56 am
Posts: 3
[quote="ganga_tanwar"]Change the code in Bold letters according to your Database

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

<session-factory>

<!-- Database connection settings -->
<property name="connection.driver_class">[b]org.hsqldb.jdbcDriver[/b]</property>
<property name="connection.url">[b]jdbc:hsqldb:hsql://localhost[/b]</property>
<property name="connection.username">[b]sa[/b]</property>
<property name="connection.password">[b]sdf[/b]</property>

<!-- SQL dialect -->
<property name="dialect">[b]org.hibernate.dialect.HSQLDialect[/b]</property>


<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>


<mapping resource="[b]events/Event.hbm.xml[/b]"/>

</session-factory>

</hibernate-configuration>[/quote]



Hi Ganga,
Thanks for the information.
Im not given details about the host name,username,password related to Database.Im given only the datasource name.Can you please let me know how to use it for standalone applications.Is it possible in hibernate.

Cheers,
Sc


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 10, 2007 5:42 pm 
Newbie

Joined: Thu Jul 26, 2007 2:28 pm
Posts: 9
I think you are missing the database name in specifying the URL connection. Please check with your database manual for the syntax. The database name usually follows the "localhost" string.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 16, 2007 10:51 am 
Newbie

Joined: Mon Oct 08, 2007 2:56 am
Posts: 3
Hi ...
Im not given the details of connection string and i dont know which IP to connect to DB. [b]Im given only the Datasource which is configured in oc4j server.So i only have the datasource details..[/b]so kindly help me oout. The above connection string format is not allowed.

Regards,
Sc


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

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.