Showing posts with label explorer. Show all posts
Showing posts with label explorer. Show all posts

Sunday, March 11, 2012

Connection to the database on MSDE

Hi,

I installed MSDE and the sample databases with it. They work fine.

Well I am using the server explorer of visaula studio standard 2002. I can see all the sample databases there and connect to them as well.

1.
---------------------
Now i created a new database named "testDb" and in a similar fashion i am using windows login thingy.

When i write my connection string in the program now it doesnt work

string connectionStr =@."Server=IMRAN\NetSDK;" + "Integrated Security=SSPI;" + "Connection Timeout=7;" + "Database=testDB;";

If i replace my Database clause to Northwind it works absolutely fine.

The ERROR it gives is:

Cannot open database requested in login 'testDB'. Login fails. Login failed for user 'IMRAN\ASPNET'.

Why is this happenning? :(.

============================================

2.
--------
How can i configure the MSDE to use the SQL Authentication.
It doesnt allow me to do that?

Thanx Heaps,
ImranHi Guys,

I got the solution for the first problem of mine.

We need to Grant Access to the ASPNET user

The ASP.NET process runs under the MACHINENAME\ASPNET account. In order for the data access samples to access the database, this user must be granted rights to the sample databases. To manually grant access to the ASPNET user, replace MACHINENAME with the name of your computer, and run the following commands from the command line. Note: The path to the osql.exe command must be located in your PATH environment variable.

osql -E -S (local)\NetSDK -Q "sp_grantlogin 'MACHINENAME\ASPNET'"

osql -E -S (local)\NetSDK -d DATABASENAME -Q "sp_grantdbaccess 'MACHINENAME\ASPNET'"
osql -E -S (local)\NetSDK -d DATABASENAME -Q "sp_addrolemember 'db_owner', 'MACHINENAME\ASPNET'"

and if you are using the Sql Server Enterprise then just open the Enterprise manager and give the database rights to the [machine_name]\ASPNET user in the database users

Hope that can be useful for someone there.

Thanx.
Imran|||Hi,
Glad you found an answer. BTW, ASPNET is the default user name for Windows 2000 and XP, but it's 'NETWORK SERVICE' on Windows 2003 Server running native mode with IIS 6 (default). I found that out the hard way. After adding 'NT AUTHORITY\NETWORK SERVICE' as a login to SQL Server (MSDE), I was able to have my application access the database using the VS and IE browsers - clearying a major roadblock for me.

Also, you can use the Web Data Administrator to create a new login, if you don't have Enterprise manager, or don't want to use OSQL.

MS sure didn't make ASP.NET appliaction database access clear and simple! Maybe ASP.NET 2.0 will, but at what cost?

Good luck with your projects.

Connection to SQL2005 Database Engine

On one server I connect to I always get this message when I try to launch object explorer.
TITLE: Microsoft SQL Server Management Studio
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
Insert Error :column name or number of supplied values doesn't match.. Error:213.

Sometimes I can run refresh, and it will eventually connect.

Is the version of sql server you're connecting to the same as the one that was installed where you're launching SSMS? If not, and depending on the versions, underlying procs that SSMS depend on may be different between the two versions.
|||The server is SQL Standard Sept. release, and I installed the same version, workstation only on my station. I eventually get the browser to work. Other server is a June release std and it doesn't do this. I reinstalled every workstation component, and now I have SSIS working but still getting the browser error looking at objects on this server. BTW this server has been installed a couple of times .|||I found out that I had some possible old components in the install dir, so I started over again with fresh Sept install. When I did that , I noticed again my SQL2000 Ent Mgr quit working as I uninstalled. Prev. I had repatched SQL sp4 then reran setup of 2005. This time I left it alone , finished up install, and lo and behold the object browser works AND SQL 2000 Ent. MGr. What I am trying to deduce is the sqldmo dll might be involved . Does SQL2005 install replace that in the Windows directory , and it happens to have backwards compatibility so the 2000 still can use it ? Here is a link to the article. All is right for the moment, I shall cherish it at least the SQL2005 world a bit better.

http://www.aspfaq.com/sql2005/show.asp?id=4

Thursday, March 8, 2012

connection to sql server

hi,
in my server explorer i add a connection;
server name is cerebrum,username is ga, no password and database in the server is dal.
i tested the connection and it is successful. i am now able to browse the table in my server explorer. from my server explorer the i dragged the just data connection:cerebrum.dal.dbo in my design form and it created SqlConnection1 which contain my connection. properties of my SqlConnection1:



Name: SqlConnection1
ConnectionString: workstation id=SOLARIS;packet size=4096;user id=ga;data source=cerebrum;persist security info=False;initial catalog=dal
ConnectionTime: 15
Database: dal
DataSource: cerebrum
Modifiers: Protected
PacketSize: 4096
WorkstationId: Solaris

in my page load i added this code:


SqlConnection1.Open();
if (SqlConnection1.State == ConnectionState.Open)
{
Label1.Text = "SQL Connection is open";
}
else
{
Label1.Text = "SQL Connection is closed";
}

it gave me the error:



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.

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

Line 51: SqlConnection1.Open();
Line 52: if (SqlConnection1.State == ConnectionState.Open)

i don't know what's wrong with it. i really need your help.

This error means that the web server cannot open a connection to cerebrum SQL Server. It could mean that you cannot connect over TCP-IP to the computer cerebrum from your web server. So go to web server and try to ping cerebrum, see if this is successfull.

Try modifying the datasource to give the driver more clues about where your database server is. For example, replace cerebrum with the IP address of cerebrum, try variations like below:

datasource=123.123.123.123
datasource=123.123.123.123,1433
datasource=tcp:cerebrum,1433
With .NET you need to use tcp-ip, verify that your SQL Server is using tcp-ip protocol by looking that the SQL Server errorlog.

Connection to SQL remote server

I'm using vb.net to connect to a MSDE 2000 database on a remote server.
While in VB.NET, I'm able to view data using Server Explorer. In addition,
I've configured an ODBCDATAADAPTER that fills the dataset under preview data.
When I tried to retrieve data through webform/datagrid I get the error
"ERROR [08001] [Microsoft][ODBC SQL Server Driver][Named Pipes]SQL Server
does not exist or access denied. ERROR [01000] [Microsoft][ODBC SQL Server
Driver][Named Pipes]ConnectionOpen (Connect())."
I created a system dsn to connect to remote server. Test connection
succeeded. Any ideas what's wrong?
Hutty
The connection string I'm using in vb.net is
Dim Conn As New SqlConnection("Persist Security Info=False;Data
Source=INTL_INSTANCE;Extended
Properties=DSN=INTL_INSTANCE;UID=Hutty;APP=Microso ft? Visual Studio
..NET;WSID=CUI0113;DATABASE=Hutty;Network=DBNMPNTW ;Address=\\INTL\pipe\MSSQL$MYINSTANCE\sql\query;Tr usted_Connection=Yes;Initial Catalog=Hutty")
Hutty
"Hutty" wrote:

> I'm using vb.net to connect to a MSDE 2000 database on a remote server.
> While in VB.NET, I'm able to view data using Server Explorer. In addition,
> I've configured an ODBCDATAADAPTER that fills the dataset under preview data.
> When I tried to retrieve data through webform/datagrid I get the error
> "ERROR [08001] [Microsoft][ODBC SQL Server Driver][Named Pipes]SQL Server
> does not exist or access denied. ERROR [01000] [Microsoft][ODBC SQL Server
> Driver][Named Pipes]ConnectionOpen (Connect())."
> I created a system dsn to connect to remote server. Test connection
> succeeded. Any ideas what's wrong?
> --
> Hutty
|||I have the same problem.
I want to connect to a SQL server with this connection string:
Dim Conn As New SqlConnection( "Data Source=83.240.161.155;
User Id=sa;password=;Initial Catalog=Avaliacao Desempenho")
Any help?
Ze
"Hutty" wrote:
[vbcol=seagreen]
> The connection string I'm using in vb.net is
> Dim Conn As New SqlConnection("Persist Security Info=False;Data
> Source=INTL_INSTANCE;Extended
> Properties=DSN=INTL_INSTANCE;UID=Hutty;APP=Microso ft? Visual Studio
> .NET;WSID=CUI0113;DATABASE=Hutty;Network=DBNMPNTW; Address=\\INTL\pipe\MSSQL$MYINSTANCE\sql\query;Tru sted_Connection=Yes;Initial Catalog=Hutty")
> --
> Hutty
>
> "Hutty" wrote:

Sunday, February 12, 2012

connection problems to a SQL2005 DB that I own

I am a DB owner/ creator. I have connected to the DB before through my ASP.net app in the server explorer. Now when I try to refresh the connection I get an error message that says "User does not have permission to perform this action." I cannot figure out why because my connection string has not changed and my DB is still in the same location as it was before. I have checked all of the permissions on the SQL Server management studio and I have permissions to do everything. PLEASE HELP! :(

This has nothing to do with connection string ...

You must check the priviliges granted to the user from which you have logged into your data base.

|||

tabish82:

This has nothing to do with connection string ...

You must check the priviliges granted to the user from which you have logged into your data base.

As I said in the above post...

"I have checked all of the permissions on the SQL Server management studio and I have permissions to do everything"

I have not changed any of the permissions or used a different log on to access the db. I still cannot get connected.

|||

Check out:

http://blogs.msdn.com/kaelr/archive/2005/10/28/486369.aspx

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=648224&SiteID=1

Hope it helps...

|||

There might be some changes in the network configuration (e.g. Firewall).

Try to disable your firewall on Windows and try again.

Good luck.

|||

I have all firewall settings disabled, but thanks anyway

|||

Can you register (or connect to) your database server using same UserID and Password?

|||

Do you have a linked server?

I hope this will help:

http://blogs.msdn.com/kaelr/archive/2005/10/28/486369.aspx

http://www.aspspider.com/qa/ViewQuestion.aspx?QuestionId=1032

Good luck.