-->
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.  [ 4 posts ] 
Author Message
 Post subject: Newbie question on NHibernateEg Tutorial
PostPosted: Mon Jan 09, 2006 12:36 am 
Newbie

Joined: Mon Jan 09, 2006 12:27 am
Posts: 8
Hi,

A total newbie question. I just started using .NET coming from the Java world. I'm trying to use the examples from

http://nhibernate.sourceforge.net/NHibe ... ibernateEg

but I can't seem to connect to SQL Server express 2005. I configured the user "ORMExample" and I could log in using the SQL Management express Studio, create database and everything. Granted it permission on the "nhibernate" databae, but no matter what I do, I still get connection error.

System.Data.SqlClient.SqlException: SQL Server does not exist or access denied.

This is my connection string

<add key="MSSQL.ConnectionString" value="Server=(local);Database=nhibernatet;User=ORMExample;Pwd=changeme!;" />

Please help.

Hibernate version: 0.8

Mapping documents: ?



Code between sessionFactory.openSession() and session.close():
transaction = session.BeginTransaction();

for(int i=0; i<n; i++)
{
Order o = new Order();

o.Product = "P" + (i+1).ToString();
o.Quantity = n - i;
o.ComputeTotalPrice(i * 10 + n);

session.Save(o);
}




Full stack trace of any exception that occurs:
2006-01-08 23:23:19,671 [1360] INFO NHibernate.Dialect.Dialect [(null)] <(null)> - Using dialect: NHibernate.Dialect.MsSql2000Dialect
2006-01-08 23:23:19,703 [1360] INFO NHibernate.Cfg.Binder [(null)] <(null)> - Mapping class: NHibernateEg.Tutorial1A.Order -> SimpleOrder
2006-01-08 23:23:19,734 [1360] INFO NHibernate.Dialect.Dialect [(null)] <(null)> - Using dialect: NHibernate.Dialect.MsSql2000Dialect
2006-01-08 23:23:19,734 [1360] INFO NHibernate.Cfg.Configuration [(null)] <(null)> - processing one-to-many association mappings
2006-01-08 23:23:19,734 [1360] INFO NHibernate.Cfg.Configuration [(null)] <(null)> - processing one-to-one association property references
2006-01-08 23:23:19,734 [1360] INFO NHibernate.Cfg.Configuration [(null)] <(null)> - processing foreign key constraints
2006-01-08 23:23:19,750 [1360] INFO NHibernate.Cfg.Configuration [(null)] <(null)> - processing one-to-many association mappings
2006-01-08 23:23:19,750 [1360] INFO NHibernate.Cfg.Configuration [(null)] <(null)> - processing one-to-one association property references
2006-01-08 23:23:19,750 [1360] INFO NHibernate.Cfg.Configuration [(null)] <(null)> - processing foreign key constraints
2006-01-08 23:23:19,750 [1360] INFO NHibernate.Connection.ConnectionProviderFactory [(null)] <(null)> - Intitializing connection provider: NHibernate.Connection.DriverConnectionProvider
2006-01-08 23:23:19,750 [1360] INFO NHibernate.Connection.ConnectionProvider [(null)] <(null)> - Configuring ConnectionProvider
2006-01-08 23:23:40,328 [1360] ERROR NHibernate.ADOException [(null)] <(null)> - Could not create connection from Driver
System.Data.SqlClient.SqlException: SQL Server does not exist or access denied.
at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction)
at System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction)
at System.Data.SqlClient.SqlConnection.Open()
at NHibernate.Connection.DriverConnectionProvider.GetConnection()



Name and version of the database you are using: Sql Sever Express 2005

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject: Re: Newbie question on NHibernateEg Tutorial
PostPosted: Mon Jan 09, 2006 12:56 am 
Contributor
Contributor

Joined: Thu May 12, 2005 8:45 am
Posts: 226
lmxu wrote:
This is my connection string

<add key="MSSQL.ConnectionString" value="Server=(local);Database=nhibernatet;User=ORMExample;Pwd=changeme!;" />


Could this be a typo in the connection string? Database=nhibernatet


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 09, 2006 7:48 pm 
Newbie

Joined: Mon Jan 09, 2006 12:27 am
Posts: 8
d***n. First of all, you are right. My eyes were so tired, didn't spot that. Thanks :)

After I fixed that, still didn't work. So I tryed to change server=(local) to Data Source = ".\SQLExpress", that solved the problem.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 09, 2006 8:01 pm 
Contributor
Contributor

Joined: Thu May 12, 2005 8:45 am
Posts: 226
Cool. :)


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