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.  [ 3 posts ] 
Author Message
 Post subject: Newbie : ms sql server connection problem
PostPosted: Mon Jan 29, 2007 1:28 pm 
Newbie

Joined: Tue Dec 09, 2003 8:04 am
Posts: 5
Hibernate version: 1.2.0 beta 3

Mapping documents:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="nhibernate" type="System.Configuration.NameValueSectionHandler, System,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>

<nhibernate>
<add
key="hibernate.connection.provider"
value="NHibernate.Connection.DriverConnectionProvider"
/>
<add
key="hibernate.dialect"
value="NHibernate.Dialect.MsSql2000Dialect"
/>

<add
key="hibernate.connection.driver_class"
value="NHibernate.Driver.SqlClientDriver"
/>
<add
key="hibernate.connection.connection_string"
value="Server=localhost; Initial Catalog=zoom; User ID=zoom;Password=zoom"
/>
<add
key="hibernate.connection.isolation"
value="ReadCommitted"
/>

</nhibernate>

<!-- other app specific config follows -->
</configuration>

Code between sessionFactory.openSession() and session.close():
session = SessionManager.GetSession();
User user = new User();
user.Username = "manu";
user.Password = "test";
user.FirstName = "Manu";
user.LastName = "Kumar";
user.EmailAddress = "manu@manu.com";
DataAccess access = new DataAccess();
Console.WriteLine(access.Load("from User" , session));
Full stack trace of any exception that occurs:
Unhandled Exception: NHibernate.ADOException: cannot open connection ---> System
.Data.SqlClient.SqlException: An error has occurred while establishing a connect
ion to the server. When connecting to SQL Server 2005, this failure may be caus
ed by the fact that under the default settings SQL Server does not allow remote
connections. (provider: Named Pipes Provider, error: 40 - Could not open a conne
ction to SQL Server)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception
, Boolean breakConnection)
Name and version of the database you are using:
MS SQL Server 2005 Express Edition
The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

I have set the SQL Server connection modes to TCP/IP and Named Pipes and set it to allow connection from both local and remote.

When i try to generate DDL through NHibernate.Tool.hbm2ddl.SchemaExport , it works fine. However , as soon as i try to load a user entity i get this exception.

please help.
regards,
Manu


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 30, 2007 5:09 am 
Beginner
Beginner

Joined: Mon Jan 08, 2007 11:59 pm
Posts: 31
In your connection string I see Server=localhost; and you are using SQL Server Express 2005, right.

The default instance for Express would be localhost\SQLEXPRESS
If you have not changed this you should try using Server=localhost\SQLEXPRESS;

Job Samuel.


Top
 Profile  
 
 Post subject: ms sql server connection problem
PostPosted: Tue Jan 30, 2007 11:43 am 
Newbie

Joined: Tue Dec 09, 2003 8:04 am
Posts: 5
samueljob wrote:
In your connection string I see Server=localhost; and you are using SQL Server Express 2005, right.

The default instance for Express would be localhost\SQLEXPRESS
If you have not changed this you should try using Server=localhost\SQLEXPRESS;

Job Samuel.


Thanks so much Samuel ! That solved my problem.

regards,
Manu


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