-->
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.  [ 2 posts ] 
Author Message
 Post subject: nhibernate sql server 2005 connection errors.
PostPosted: Fri Sep 26, 2008 12:34 am 
Newbie

Joined: Thu Sep 25, 2008 11:36 pm
Posts: 1
My professor provided and example of nHibernate and asked us to run it and see how it works and then use nHibernate with our previous assignment.

Unfortunately i havent been able to my sql server 2005 instance. The error i get is an NHibernate.ADOException, "cannot open connection" and it says that the inner exception,
Quote:
{"A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)"}


I initially thought it might have been the network error, but even though i disabled the firewall it still wasnt connecting.

I also changed the settings in my SQL instance to allow for remote connections through TCP/IP and named pipes.

I did use ODBC to test the connection and it worked fine. The following is the hibernate.cfg.xml file that the professor provided.

Code:
<?xml version="1.0" encoding="utf-8" ?>

<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
   <session-factory>
      <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
      <property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
      <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
    <property  name="connection.connection_string">SERVER=xxxx-PC\SQLEXPRESS DATABASE=nHibernateExample; Trusted_Connection=Yes;Integrated Security=True;</property>
      <property name="connection.isolation">ReadCommitted</property>
      <property name="default_schema">nHibernateExample.dbo</property>
      <property name="show_sql">True</property>
      <property name="connection.release_mode">on_close</property>
      <mapping assembly="nHibernateExample"/>
   </session-factory>
</hibernate-configuration>


I was hoping someone could help me by either
1)telling me what you think i might be doing wrong or pointing me in the right direction,
2) I thought i would use the DSN to connect instead of this way and when i tested it by writing a simple connection class it worked. So is there any way i can do that here. When i tried it with
Code:
<property  name="connection.connection_string">DSN=nHibernateExample</property>
it said that "dsn" is not valid.

Thank you.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 13, 2009 5:17 am 
Newbie

Joined: Fri Mar 13, 2009 5:14 am
Posts: 1
Location: London
Did you ever get a resolution to this problem? I am experiencing a similar issue.


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