473,657 Members | 2,380 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can't connect to SQL Server

Using this code:

Dim oConn As SqlClient.SqlCo nnection
oConn = New SqlClient.SqlCo nnection()
oConn.Connectio nString = "..." 'Connection string I got via an .udl file
oConn.Open()

I get an error here:

Request for the permission of type System.Data.Sql ClientPermissio n,
System.Data,
Version=1.0.500 0.0,Culture=neu tral,PublicKeyT oken=b77a5c5619 34e089 failed

I tried to connect to an other database I normaly can connect to in an other
application: same error
I copied the connection string from an application that can connect to the
database and tried to connect: same error
I moved my database local and tried to connect: same error.


--
RW
Jul 18 '07 #1
3 2109
On Wed, 18 Jul 2007 10:10:01 +0200, RW <RW@discussions .microsoft.comw rote:
Using this code:

Dim oConn As SqlClient.SqlCo nnection
oConn = New SqlClient.SqlCo nnection()
oConn.Connectio nString = "..." 'Connection string I got via an .udl file
oConn.Open()

I get an error here:

Request for the permission of type System.Data.Sql ClientPermissio n,
System.Data,
Version=1.0.500 0.0,Culture=neu tral,PublicKeyT oken=b77a5c5619 34e089 failed

I tried to connect to an other database I normaly can connect to in another
application: same error
I copied the connection string from an application that can connect tothe
database and tried to connect: same error
I moved my database local and tried to connect: same error.

It would really help if you provide as much information as you can in these cases. From what you have written, it would appear that the database (or at least the server) is healthy, yet your application is denied access to this specific database, or to all databases?

If you are using a login, verify that the login exists on the sql serverand has proper access. Verify that the server allows logins and not windows authentication only.

If you are accessing using a web application, verify the proper, you need to take the user account the web application is running under into account when using windows authentication.

If you are developing a webpart in sharepoint or similar, you may have trust considerations as well.

....

