Showing posts with label exception. Show all posts
Showing posts with label exception. Show all posts

Wednesday, March 21, 2012

Hi Everyone

trying to login to ... SQL.Exception occurs

The result is SQL Server does not exist or access denied . . .

The code Im working with connection string is a forum fix from

http://p2p.wrox.com/topic.asp?TOPIC_ID37898

and the user account has been established.

<appSettings>

<add key="connection String" Value="server=(local)\MYSQLSERVERNAME; database=bids; Trusted_Connection=true"/>

</appSetting>

SQL Service Manager shows Server: SNOEMASTER

Services: MSSQLServerOLAPService

SQL Server Enterprise Manager indicates my SQL Server Group consists of

(local) (Windows NT)

and somewhere along the line I ran into something telling me to rename

(local) (windows NT) = MSSQLServer

Although when I do switch it over through the new registration wizard the connection fails. Stating MSSQLServer does not exist and come up with a error 1722 (RPC Server Unavailable) although in componet services it shows it running.

Initially I tried correctinig this because SQL SERVER repilcation does not support nicknames such as "." or (local) as server names and was given a message to

DELETE THE SQL SERVER REGISTRATION FOR THE SERVER AND REGISTER IT USING THE ACTUAL SERVER NAME MSSQLServer which component services confirmed in the properties tab "Dispaly Name" = MSSQLSERVER.

The problem seems to become two -fold because in the above connection string it maintains (local) as part of the string and instructs me to add on MYSQLSERVERNAME. ex. (local)\MYSQLSERVERNAME; database="bids"

Note: The database folder is named Bid.

Thanks for any input on this one anyone.

What you need to do is to replace MYSQLSERVERNAME with whatever your instance name is. If your SQL Server is the default instance, then user (local) or . directly rather than (local)\MSSQLSERVER or .\MSSQLSERVER

|||

Thank You!

i'm getting an access denied error but i can reset the user property from here. its better then the other errors I was recieving!

It clears up alot.! will make additional instance's of it in the future, one step at a time of course. I just installed SQL 2000 recently and want to make sure i have a solid understanding of what was happening.

http://192.168.1.65/Bid/default.aspx

icon_snowman

|||

After having reinstalled the Bid database and set the IUSR_SNOEMASTER permissions for the it from the SQL enterprise manager Bid \Properties\Security directory , i'm still recieving the double error . SQL server does not exist or access is denied..

I tried several combinations off the above resolution you mentioned but , not working yet. Will try Later.

On the second try I recieved a popup box to remember the passwaord and a confirmation that the user was added to the pool although checking the web.config file I realized I did not replace its original extension and had left it at web.txt to edit it.

Ohhhh is me

|||

System.Data.SqlClient.SqlException: Cannot open database requested in login 'bids'. Login fails. Login failed for user 'SNOEMASTER\IUSR_SNOEMASTER'. at System.Data.SqlClient.ConnectionPool.CreateConnection() at System.Data.SqlClient.ConnectionPool.UserCreateRequest() 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 Bid.Bid.Person.AddCustomer(String familyname, String givenname, String emailaddress, String password, String add1, String add2, String city, String state, String zip, String country) in C:\development\Wrox\6195\Bid\Components\Person.vb:line 169


Latest SQL.Exception recieved using

<appSettings>
<add key="ConnectionString" value="server=(local);database=bids;Trusted_Connection=true" />
</appSettings>

Anyone have any ideas or previous same problem.?

icon_snowman

|||From your latest error, your client is able to find the SQL server. The new problem is that you login account may not have login privilege to the database "bids". In order to login successfully, the login account must have login priviledge to the initial database (i.e. bids for your case).|||

In the above example the user (IUSER_SNOEMASTER) was left out of the connection string on purpose.

If I include the user in the connection string ( value="server=(local)\(IUSR_SNOEMASTER);databes=bids; . . . )then the error SQL Server does not exsist or access is denied to the user.

System.Data.SqlClient.SqlException: SQL Server does not exist or access denied. at System.Data.SqlClient.ConnectionPool.CreateConnection() at System.Data.SqlClient.ConnectionPool.UserCreateRequest() at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction

SQL Server Enterprise Manager:

Console Root|Microsoft SQL Servers|SQL Server Group|(local)(Windows NT)|Databases||bid|Users

In the right pane windows "Login Name" SNOEMASTER\ISUR_SNOEMASTER

"Database Access" status is Permit

If I use value="server=(local)\(SNOEMASTER\IUSR_SNOEMASTER); database=bids the following error occurs

Server Error in '/bid' Application.


Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Access is denied: 'Bid'.
Source Error:

Line 256: <add assembly="System.EnterpriseServices, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>

Line 257: <add assembly="System.Web.Mobile, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>

Line 258: <add assembly="*"/>

Line 259: </assemblies>

Line 260:


Source File: c:\windows\microsoft.net\framework\v1.1.4322\Config\machine.config Line: 258
Assembly Load Trace: The following information can be helpful to determine why the assembly 'Bid' could not be loaded.

=== Pre-bind state information ===

LOG: DisplayName = Bid

(Partial)

LOG: Appbase = file:///C:/Bid

LOG: Initial PrivatePath = bin

Calling assembly : (Unknown).

===

LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).

