aspose file tools*
The moose likes Object Relational Mapping and the fly likes Hibernate + Spring + Oracle: Help, can't get connection working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate + Spring + Oracle: Help, can Watch "Hibernate + Spring + Oracle: Help, can New topic
Author

Hibernate + Spring + Oracle: Help, can't get connection working

laura mccord
Ranch Hand

Joined: Feb 10, 2009
Posts: 108
I'm having problems troubleshooting my hibernate connection.

I can telnet to the remote server and port so it doesn't look like a firewall issue.

Frankly, I am only experienced with creating a new database with hibernate and in this case I am trying to connect to an existing read-only database.

I am receiving the following error and I'm not sure where to start debugging:




My first reaction was that perhaps my mapping is not correct and the data types do not match. It's an Oracle database and all of the table fields are varchar2() so I am using 'string' as the type. Or, maybe my mapping to column names and the table name is not working. Below is my mapping:



Here is also my hibernate.cfg.xml file:



Finally, this is my implementation of querying the table


Thanks for any help you can offer.
Jayesh A Lalwani
Bartender

Joined: Jan 17, 2008
Posts: 2451
    
  28

Probably the problem is that the validation query in your data source is not valid. Look at how the data source is defined
laura mccord
Ranch Hand

Joined: Feb 10, 2009
Posts: 108
My datasource.properties file looks like this:



Then my applicationContext.xml looks like the following:




Can't think of anything that I am missing, but I'm still receiving the same error:

ERROR [uPortal-PortletExecutor-1-RENDER-[ucm-checklist-portlet]] portlet.DispatcherPortlet.[] Jan/09 10:47:24 - Could not complete request
org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: Cannot open connection; uncategorized SQLException for SQL [???]; SQL state [null]; error code [0]; Cannot create PoolableConnectionFactory (Invalid SQL type); nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Invalid SQL type)


Thanks

laura mccord
Ranch Hand

Joined: Feb 10, 2009
Posts: 108
How can I confirm that a connection was made successfully before trying a select query?

This is what I did and I suppose it's working since I'm receiving the message that it's open?




Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate + Spring + Oracle: Help, can't get connection working