--
Happy coding!
Morten Wennevik [C# MVP]
Jul 18 '07 #2
Thanks Morton

In the meantime I found the solution for my problem.
It was a security problem. My application was located on a shared server.
I just needed to add that server to the trusted list with mscorcfg.msc.

see atrticle: http://msdn2.microsoft.com/en-us/lib...xc(vs.71).aspx
--
RW
"Morten Wennevik [C# MVP]" wrote:
On Wed, 18 Jul 2007 10:10:01 +0200, RW <RW@discussions .microsoft.comw rote:
Using this code:

Dim oConn As SqlClient.SqlCo nnection
oConn = New SqlClient.SqlCo nnection()
oConn.Connectio nString = "..." 'Connection string I got via an .udl file
oConn.Open()

I get an error here:

Request for the permission of type System.Data.Sql ClientPermissio n,
System.Data,
Version=1.0.500 0.0,Culture=neu tral,PublicKeyT oken=b77a5c5619 34e089 failed

I tried to connect to an other database I normaly can connect to in an other
application: same error
I copied the connection string from an application that can connect to the
database and tried to connect: same error
I moved my database local and tried to connect: same error.



It would really help if you provide as much information as you can in these cases. From what you have written, it would appear that the database (or at least the server) is healthy, yet your application is denied access to this specific database, or to all databases?

If you are using a login, verify that the login exists on the sql server and has proper access. Verify that the server allows logins and not windows authentication only.

If you are accessing using a web application, verify the proper, you need to take the user account the web application is running under into account when using windows authentication.

If you are developing a webpart in sharepoint or similar, you may have trust considerations as well.

....

--
Happy coding!
Morten Wennevik [C# MVP]
Jul 18 '07 #3
I found the solution for my problem.
It was a security problem. My application was located on a shared server.
I just needed to add that server to the trusted list with mscorcfg.msc.

see atrticle: http://msdn2.microsoft.com/en-us/lib...xc(vs.71).aspx
--
RW
"RW" wrote:
Using this code:

Dim oConn As SqlClient.SqlCo nnection
oConn = New SqlClient.SqlCo nnection()
oConn.Connectio nString = "..." 'Connection string I got via an .udl file
oConn.Open()

I get an error here:

Request for the permission of type System.Data.Sql ClientPermissio n,
System.Data,
Version=1.0.500 0.0,Culture=neu tral,PublicKeyT oken=b77a5c5619 34e089 failed

I tried to connect to an other database I normaly can connect to in an other
application: same error
I copied the connection string from an application that can connect to the
database and tried to connect: same error
I moved my database local and tried to connect: same error.


--
RW
Jul 18 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3498
by: webhead74 | last post by:
Hi, I've worked on this for a couple of days & can't figure out what I'm doing wrong. I'm trying to connect to a remote AS400 database using odbc & php. Here's my environment: Server: RedHat ES 2.1 IBM HTTP Server (was pre-built by IBM): Server version: IBM_HTTP_Server/2.0.47.1 Apache/2.0.47
0
9006
by: Ryan Stewart | last post by:
I'm running MySQL server on a WinXP box at home. I have a cable modem/router. I've set up port forwarding on port 3306 to the machine running MySQL. I can connect locally just fine, but when I try to connect from a remote location using: mysql -h xxx.xxx.xxx.xxx -P 3306 -u root -p mysql I get: ERROR 2003: Can't connect to MySQL server on 'xxx.xxx.xxx.xxx' (10061) When I try:
0
4536
by: Zorba.GR | last post by:
IBM DB2 Connect Enterprise Edition v8.2, other IBM DB2 (32 bit, 64 bit) (MULTiOS, Windows, Linux, Solaris), IBM iSoft Commerce Suite Server Enterprise v3.2.01, IBM Tivoli Storage Resource Manager Express Edition v1.3.2 Win, IBM Tivoli System Automation v1.2.0 Linux, IBM Tivoli Workload Scheduler Virtualized Data Centers v8.2 , other IBM Tivoli CDs, WEBSPHERE EVERYPLACE MOBILE PORTAL v5.0 - ALTIUM , other IBM WebSphere Business CDs...
18
4335
by: Jen | last post by:
I'm using Microsoft's own VB.NET FTP Example: http://support.microsoft.com/default.aspx?scid=kb;en-us;832679 I can get the program to create directories, change directories, etc., but I can't get it to upload a file to the FTP server. I just get a "Cannot connect to remote server" error after this TRY: s = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
0
2755
by: Clodoaldo Pinto | last post by:
Can't connect to postgresql server php error log message: PHP Warning: pg_connect() : Unable to connect to PostgreSQL server: could not connect to server: Permission denied\n\tIs the server running on host &quot;127.0.0.1&quot; and accepting\n\tTCP/IP connections on port 5432? php connection string:
14
7027
by: Marcus | last post by:
I have a function that simply returns TRUE if it can connect to a particular Sql Server 2005 express, or FALSE if it cannot. I am getting some strange error codes returned when the computer that sql server resides on is not reachable. The error is different depending on the connection string that I use. If I use the following connection string: "server=192.1.1.1; Initial Catalog=master; uid=The_User; password=The_Password; Connect...
5
4222
by: Jack | last post by:
Hello, I had SQL2000 server running fine on the windows 2003 box. I then installed SQL 2005 Express. They both worked together fine. I then uninstalled SQL 2005 Express and installed SQL 2005 Server. But when I open SQL Server Management Studio, I can only connect to the SQL 2000 engine. In the Object explorer, it says v8.0.2039 (which I think is SQL 2000 Server, because I can see the existing SQL 2000 databases). How can I get SQL...
12
1606
by: smerf | last post by:
I have searched high and low (and even in some places I'd like to forget I ever saw) for the information that will tell me exactly how the Nat2Nat server for UltraVNC works (not just a vague diagram, but the code needed - at least psuedocode - to connect the 2 clients) . (You can see it at http://www.uvnc.com/addons/nat2nat.html.) I get the diagram and all, but how exactly would you get 2 UDP connections to your UDP server to start...
2
9787
by: jeffhan | last post by:
we have os/400 db2 database at the backend. i installed db2 v9 connect server on one windows server which is locating the same network with database server. now how to i configure the connect server and client, so client could access the database through the connect server? like that: db2client <--db2 connect server <--db2 mainframe database
0
1276
by: Hugo Kornelis | last post by:
On Wed, 3 Sep 2008 00:52:26 -0700 (PDT), Ascerbus wrote: Hi Ascerbus, What makes you think that it's trying to connect. Do you get any error messages? Is the connect dialog box still visible, or does it disappear? What panes exactly are in view after you have clicked the connect button, and what is in these panes?
0
8394
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7327
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4152
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1615
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.