LOG: Post-policy reference: Bid

LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/bid/4a7e3fd3/b5ae6ea7/Bid.DLL.

LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/bid/4a7e3fd3/b5ae6ea7/Bid/Bid.DLL.

LOG: Attempting download of new URL file:///C:/Bid/bin/Bid.DLL.

LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).

LOG: Post-policy reference: Bid, Version=1.0.885.31008, Culture=neutral, PublicKeyToken=null



Version Information: Microsoft .NET Framework Version:1.1.4322.2300; ASP.NET Version:1.1.4322.2300

Using the code below:

<appSettings>
<add key="ConnectionString" value="server=(local);database=bids;Trusted_Connection=true" />
</appSettings>

<appSettings>
<add key="ConnectionString" value="server=.\;database=bids;Trusted_Connection=true" />
</appSettings>

The following error is created:

System.Data.SqlClient.SqlException: Cannot open database requested in login 'bids'. Login fails. Login failed for user 'SNOEMASTER\IUSR_SNOEMASTER'. at System.Data.SqlClient.ConnectionPool.CreateConnection() at System.Data.SqlClient.ConnectionPool.UserCreateRequest() at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction



|||

server=(local)\(IUSR_SNOEMASTER);
Here (IUSR_SNOEMASTER) should be the instance name, NOT USER ACCOUNT. If your SQL Server is a default instance, then just use "(local)" or "." The client user account is determined by under which Windows account your client application is running if Windows authentication is used. From your last exemple, it looks like you have a default instance and your client app is running under 'SNOEMASTER\IUSR_SNOEMASTER'. So, you need to make sure this account has login priviledge to database "bids", as I said before.

|||

OK Have Login Working:

<appSettings>
<add key="ConnectionString" value="server=(local);database=Bid;Trusted_Connection=true" />
</appSettings>

The problem was that the database=bids was not allowing it to access the Bid folder.

Initially building the data base as prescribed in the http://p2p.wrox.com/toTOPIC_ID=37898 pic.asp?the query uses a plural version of the database "bids" so I continued with this in the connection string. Doesnt work. I read about two lines in the SQL Server Books Online stating that the database names are case sensitive and made the adjustment from bids=Bid and a slight adjustment in the permissions by :

Console Root|Microsoft SQL Servers|(local)(Windows NT)|Databases|bid

In the right-hand pane right clicked properties, highlight SNOEMASTER\IUSR_SNOEMASTER

Clicked Permissions and set settings as instructed http://p2p.wrox.com/toTOPIC_ID=37898 pic.asp?

Clicked Ok then clicked Properties on the bottom. Check that Public is selected.(For what ever reason mine was not. Possibly an over sight having reinstalled the database and permissions.)

Once again set the settings as instructed http://p2p.wrox.com/toTOPIC_ID=37898 pic.asp?and clicked apply and OK and everything seems to be running as it is supposed to.

Thank You Xinwei Hong your response helped me sort it out. Knowing better I should have immediately changed bids=Bid If you recall I made a note of this in my first post at the bottom of the name difference.


Friday, February 24, 2012

Help: No mapping between account names and security IDs was done

Hi,
My report returns this error: "No mapping between account names and security
IDs was done. (Exception from HRESULT: 0x80070534)", I have spent a lot of
time to solve (set up Role/Datasource etc) but fail. I do know what the real
issue is, can you help me or direction to solve this problem.
My reporting server in DMZ zone and talk to internal lan SQL server via
opened 1433 port.
Many Many Thanks.
FRankiePlease help
> Hi,
> My report returns this error: "No mapping between account names and
> security IDs was done. (Exception from HRESULT: 0x80070534)", I have spent
> a lot of time to solve (set up Role/Datasource etc) but fail. I do know
> what the real issue is, can you help me or direction to solve this
> problem.
> My reporting server in DMZ zone and talk to internal lan SQL server via
> opened 1433 port.
> Many Many Thanks.
> FRankie
>
>

