Connection to database problem

Last post 05-16-2008 3:42 PM by guitarboy8d6. 6 replies.

Sort Posts:

  • Connection to database problem

    05-14-2008, 4:18 PM

    I have created a site on my local mechine and it works fine. It intgrates with a MSSQL Database I can insert, update, everything. I have a Server 2003 box with MSSQL 2005 Express installed on it and IIS running. When I upload the site files and the database file the site can't update or insert things into the database. The site crashes and I get error messages. I setup the server and SQL myself and it is the first time I have done that. Is there anything I should be looking for. I am thinking it is a rights managment problem on the SQL side since select statments work. But no other types of database communication is aloud. How would I go about finding the answer to this problem so I can run my app right and in the most secure manner?

    Thanks, 

     

  • Re: Connection to database problem

    05-14-2008, 4:33 PM
    • Loading...
    • kamii47
    • Joined on 05-26-2005, 4:04 PM
    • Karachi, Pakistan
    • Posts 1,520
    What's the error message ?
    Kamran Shahid(MCSD.NET,MCPD.net[web])
    Sr. Software Engineer
    Netprosys Inc.
    www.netprosys.com

    Remember to click "Mark as Answer" on the post that helps U
  • Re: Connection to database problem

    05-14-2008, 5:00 PM

     

    1    Server Error in '/' Application.
    2    --------------------------------------------------------------------------------
    3    
    4    Login failed for user 'RocketStream'. The user is not associated with a trusted SQL Server connection. 
    5    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
    6    
    7    Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'RocketStream'. The user is not associated with a trusted SQL Server connection.
    8    
    9    Source Error: 
    10   
    11   
    12   Line 5296:            if (((command.Connection.State & System.Data.ConnectionState.Open) 
    13   Line 5297:                        != System.Data.ConnectionState.Open)) {
    14   Line 5298:                command.Connection.Open();
    15   Line 5299:            }
    16   Line 5300:            object returnValue;
    17    
    18   
    19   Source File: c:\WINNT\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\1da25280\65df3ee1\App_Code.-zg60z5h.0.cs    Line: 5298 
    20   
    21   Stack Trace: 
    22   
    23   
    24   [SqlException (0x80131904): Login failed for user 'RocketStream'. The user is not associated with a trusted SQL Server connection.]
    25      System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +739123
    26      System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188
    27      System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1956
    28      System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +33
    29      System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +170
    30      System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +349
    31      System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +181
    32      System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +170
    33      System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +359
    34      System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +28
    35      System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +424
    36      System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
    37      System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +496
    38      System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82
    39      System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
    40      System.Data.SqlClient.SqlConnection.Open() +111
    41      RocketstreamSupportTableAdapters.Customers.CheckUserName(String UserName) in c:\WINNT\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\1da25280\65df3ee1\App_Code.-zg60z5h.0.cs:5298
    42      _Default.CheckLogin() in C:\Inetpub\wwwroot\site\signup.aspx.vb:24
    43      _Default.btnSubmitComp_Click(Object sender, EventArgs e) in C:\Inetpub\wwwroot\site\signup.aspx.vb:130
    44      System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
    45      System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
    46      System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
    47      System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
    48      System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
    49      System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
    50   
    51    
    52   
    53   
    54   --------------------------------------------------------------------------------
    55   Version Information: Microsoft .NET Framework Version:2.0.50727.832; ASP.NET Version:2.0.50727.832 
     
     
    That is just one of the areas I get diffrent ones on diffrent pages with diffrent statments. Here I have an SQL Data Source Selecting all items from a Table.
    I usually don't get the errors on select statements but It looks like I am now.
     If I go to a page where is does a select statment based on users input into a text box it works.
    But none of my update statments work, nor insert statements. 
    I have been playing with some diffrent settings on the server that I am not quite sure what they all are. 
    I realize this particular error is Login Failed. I have played with some of those settings, what I don't understand is how can it sometimes login and sometimes not? I Originally had it setup as windows authentication, then I tryed the other type and now I am back to windows authentication. I am more used to mysql and php. That is were I got my start in development, and this is way diffrent. 
    I just need someone to point me on the basics of MSSQL user and database managment, because that is were I think I am mucking it up.
    
     
  • Re: Connection to database problem

    05-15-2008, 2:09 AM
    • Loading...
    • kamii47
    • Joined on 05-26-2005, 4:04 PM
    • Karachi, Pakistan
    • Posts 1,520

    Problem is your DB connection Check http://forums.asp.net/t/1247926.aspx 

    Also post what is the connection string u r using ? 

    Kamran Shahid(MCSD.NET,MCPD.net[web])
    Sr. Software Engineer
    Netprosys Inc.
    www.netprosys.com

    Remember to click "Mark as Answer" on the post that helps U
  • Re: Connection to database problem

    05-15-2008, 5:31 PM

    Ok I read through the other forum and turned the remote connection allowed with named pipes and TCP/IP. What are named pipes?

    Also I read the link at the bottom about server running in mixed mode. I now have it running in mixed mode and added a user following there directions. I also added that user to the Database I want it to accesss. When creating the user I selected to set that user's default database to the database for my app.

    I am not totally understanding the whole windows authentication mode vs. SQL I understand the Authentication with username and password vs windows account. But what I don't understand is when one is and is not approprieate. All the examples I saw when searching google were talking about running a network with multiple OS' connecting to the Database. Unless I am missunderstanding by defualt ASP should connect to the database through the SA users under windows authentication automatically. Right? My main goal in this whole venture is to learn more about ASP.Net and MSSQL world. I have dealt a lot more wiht php and mysql in the past and figured I should try some of this stuff out. There are some things in this world that just arn't as apperent to me.

    Here is my connection string.

    <add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\RocketStreamSupport.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>

    I did try and edit it some before on my own based on a few bad tutorials. Now that I have found asp.net's tutorial's and foums my life has been alot easier.

    I realize this string will have to be edited from what it is now.

    Thanks for your help,  

     

  • Re: Connection to database problem

    05-16-2008, 2:45 AM
    • Loading...
    • ShivaKarthik
    • Joined on 04-15-2008, 9:11 AM
    • Hyderabad
    • Posts 196

     

    1    "ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\RocketStreamSupport.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
    
    Hi Buddy,
    The problem seems to be in the connectionstring in the sense your connection string may be somewat like 
    Datasource=(ur system name\sqlexpress)
    and when you are trying to execute it it is taking the connectionstring of your local computer 
    please define the syntax for remote connections in your connectionstring it will work definitely
    Mark As Answer if this helps you
    Further Queries Recommended
    Happy CodingWink
     
     
    Regards,
    B.ShivaKarthik
    Software Engineer
    Hyderabad,India
  • Re: Connection to database problem

    05-16-2008, 3:42 PM

    ok so in my case I have to use the comp name\sqlexpress

    What If in future I am using shared hosting and don't know the comp. name, can I use IP address, or is there some kind of catch all?

    Or what if I want my app to refernece a database off of the server the .net application is on?

    Also I tryed to connect with Sever manager studio from my local mechine to the server. I used the IP address of the serv, and usrid and pw I setup and it will not connect any ideas?

    Also why does the ./sqlexpress not work when I upload it. The uploaded web.config is on the some box as the uploaded database. And it is in the ap datafolder just as it is on my local HD.

Page 1 of 1 (7 items)