-->
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.  [ 11 posts ] 
Author Message
 Post subject: Error connecting to SQLServer Express on H. Config File
PostPosted: Sun Feb 12, 2006 10:33 pm 
Regular
Regular

Joined: Sun Feb 12, 2006 10:18 pm
Posts: 60
Location: Rosario, Argentina
I'm trying to create a reverse engineering file so I created a config file and a Hibernate console using Eclipse 3.1. I'm using a SQLServer Express 2005 database in the same PC I'm using, and the latest jdbc version from MicroSoft. I had different problems like TCP/IP ports not enabled, trusted connection, and such. I've been solving them, but I've got to a point were I cant see what's happening... I get the error message that follows:

com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'sa'.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
at com.microsoft.sqlserver.jdbc.IOBuffer.processPackets(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source)
at org.hibernate.console.FakeDelegatingDriver.connect(FakeDelegatingDriver.java:23)
...

I don't really know if there exists a user, I've sure haven't created one, and I guess 'sa' is the default user, and 'sa' it's password. If I write no username, The error message is as follows:
"com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user ''. The user is not associated with a trusted SQL Server connection."

What is the problem? Is it that I don't supply a correct username/password? I don't know any! I haven't created nor modified anything!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 13, 2006 12:08 am 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
The default setup for SQLServer includes an "sa" (system administrator) user with an empty password. You should change that ASAP. You should also not use the sa user for connecting via Hibernate: something with lesser priviledges would be better. However, the first thing you have to do is log on as sa, because that's the only way to set up new users and change passwords.

Leave the password field empty and try agian.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 13, 2006 10:01 pm 
Regular
Regular

Joined: Sun Feb 12, 2006 10:18 pm
Posts: 60
Location: Rosario, Argentina
It's still not working... this is my Hibernate config file:
...
<hibernate-configuration>
<session-factory name="SF3">
<property name="hibernate.connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
<property name="hibernate.connection.url">jdbc:sqlserver://equipo1\SQLExpress;DatabaseName=Pubs</property>
<property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
<property name="hibernate.connection.username">sa</property>
<property name="hibernate.connection.password"></property>
</session-factory>
</hibernate-configuration>


I've tried with a blank password and without the property, but neither worked... what else can I try? I forgot to say I changed the registry so SQLExpress use Mixed mode and not Windows authentication


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 13, 2006 10:07 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Can't you log in to the database in the normal way? Query analyzer, or whatever client app came with your server? Just use the same name/password as gets you in that way.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 13, 2006 10:09 pm 
Regular
Regular

Joined: Sun Feb 12, 2006 10:18 pm
Posts: 60
Location: Rosario, Argentina
It's the free (Express) version of SQL Server 2005, so it came with NOTHING at all! ;-(

I'm pretty sure the problem has to do with the Windows Authentication / Sql Server Authentication, because I tryed creating a dataconection with Visual Studio.NET 2005 and testing the connection worked fine when using WA, but didn't work when I changed it to SQL Server Auth.

Do you think that creating a new user could work? How can I do that, and how do I assign it permissions to use my database? Keep in mind that I create the user using T-SQL (I can use a connection created with VS using windos Auth.)

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 14, 2006 3:25 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
btw. they do provide a free download of their management and query analyzer tools for the free version....so there is alot of good stuff there - even for the free one.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 14, 2006 9:41 am 
Regular
Regular

Joined: Sun Feb 12, 2006 10:18 pm
Posts: 60
Location: Rosario, Argentina
Excellent!! I downloaded the Express Manager, tryed to log with SQLServer Authentication and failed. I then logged with Windows Authentication and find out that somehow, somewhy, the user sa was "login disabled"... don't ask me...

Anyway, thank you both for the help!

Tenwit, please post something so I can give you credit for trying!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 14, 2006 5:05 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Sure. I can post a query for Max: does the "Didn't Help" link in the rating bit work the opposite to the "Did Help" link? That is, do they subtract credits? I think I've lost a few credits, and they could be from this thread, seeing as I've never seen anyone click the "Didn't Help" link before. If they do subtract credits, maybe the text of the link should change to "Completely confused me and wasted my time" ;)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 1:49 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
http://forum.hibernate.org/credits.html

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 12:51 pm 
Regular
Regular

Joined: Sun Feb 12, 2006 10:18 pm
Posts: 60
Location: Rosario, Argentina
Don't worry, I checked before clicking in "no" that it didn't take you credits, otherwise, I wouldn't have said no!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 5:19 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
I guess I'm just confused then. Or maybe I created some topics while I wasn't looking, and used up my credits that way ;)


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