Sunday, February 19, 2012

HELP: "text and varchar are incompatible" agrivation!

I am trying to do a simple select statement on my db but keep getting the fallowing exception being thrown ...

System.Web.Services.Protocols.SoapException was unhandled
Actor=""
Lang=""
Message="System.Web.Services.Protocols.SoapException: Server was unable to process request. --> System.Data.SqlClient.SqlException: The data types text and varchar are incompatible in the equal to operator.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader()
at RelayService.ValidAccessID(String ID) in C:\Documents and Settings\Dean\My Documents\Visual Studio 2005\Projects\MsgSRX\MsgSRXService\App_Code\RelayService.vb:line 193
at RelayService.SendMessage(String msg, String AccessID, Int64& MsgID) in C:\Documents and Settings\Dean\My Documents\Visual Studio 2005\Projects\MsgSRX\MsgSRXService\App_Code\RelayService.vb:line 377
-- End of inner exception stack trace --"
Node=""
Role=""
Source="System.Web.Services"
StackTrace:
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at ChatClient.MsgSRX.RelayService.SendMessage(String msg, String AccessID, Int64& MsgID) in C:\Documents and Settings\Dean\My Documents\Visual Studio 2005\Projects\MsgSRX\ChatClient\Web References\MsgSRX\Reference.vb:line 342
at ChatClient.Form1.btnSend_Click(Object sender, EventArgs e) in C:\Documents and Settings\Dean\My Documents\Visual Studio 2005\Projects\MsgSRX\ChatClient\Form1.vb:line 13
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at ChatClient.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

... Here is the source code to the method I am using ...

Private Function ValidAccessID(ByVal ID As String) As Boolean
Dim conn As New SqlConnection()
conn.ConnectionString = ConfigurationManager.ConnectionStrings("dbConnect").ConnectionString

Dim cmd As String
cmd = "SELECT AccessID, ExpireTime "
cmd &= "FROM AccessIDNumbers "
cmd &= "WHERE AccessID IN ('" & ID & "')"
' cmd &= "WHERE AccessID ='@.ID'"
Dim C As New SqlCommand(cmd, conn)
' C.Parameters.AddWithValue("@.ID", New SqlTypes.SqlString(ID))
' C.Parameters.Item("@.ID").SqlDbType = SqlDbType.Text

conn.Open()

Dim Count As Integer = 0
Dim reader As SqlDataReader = C.ExecuteReader
Dim expired As Boolean = False
If reader.HasRows Then
While reader.Read
Count += 1
Dim et As SqlTypes.SqlDateTime
et = SqlTypes.SqlDateTime.Parse(reader("ExpireTime"))
Dim ct As New SqlTypes.SqlDateTime(Now)
If ct > et AndAlso expired = False Then expired = True
End While
End If

conn.Close()
C.Dispose()
C = Nothing
conn.Dispose()
conn = Nothing

Return expired = False
End Function

... the problem is with the cmd &= "WHERE AccessID IN ('" & ID & "')" statement. How Can I get this to work properly!!! My data types for the AccessIDNumbers table are as fallows ..

    UserName -> text -> nulls not allowedAccessID -> text -> nulls not allowedCreationTime -> datatime -> nulls not allowedExpireTime -> datatime -> nulls not allowedCurrentTable -> text -> nulls allowed
I don't understand why I'm getting this error!!!

Are you actually using 'text' columns, or 'varchar' columns?

|||I'm using text columns. What is the difference between text and varchar? They seem like they should be basically the same thing and as such the db engine should be able to compare them?|||

The 'text' datatype is a BLOB, which in short means that it is stored in a separate location than the rest of the data in the record. Instead of storing the actual value, the record stores a 16-bit pointer that directs SQL to the actual file that stores this data (by default, anyway. this can be changed). The max for this type of field is 2 GB.

'varchar,' on the other hand, is a standard type, which means it is stored with the actual record data. The limit for this type is 8,000 characters (=8 KB). This is actually preferable to a 'text' column if you are using 8,000 or fewer characters.

If you still want to use the text datatype, you may need to do conversions in your SQL statements (I haven't tried this--just a suggestion to see if you can get it to work).

' instead of thiscmd &="WHERE AccessID IN ('" & ID & "')"' try thiscmd &= "WHERE CAST(AccessID AS VARCHAR) ='" & ID & "'"