File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Help needed with Connection Parameters Format. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Storm Applied this week in the Other Open Source APIs forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Help needed with Connection Parameters Format." Watch "Help needed with Connection Parameters Format." New topic
Author

Help needed with Connection Parameters Format.

santosh malreddy
Greenhorn

Joined: Jan 09, 2013
Posts: 12

Hello All,

Could any one help me with the correct format of this..
I am writing my Hibernate Configuration file and I am not sure of how to set the connection_url property in the hibernate..
Below is the Connection Url which I have.. I am not sure of how to format it so that hibernate can accept the url..
I tried couple of ways and got all kinds of exceptions ..
I know it should be in this order jdbc:Oracle:thin:@portnumber ..but not sure how to break down the below string..
1. Connection cannot be open
2. ajva.sql.SQLException: Io exception: Invalid connection string format, a valid format is: "host:port:sid"

URL = ldap://myhost.initrode.com:port/someDN,cn=OracleContext,dc=initrode,dc=com

Can any one please help me with this..



Thanks
Olive
santosh malreddy
Greenhorn

Joined: Jan 09, 2013
Posts: 12

When I used the following String format for Connection_URL(jdbc:oracle:thin:@ldap:myhost.initrode.com:port:SID), I am getting the following exception.


Exception :
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(Unknown Source)
at oracle.net.resolver.AddrResolution.<init>(Unknown Source)
at oracle.net.ns.NSProtocol.connect(Unknown Source)
at oracle.jdbc.ttc7.TTC7Protocol.connect(TTC7Protocol.java:1687)
at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:214)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:346)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:468)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:133)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:113)
at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2119)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2115)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1339)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at com.initrode.utils.HibernateUtils.getCurrentSession(HibernateUtils.java:16)
at com.initrode.dao.GenericDaoImpl.callProc(GenericDaoImpl.java:21)
at com.initrode.GenericStoredProc.main(GenericStoredProc.java:35)
santosh malreddy
Greenhorn

Joined: Jan 09, 2013
Posts: 12

Can anyone please help me with this issue.. I am struggling with this issue from past 1 week..
Salil Vverma
Ranch Hand

Joined: Sep 06, 2009
Posts: 255

Are you trying to connect to ldap using hibernate ?
if Yes, then ldap is not a relational database, please refer the following link -

Link - http://www.oreillynet.com/sysadmin/blog/2006/05/ldap_is_not_a_database.html

Regards
Salil Verma
santosh malreddy
Greenhorn

Joined: Jan 09, 2013
Posts: 12

olivia pears wrote:
Hello All,

Could any one help me with the correct format of this..
I am writing my Hibernate Configuration file and I am not sure of how to set the connection_url property in the hibernate..
Below is the Connection Url which I have.. I am not sure of how to format it so that hibernate can accept the url..
I tried couple of ways and got all kinds of exceptions ..


Can any one please help me with this..



Thanks
Olive
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Help needed with Connection Parameters Format.