-->
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.  [ 6 posts ] 
Author Message
 Post subject: Exception : database product name cannot be null
PostPosted: Fri Sep 02, 2005 4:14 pm 
Newbie

Joined: Fri Sep 02, 2005 3:51 pm
Posts: 17
Hi,
I'm trying to set up a simple test project to use Hibernate with a table in out exisitng MS SQL database, but I get an exception with the message "database product name cannot be null".

I have the config file for Hibernate set up with the correct values. The code seems to be failing at the Configuration's buildsessionfactory() method.
Could someone pls tell me why this might be happening?
Thanks.

the config file is shown below

Code:
<?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>
        <property name="hibernate.connection.driver_class">com.microsoft.jdbc.sqlserver.SQLServerDriver</property>
        <property name="hibernate.connection.url">jdbc:microsoft:sqlserver://28XC381RIZWAN\UHMINSTANCE:1433;DatabaseName=uhm</property>
        <property name="hibernate.connection.username">uhm</property>
        <property name="hibernate.connection.password">123</property>
        <property name="dialect">org.hibernate.dialect.SQLServerDialect</property>
        <property name="show_sql">true</property>
        <property name="transaction.factory_class">
             org.hibernate.transaction.JDBCTransactionFactory
        </property>
        <property name="hibernate.cache.provider_class">
             org.hibernate.cache.HashtableCacheProvider
        </property>
        <property name="hibernate.hbm2ddl.auto">update</property>

        <mapping resource="Patient.hbm.xml"/>

    </session-factory>

</hibernate-configuration>


Top
 Profile  
 
 Post subject: server name
PostPosted: Fri Sep 02, 2005 11:55 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
It looks like wrong server name, it should be IP name or IP address, not the MS Network name.

http://support.microsoft.com/default.as ... -us;313100

Try using IP address, something like:
jdbc:microsoft:sqlserver://192.169.1.71:1433;databasename=xxx

And if that will work then replace IP with DNS name of the server

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 06, 2005 10:11 am 
Newbie

Joined: Fri Sep 02, 2005 3:51 pm
Posts: 17
Thanks for the response. I tried specifying the network IP but that didnt help either. Still get the same error. Here is some more info, may be it may help. I have the following structure under eclipse

lib
source
+com
hibernate.cfg.xml
classes
+com

the xml file gets copied to classes folder b the build process. The hibernate documentation specifies that the hibernate.cfg.xml file should be placed in the root of the classpath. Now if I am running my application under eclipse, is it possible that the 'root of the classpath' is not the classes directory (since lib is also in the classpath)?
is there any way I can determine where hibernate is looking for the hibernate.cfg.xml file??

Any help is appreciated.

Thanks,
-Riz.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 06, 2005 10:33 am 
Regular
Regular

Joined: Mon Aug 29, 2005 9:46 am
Posts: 102
Try to put it inside the "source" dir instead of the "com" dir. That's how it works for me.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 06, 2005 10:34 am 
Newbie

Joined: Fri Sep 02, 2005 3:51 pm
Posts: 17
sorry, that was a mistake. it is inside the source diretory, and gets copied to the classes directory during the build.


Top
 Profile  
 
 Post subject: lets make it simpler
PostPosted: Tue Sep 06, 2005 10:42 am 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
To make things simpler: could you try to write simple straight JDBC code to connect to you server and select something?

That will allow pinpointing the problem.

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.