Showing posts with label created. Show all posts
Showing posts with label created. Show all posts

Sunday, March 25, 2012

connecting to sql from ASP

I created a webpage where someone can enter in new client
info. Using asp, I want to connect to the sql db and add
the new record. I'm using SQL2k in an W2K environment. I
want to use the trusted connection so SQL would use the
windows login to authenticate. Below is the code for
connecting to the sql server:
<%
dim cn, cs
Set Cn = Server.CreateObject("ADODB.Connection")
Cn.open "PROVIDER=SQLOLEDB;DATA
SOURCE=webbus\lab;TRUSTED_CONNECTION=YES;DATABASE= Client"
Set cs = Server.CreateObject("ADODB.Recordset")
cs.Open "SELECT * FROM CallerTest"
%>
When I click the Save button on the webpage to add the new
info, I get this error:
Error Type:
Microsoft OLE DB Provider for SQL Server (0x80040E4D)
Login failed for user 'WEBBUS\IUSR_WEBBUS'.
/lab/addnew.asp, line 95
Line 95 is the cn.Open line
What am I missing?
Ngan,
trusted security means that it'll use the IUSR_IISCOMPUTERNAME user for
anonymous access by default. This is configurable to another domain user in
IIS on the security tab for your website. If you want to use windows logins,
then you must disable anonymous and have windows integrated impersonation.
HTH,
Paul Ibison
|||How do I go about disabling the anonymous and having the
windows integrated impersonation?
Thanks!

>--Original Message--
>Ngan,
>trusted security means that it'll use the
IUSR_IISCOMPUTERNAME user for
>anonymous access by default. This is configurable to
another domain user in
>IIS on the security tab for your website. If you want to
use windows logins,
>then you must disable anonymous and have windows
integrated impersonation.
>HTH,
>Paul Ibison
>
>.
>
|||Programs, Administrative Tools, IIS. Select the website then right-click
proerties, directory security, edit. Untick enable anonymous access and tick
Integrated Windows Authentication. It's worth reading up on the options here
as if this is an internet site (rather than intranet or extranet) then
you'll need Basic Authentication, preferably with SSL.
HTH,
Paul Ibison
|||Thanks for that info! This will be an intranet website so
I'll just do the integrated windows thingie.
Currently, I have people from our provider companies
connected to me via a T1, so they don't have a windows
login. They are accessing the website anonymously, I
assume. If I turn off the anonymous access, I take it
they won't be able to view the website anymore.
How do I go about giving them "guest" access? Do I give
each company their own user account or group them somehow
into one guest group?
Thanks.
Ngan

>--Original Message--
>Programs, Administrative Tools, IIS. Select the website
then right-click
>proerties, directory security, edit. Untick enable
anonymous access and tick
>Integrated Windows Authentication. It's worth reading up
on the options here
>as if this is an internet site (rather than intranet or
extranet) then
>you'll need Basic Authentication, preferably with SSL.
>HTH,
>Paul Ibison
>
>.
>
|||They can access the site, but the windows login dialog box will come up.
Regards,
Paul Ibison
|||Sorry,
misread your previous post - yes, the previously anonymous users will be
prompted with a windows login dialog box. You'll need to give them a login
they can use. If all people use this login then you might as well go back to
anonymous, but if this is yust a subset of people then creating separate
windows logins makes sense. Alternatively you could use forms logins for
either ASP or ASP.NET.
Regards,
Paul Ibison
sqlsql

connecting to sql from ASP

I created a webpage where someone can enter in new client
info. Using asp, I want to connect to the sql db and add
the new record. I'm using SQL2k in an W2K environment. I
want to use the trusted connection so SQL would use the
windows login to authenticate. Below is the code for
connecting to the sql server:
<%
dim cn, cs
Set Cn = Server.CreateObject("ADODB.Connection")
Cn.open "PROVIDER=SQLOLEDB;DATA
SOURCE=webbus\lab;TRUSTED_CONNECTION=YES
;DATABASE=Client"
Set cs = Server.CreateObject("ADODB.Recordset")
cs.Open "SELECT * FROM CallerTest"
%>
When I click the Save button on the webpage to add the new
info, I get this error:
Error Type:
Microsoft OLE DB Provider for SQL Server (0x80040E4D)
Login failed for user 'WEBBUS\IUSR_WEBBUS'.
/lab/addnew.asp, line 95
Line 95 is the cn.Open line
What am I missing?Ngan,
trusted security means that it'll use the IUSR_IISCOMPUTERNAME user for
anonymous access by default. This is configurable to another domain user in
IIS on the security tab for your website. If you want to use windows logins,
then you must disable anonymous and have windows integrated impersonation.
HTH,
Paul Ibison|||How do I go about disabling the anonymous and having the
windows integrated impersonation?
Thanks!

>--Original Message--
>Ngan,
>trusted security means that it'll use the
IUSR_IISCOMPUTERNAME user for
>anonymous access by default. This is configurable to
another domain user in
>IIS on the security tab for your website. If you want to
use windows logins,
>then you must disable anonymous and have windows
integrated impersonation.
>HTH,
>Paul Ibison
>
>.
>|||Programs, Administrative Tools, IIS. Select the website then right-click
proerties, directory security, edit. Untick enable anonymous access and tick
Integrated Windows Authentication. It's worth reading up on the options here
as if this is an internet site (rather than intranet or extranet) then
you'll need Basic Authentication, preferably with SSL.
HTH,
Paul Ibison|||Thanks for that info! This will be an intranet website so
I'll just do the integrated windows thingie.
Currently, I have people from our provider companies
connected to me via a T1, so they don't have a windows
login. They are accessing the website anonymously, I
assume. If I turn off the anonymous access, I take it
they won't be able to view the website anymore.
How do I go about giving them "guest" access? Do I give
each company their own user account or group them somehow
into one guest group?
Thanks.
Ngan

>--Original Message--
>Programs, Administrative Tools, IIS. Select the website
then right-click
>proerties, directory security, edit. Untick enable
anonymous access and tick
>Integrated Windows Authentication. It's worth reading up
on the options here
>as if this is an internet site (rather than intranet or
extranet) then
>you'll need Basic Authentication, preferably with SSL.
>HTH,
>Paul Ibison
>
>.
>|||They can access the site, but the windows login dialog box will come up.
Regards,
Paul Ibison

Connecting to SQL Express from C# via connection string

I created a SQL Express database from within Vistual Studio. It had a
property ConnectionString, so I grabbed that value and attempted to use it i
n
code. (I did add an @. at the beginning and doubled the literal double quote
symbols.) The code that assigns the connection string and opens the
connection then looked like the following:
SqlConnection cn = new SQLConnection();
cn.COnnectionString = @."Data Source=
.\SQLEXPRESS;AttachDBFilename=""C:\MySolution\MyData.mdf"";Integrated
Security=True;User Instance=True";
cn.Open();
SqlCommand myCommand = new SqlCommand("Use FTTestLocal Create Table Asset
(AssetID int Identity Not Null Primary Key, AssetName varchar(150) Not Null,
Modified TimeStamp)", cn);
int ct = myCommand.ExecuteNonQuery();
When I run the application I get an error when the command is executed
stating "Could not locate entry in sysdatabases for database 'FTTestLocal'.
No entry found with that name. Make sure the name is entered correctly."
Thanks in advance for any help.Your connection string is attaching one database named
C:\MySolution\MyData.mdf and then you are trying to create a table in a
database named FTTestLocal. Either your connection string is wrong or you
are trying to use the wrong database. Perhaps you should explain what
you're trying to do so we can tell which database is appropriate.
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Steve Wash" <SteveWash@.discussions.microsoft.com> wrote in message
news:E426F5B2-E8E0-4D54-AAE2-949088D2A673@.microsoft.com...
>I created a SQL Express database from within Vistual Studio. It had a
> property ConnectionString, so I grabbed that value and attempted to use it
> in
> code. (I did add an @. at the beginning and doubled the literal double
> quote
> symbols.) The code that assigns the connection string and opens the
> connection then looked like the following:
> SqlConnection cn = new SQLConnection();
> cn.COnnectionString = @."Data Source=
> .\SQLEXPRESS;AttachDBFilename=""C:\MySolution\MyData.mdf"";Integrated
> Security=True;User Instance=True";
> cn.Open();
> SqlCommand myCommand = new SqlCommand("Use FTTestLocal Create Table Asset
> (AssetID int Identity Not Null Primary Key, AssetName varchar(150) Not
> Null,
> Modified TimeStamp)", cn);
> int ct = myCommand.ExecuteNonQuery();
> When I run the application I get an error when the command is executed
> stating "Could not locate entry in sysdatabases for database
> 'FTTestLocal'.
> No entry found with that name. Make sure the name is entered correctly."
> Thanks in advance for any help.
>|||Thanks for your quick review of my problem. I apologize that I made a
type-o, and your solution addresses the type-o. In trying to simplify my
example, I removed a lot of cryptic pathing information, but accidently left
in the "FTTestLocal". The actual code is
ConnectString=@."Data Source=.\SQLEXPRESS;AttachDbFilename=""C:\VS
Projects\Personal Utilities\TableClassBuilder\FTTestLocal.mdf"";Integrated
Security=True;User Instance=True";
The SQL command is "Use FTTestLocal Create Table Asset (AssetID int Identity
Not Null Primary Key, AssetName varchar(150) Not Null, Modified TimeStamp)"
I've also tried
"Use FTTestLocal.mdf Create Table Asset (AssetID int Identity Not Null
Primary Key, AssetName varchar(150) Not Null, Modified TimeStamp)".
Interestingly, the error message did not change at all. It did not seem to
pick up the .mdf in any way.
As for what I'm trying to accomplish, I'm attempting to modify existing
code. Currently the code attaches to an online server running MS SQL 2005
using the previously referenced code. I need to modify it to work as close
as possible to the same way but to instead attach to SQL Express. This way
I
can continue to develop without always needing to go online.|||Try running
SELECT name FROM sys.databases
to get the name of the database. It is probably:
C:\VSProjects\Personal Utilities\TableClassBuilder\FTTestLocal.mdf
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Steve Wash" <SteveWash@.discussions.microsoft.com> wrote in message
news:C92EB4DD-7189-487B-9BE9-03BD64B68ACA@.microsoft.com...
> Thanks for your quick review of my problem. I apologize that I made a
> type-o, and your solution addresses the type-o. In trying to simplify my
> example, I removed a lot of cryptic pathing information, but accidently
> left
> in the "FTTestLocal". The actual code is
> ConnectString=@."Data Source=.\SQLEXPRESS;AttachDbFilename=""C:\VS
> Projects\Personal Utilities\TableClassBuilder\FTTestLocal.mdf"";Integrated
> Security=True;User Instance=True";
> The SQL command is "Use FTTestLocal Create Table Asset (AssetID int
> Identity
> Not Null Primary Key, AssetName varchar(150) Not Null, Modified
> TimeStamp)"
> I've also tried
> "Use FTTestLocal.mdf Create Table Asset (AssetID int Identity Not Null
> Primary Key, AssetName varchar(150) Not Null, Modified TimeStamp)".
> Interestingly, the error message did not change at all. It did not seem
> to
> pick up the .mdf in any way.
>
> As for what I'm trying to accomplish, I'm attempting to modify existing
> code. Currently the code attaches to an online server running MS SQL 2005
> using the previously referenced code. I need to modify it to work as
> close
> as possible to the same way but to instead attach to SQL Express. This
> way I
> can continue to develop without always needing to go online.|||That was it. Thanks
"Roger Wolter[MSFT]" wrote:

> Try running
> SELECT name FROM sys.databases
> to get the name of the database. It is probably:
> C:\VSProjects\Personal Utilities\TableClassBuilder\FTTestLocal.mdf
> --
> This posting is provided "AS IS" with no warranties, and confers no rights
.
> Use of included script samples are subject to the terms specified at
> http://www.microsoft.com/info/cpyright.htm
> "Steve Wash" <SteveWash@.discussions.microsoft.com> wrote in message
> news:C92EB4DD-7189-487B-9BE9-03BD64B68ACA@.microsoft.com...
>
>

Thursday, March 22, 2012

connecting to server but not to database-Newbie Question

Hi everyone,

I created a database in SSMS,but I can't connect to it using VB Express code.When I delete the database name from the server I can connect to server,but when I mention the name of the database or initial catalog,I receive a login failure error for the mentioned database...

My connection string is:

Dim conn1 As SqlConnection = New SqlConnection("Data Source=.\SQLEXPRESS;initial catalog=TEST1;" _

& "Integrated Security=True;" & "user instance=true;")

Everything is Local,I am using express version of SQL server and VB.How I am not be able to connect the database I created under the server in SSMS...I am really confused...

Thanks in advance!!!!

Can

What is the exact error message you are getting ?

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de
|||

Hallo Mr Suessmeyer,

Yesterday you had also replied my question but I can't go ayn further.I downloaded SSMS,craeted a database under the server but I still get this error...How can I gain the access rights to the database that I created?

" Die von der Anmeldung angeforderte "database1"-Datenbank kann nicht ge?ffnet werden. Fehler bei der Anmeldung.
Fehler bei der Anmeldung für den Benutzer 'ADPLAN\atalay'. "

This was from the company's PC (where I write my thesis) I have a windows user account there...I also tried at home,I am the only user for windows XP at home but anyways I can not connect to the database,receiving the same error message.As I had written before if I leave Initial catalog= or database= fields empty then I am able to connect to the server...

Thanky in advance!

Can

|||

For a quick one, try to add the user to the sysadmin group to let him access the database (if it is based on a security issue)

sp_addsrvrolemember [ @.loginame= ] 'login'
, [ @.rolename = ] 'role'


For granular configuration, use the following procedure to grant him access to the db (not any objects so far)

sp_grantlogin [@.loginame=] 'login'
sp_defaultdb [ @.loginame = ] 'login', [ @.defdb = ] 'database'
sp_grantdbaccess [ @.loginame = ] 'login'
[ , [ @.name_in_db = ] 'name_in_db' [ OUTPUT ] ]

The same can be done within the Managment Studio.

HTH, Jens Suessmeyer.


http://www.sqlserver2005.de


|||

Thank you for the reply but I don't know where to enter this code...It'd be kind of you if you'd give more details,I am not a programmer which makes the things more difficult for me...

Regards,

Can

|||

Hi,

no problem, download SQL Server Express Management Studio and execute the query within the Studio (there is a function to open a "New Query". Then type in the command with the appropiate values fitting to your production system.
Download via: http://msdn.microsoft.com/vstudio/express/sql/download/


HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

|||

hi,

I do think all this is related to the fact you are just using a user instance (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsse/html/sqlexpuserinst.asp)..

on the other side, when you execute SSMSE it usually connects to the "traditional" SQLExpress edition you installed, and these are 2 different instances..

regards

|||

Thank you for all your replies.I solved my problem using SQL server management studio and using this query:

Use TEST1
go
exec sp_addlogin loginname,password,TEST1
go
exec sp_helplogins
go

then I added to this login to the database I wanted to connect,and I had to add login name and password to connection string(instead of user instances and integrated security).

Now it works this way.

Regards,

Can

Monday, March 19, 2012

connecting to MSDE using SSPI

Please advise: I have created a simple ASPX page to test if I can connect to MSDE on a Server 2003 system. The connection string that works ok is:

server=WS1;database=northwind;integrated security=false;user id=sa;password=xxx;

but the string that does not work is:

server=WS1;database=northwind;integrated security=SSPI;

which is the string I would like to use for normal web access. This string works fine on my development system (where I use XP Pro and IIS 5.1)

In IIS6 on the "production server" the directory security on the virtual dir is set to allow anonymous access, using user IUSR_WS1 (where WS1 is the name of the system) and to integrated security.

Please help! Thank you

John BI forgot to say the error message I am getting is:

login failed for user 'NTAUTHORITY\NETWORK SERVICE'|||There is a KB for this problem:PRB: "Login Failed" Error Message When You Create a Trusted Data Connection from ASP.NET to SQL Server. See if any of the 3 suggested Resolutions work for you.

To me, the 3rd suggestion seems to be the best course of action. And taking that further, what seems to make the most sense is to add a new database role called "webuser" or something similar, and then add the NT AUTHORITY\NETWORK SERVICE user to that role. This will give you more flexibility if the web app moves to a Windows 2000 machine -- you would just be able to add the ASPNET account as another member of that webuser role.

Terri|||Thank you for your reply. I looked at the article, but I regret to say it does not make much sense to me at this stage. I have bought the MSDE Admin tool to administer MSDE, or could use the osql tool, but am not clear how to:

a. add a new database role (is this adding a "normal" user group)? I dont see any reference to a "database role".

b. add the NTAUTHORITY\NETWORK SERVICE user to that role. I have looked at the list of users and there is no such name. I must be looking in the wrong place.

Excuse my ignorance!

TIA

John B|||You should downloadSQL Server 2000 Books Online. This is a huge download but an essential reference.

I have to admit, I am confused on this issue. I have now come across an article right on this siteRunning ASP.NET 1.1 with IIS 6.0, and part of it covers supporting integrated authentication with SQL Server. The suggestion I gave you was based on something I read elsewhere that seemed to make sense.

Further information on the path I suggested:

The system stored procedure to add a database role is sp_addrole. You'd use it like this:

EXEC sp_addrole 'webuser'

The system stored procedure to add a security account for a Windows user to the current database and enable it to be granted permissions to perform activities in the database is sp_grantdbaccess.

EXEC sp_grantdbaccess 'NT AUTHORITY\NETWORK SERVICE', 'Network Service'

The system stored procedure to add a security account as a member of an existing database role in the current database is sp_addrolemember.

EXEC sp_addrolemember 'webuser', 'Network Service'

Terri|||Thank you. The article you suggested in the last post is very helpful. I have now solved the problem, thanks to an article I found www.cgnit.com/resources/ntauthority_networkservice_error.html

which hits it bang on the nose, and may be useful to others.

It seems to me that all the books, and many of the forums suggest that when you run an ASP.NET app and use anonymous access, the system uses the identity mcxxx\aspnet (where mcxxx is the domain or machine no). But what I have found so far is that under Server 2003, the identity assumed is the mysterious user NTAUTHORITY\NETWORKSERVICE which is NOT found in the list of users, but is apparently a member of the IIS_WPG group, so configuring this group to access the database solves the problem and allows an anonymous user to access records according to the permissions set within MSDE or SQL Server.

Can anyone confirm this is true? Is the ASPNET user in fact NEVER used in Server 2003, but only in W2000 or XP?|||Yes, I can confirm that. I ran into this today, setting up ibuyspy on a Windows2003 server. Here's the quote I found in the machine.config file:
When ASP.NET is running under IIS 6 in native mode, the IIS 6 process model is
used and settings in this section are ignored. Please use the IIS administrative
UI to configure things like process identity and cycling for the IIS
worker process for the desired application

I went ahead and added the IIS_WPG to access the DB I cared about, but you could also setup your own IIS6 AppPool with seperate identity information.

/Brad|||

I cannot but say, its a great thread !!

regards

Connecting to Local Database after Application Install

I have created an application which uses a SQL Express database. The program runs fine on the the computer where I built the app, however when I install the app on another computer I get an error telling me that under default SQL Express does not allow remote connections. The problem is that I dont want a remote connection I want a local connection, the database file is on the commputer. How can do get my application to look for the database on the local machine.

My connection string is:

Data Source=(local)\SQLEXPRESS;Initial Catalog="C:\DOCUMENTS AND SETTINGS\ADMINISTRATOR\PLDAQ.MDF";Integrated Security=True

I have made sure that the file is in the correct directory.

Any help would be greatly appretiated

hi,

the folder you are referencing is not a "standard" one in the "traditional" sense of SQL Server, and you can get problems if the account running the instance is not able to access that path... and anyway you should reference the intital catalog in the connection string via the "logical" name and not the physical primary data file name, thus
Data Source=(local)\SQLEXPRESS;Initial Catalog=dbLogicalFileName;Integrated Security=True
or use the AttachDBFilename feature of the User Instances mode..

try modifying the connection string to see if you are granted connection to the instance you are dealing with, as the exception you are reporting is quite a generic connection exception..

regards

|||

Andrea

I still have the same problem, I have updated my connection string to this:

Data Source = .\SQLEXPRESS;AttachDBFilename = [DataDirectory]\PLDaq.mdf;Integrated Security = True; UserInstance = False

I have managed to get arround the error by changeing the name of the non-design computer to mach the name of the design computer, this however, as I am sure you will agree, is only temporary as I don't want to have to change the name of every computer that I install this application on, what do I need to do to rectify this situation.

|||

hi,

as you are not using "User Instances", I'd not go for the AttachDBFileName property of the connection string.. I'd attach/create the database once and then I'd go for the "traditional" Database=yourDbName property of the connection string...

I have managed to get arround the error by changeing the name of the non-design computer to mach the name of the design computer

do you mean by that you "named" the destination computer the same as your dev pc? this is obviously not "mandatory"...

what is your |DataDirectory| value?

regards

|||

do you mean by that you "named" the destination computer the same as your dev pc? this is obviously not "mandatory"...

Unfortunatly this is the only way it will not generate the error posted above. Like I said the program is looking for a remote connection but I want a local one. So I tricked it into thinking that it was running on the dev computer by changeing the name. I will agree that this is obviously not convient, but that is why I am posting I just cant figure out how to fix it.

The |DataDirectory| tells the connection to look in the bin\debug folder during dev time, and also to look into the bin\data folder at run time, after installation obviously. So when the program is installed and all data files are stored in the (AppPath)\bin\data directory and that is where the program is supposed to look for the data files (e.g. Database and Log files), however, if the non dev computer has a different name it trys to find the dev computer to connect to the database, a remote connection, It cant do this as it is not connected to any network.

I have tryed the traditional Database = yourDbName and that causes the same problem

Also There may come a time when I want to use User Instances, but for the time being I just want the thing to work.

|||

PEng1 wrote:

Unfortunatly this is the only way it will not generate the error posted above. Like I said the program is looking for a remote connection but I want a local one. So I tricked it into thinking that it was running on the dev computer by changeing the name. I will agree that this is obviously not convient, but that is why I am posting I just cant figure out how to fix it.

the fix is using

Data Source = .\SQLEXPRESS or Data Source = (Local)\SQLEXPRESS property in the connection string...

here you have to specify the instance you have to connect to, and you can provide "." and/or "(Local)" for "local" connections"...

The |DataDirectory| tells the connection to look in the bin\debug folder during dev time, and also to look into the bin\data folder at run time, after installation obviously. So when the program is installed and all data files are stored in the (AppPath)\bin\data directory and that is where the program is supposed to look for the data files (e.g. Database and Log files), however, if the non dev computer has a different name it trys to find the dev computer to connect to the database, a remote connection, It cant do this as it is not connected to any network.

pay attention to your "custom data folder"... consider that the account running the SQLExpress intstance required adeguate NTFS permissions to that folder.. and consider Vista "headaches"/requirements with regard writing in Program Files folder...

regards

|||

Andrea,

I guess that I had the answer for a while and just didn't bother to check if it would work with a different name, or I changed something and just don't remeber what, probably the latter of the two, either way, the problem is resolved and I am greatly indebted for all of your help. Thanks a lot.

This program will be run on Windows 2000 for quite a while but it will eventually have to be moved to Vista or higher, what "headaches" are you refering to, I am not at all familiar with Vista since the company I work for still has some machines that are running 95 and One that is running DOS, yeah thats right I said DOS. I guess however that I should probably read up on the New OS any recomended reading?

|||

hi,

PEng1 wrote:

Andrea,

I guess that I had the answer for a while and just didn't bother to check if it would work with a different name, or I changed something and just don't remeber what, probably the latter of the two, either way, the problem is resolved and I am greatly indebted for all of your help. Thanks a lot.

This program will be run on Windows 2000 for quite a while but it will eventually have to be moved to Vista or higher, what "headaches" are you refering to, I am not at all familiar with Vista since the company I work for still has some machines that are running 95 and One that is running DOS, yeah thats right I said DOS. I guess however that I should probably read up on the New OS any recomended reading?

start reading at http://technet.microsoft.com/en-us/windowsvista/aa905108.aspx, http://technet.microsoft.com/en-us/windowsvista/aa906021.aspx, ....

and look in this forum for Vista troubles with UAC..

regards

Connecting to Local Database after Application Install

I have created an application which uses a SQL Express database. The program runs fine on the the computer where I built the app, however when I install the app on another computer I get an error telling me that under default SQL Express does not allow remote connections. The problem is that I dont want a remote connection I want a local connection, the database file is on the commputer. How can do get my application to look for the database on the local machine.

My connection string is:

Data Source=(local)\SQLEXPRESS;Initial Catalog="C:\DOCUMENTS AND SETTINGS\ADMINISTRATOR\PLDAQ.MDF";Integrated Security=True

I have made sure that the file is in the correct directory.

Any help would be greatly appretiated

hi,

the folder you are referencing is not a "standard" one in the "traditional" sense of SQL Server, and you can get problems if the account running the instance is not able to access that path... and anyway you should reference the intital catalog in the connection string via the "logical" name and not the physical primary data file name, thus
Data Source=(local)\SQLEXPRESS;Initial Catalog=dbLogicalFileName;Integrated Security=True
or use the AttachDBFilename feature of the User Instances mode..

try modifying the connection string to see if you are granted connection to the instance you are dealing with, as the exception you are reporting is quite a generic connection exception..

regards

|||

Andrea

I still have the same problem, I have updated my connection string to this:

Data Source = .\SQLEXPRESS;AttachDBFilename = [DataDirectory]\PLDaq.mdf;Integrated Security = True; UserInstance = False

I have managed to get arround the error by changeing the name of the non-design computer to mach the name of the design computer, this however, as I am sure you will agree, is only temporary as I don't want to have to change the name of every computer that I install this application on, what do I need to do to rectify this situation.

|||

hi,

as you are not using "User Instances", I'd not go for the AttachDBFileName property of the connection string.. I'd attach/create the database once and then I'd go for the "traditional" Database=yourDbName property of the connection string...

I have managed to get arround the error by changeing the name of the non-design computer to mach the name of the design computer

do you mean by that you "named" the destination computer the same as your dev pc? this is obviously not "mandatory"...

what is your |DataDirectory| value?

regards

|||

do you mean by that you "named" the destination computer the same as your dev pc? this is obviously not "mandatory"...

Unfortunatly this is the only way it will not generate the error posted above. Like I said the program is looking for a remote connection but I want a local one. So I tricked it into thinking that it was running on the dev computer by changeing the name. I will agree that this is obviously not convient, but that is why I am posting I just cant figure out how to fix it.

The |DataDirectory| tells the connection to look in the bin\debug folder during dev time, and also to look into the bin\data folder at run time, after installation obviously. So when the program is installed and all data files are stored in the (AppPath)\bin\data directory and that is where the program is supposed to look for the data files (e.g. Database and Log files), however, if the non dev computer has a different name it trys to find the dev computer to connect to the database, a remote connection, It cant do this as it is not connected to any network.

I have tryed the traditional Database = yourDbName and that causes the same problem

Also There may come a time when I want to use User Instances, but for the time being I just want the thing to work.

|||

PEng1 wrote:

Unfortunatly this is the only way it will not generate the error posted above. Like I said the program is looking for a remote connection but I want a local one. So I tricked it into thinking that it was running on the dev computer by changeing the name. I will agree that this is obviously not convient, but that is why I am posting I just cant figure out how to fix it.

the fix is using

Data Source = .\SQLEXPRESS or Data Source = (Local)\SQLEXPRESS property in the connection string...

here you have to specify the instance you have to connect to, and you can provide "." and/or "(Local)" for "local" connections"...

The |DataDirectory| tells the connection to look in the bin\debug folder during dev time, and also to look into the bin\data folder at run time, after installation obviously. So when the program is installed and all data files are stored in the (AppPath)\bin\data directory and that is where the program is supposed to look for the data files (e.g. Database and Log files), however, if the non dev computer has a different name it trys to find the dev computer to connect to the database, a remote connection, It cant do this as it is not connected to any network.

pay attention to your "custom data folder"... consider that the account running the SQLExpress intstance required adeguate NTFS permissions to that folder.. and consider Vista "headaches"/requirements with regard writing in Program Files folder...

regards

|||

Andrea,

I guess that I had the answer for a while and just didn't bother to check if it would work with a different name, or I changed something and just don't remeber what, probably the latter of the two, either way, the problem is resolved and I am greatly indebted for all of your help. Thanks a lot.

This program will be run on Windows 2000 for quite a while but it will eventually have to be moved to Vista or higher, what "headaches" are you refering to, I am not at all familiar with Vista since the company I work for still has some machines that are running 95 and One that is running DOS, yeah thats right I said DOS. I guess however that I should probably read up on the New OS any recomended reading?

|||

hi,

PEng1 wrote:

Andrea,

I guess that I had the answer for a while and just didn't bother to check if it would work with a different name, or I changed something and just don't remeber what, probably the latter of the two, either way, the problem is resolved and I am greatly indebted for all of your help. Thanks a lot.

This program will be run on Windows 2000 for quite a while but it will eventually have to be moved to Vista or higher, what "headaches" are you refering to, I am not at all familiar with Vista since the company I work for still has some machines that are running 95 and One that is running DOS, yeah thats right I said DOS. I guess however that I should probably read up on the New OS any recomended reading?

start reading at http://technet.microsoft.com/en-us/windowsvista/aa905108.aspx, http://technet.microsoft.com/en-us/windowsvista/aa906021.aspx, ....

and look in this forum for Vista troubles with UAC..

regards

Connecting to Local Database after Application Install

I have created an application which uses a SQL Express database. The program runs fine on the the computer where I built the app, however when I install the app on another computer I get an error telling me that under default SQL Express does not allow remote connections. The problem is that I dont want a remote connection I want a local connection, the database file is on the commputer. How can do get my application to look for the database on the local machine.

My connection string is:

Data Source=(local)\SQLEXPRESS;Initial Catalog="C:\DOCUMENTS AND SETTINGS\ADMINISTRATOR\PLDAQ.MDF";Integrated Security=True

I have made sure that the file is in the correct directory.

Any help would be greatly appretiated

hi,

the folder you are referencing is not a "standard" one in the "traditional" sense of SQL Server, and you can get problems if the account running the instance is not able to access that path... and anyway you should reference the intital catalog in the connection string via the "logical" name and not the physical primary data file name, thus
Data Source=(local)\SQLEXPRESS;Initial Catalog=dbLogicalFileName;Integrated Security=True
or use the AttachDBFilename feature of the User Instances mode..

try modifying the connection string to see if you are granted connection to the instance you are dealing with, as the exception you are reporting is quite a generic connection exception..

regards

|||

Andrea

I still have the same problem, I have updated my connection string to this:

Data Source = .\SQLEXPRESS;AttachDBFilename = [DataDirectory]\PLDaq.mdf;Integrated Security = True; UserInstance = False

I have managed to get arround the error by changeing the name of the non-design computer to mach the name of the design computer, this however, as I am sure you will agree, is only temporary as I don't want to have to change the name of every computer that I install this application on, what do I need to do to rectify this situation.

|||

hi,

as you are not using "User Instances", I'd not go for the AttachDBFileName property of the connection string.. I'd attach/create the database once and then I'd go for the "traditional" Database=yourDbName property of the connection string...

I have managed to get arround the error by changeing the name of the non-design computer to mach the name of the design computer

do you mean by that you "named" the destination computer the same as your dev pc? this is obviously not "mandatory"...

what is your |DataDirectory| value?

regards

|||

do you mean by that you "named" the destination computer the same as your dev pc? this is obviously not "mandatory"...

Unfortunatly this is the only way it will not generate the error posted above. Like I said the program is looking for a remote connection but I want a local one. So I tricked it into thinking that it was running on the dev computer by changeing the name. I will agree that this is obviously not convient, but that is why I am posting I just cant figure out how to fix it.

The |DataDirectory| tells the connection to look in the bin\debug folder during dev time, and also to look into the bin\data folder at run time, after installation obviously. So when the program is installed and all data files are stored in the (AppPath)\bin\data directory and that is where the program is supposed to look for the data files (e.g. Database and Log files), however, if the non dev computer has a different name it trys to find the dev computer to connect to the database, a remote connection, It cant do this as it is not connected to any network.

I have tryed the traditional Database = yourDbName and that causes the same problem

Also There may come a time when I want to use User Instances, but for the time being I just want the thing to work.

|||

PEng1 wrote:

Unfortunatly this is the only way it will not generate the error posted above. Like I said the program is looking for a remote connection but I want a local one. So I tricked it into thinking that it was running on the dev computer by changeing the name. I will agree that this is obviously not convient, but that is why I am posting I just cant figure out how to fix it.

the fix is using

Data Source = .\SQLEXPRESS or Data Source = (Local)\SQLEXPRESS property in the connection string...

here you have to specify the instance you have to connect to, and you can provide "." and/or "(Local)" for "local" connections"...

The |DataDirectory| tells the connection to look in the bin\debug folder during dev time, and also to look into the bin\data folder at run time, after installation obviously. So when the program is installed and all data files are stored in the (AppPath)\bin\data directory and that is where the program is supposed to look for the data files (e.g. Database and Log files), however, if the non dev computer has a different name it trys to find the dev computer to connect to the database, a remote connection, It cant do this as it is not connected to any network.

pay attention to your "custom data folder"... consider that the account running the SQLExpress intstance required adeguate NTFS permissions to that folder.. and consider Vista "headaches"/requirements with regard writing in Program Files folder...

regards

|||

Andrea,

I guess that I had the answer for a while and just didn't bother to check if it would work with a different name, or I changed something and just don't remeber what, probably the latter of the two, either way, the problem is resolved and I am greatly indebted for all of your help. Thanks a lot.

This program will be run on Windows 2000 for quite a while but it will eventually have to be moved to Vista or higher, what "headaches" are you refering to, I am not at all familiar with Vista since the company I work for still has some machines that are running 95 and One that is running DOS, yeah thats right I said DOS. I guess however that I should probably read up on the New OS any recomended reading?

|||

hi,

PEng1 wrote:

Andrea,

I guess that I had the answer for a while and just didn't bother to check if it would work with a different name, or I changed something and just don't remeber what, probably the latter of the two, either way, the problem is resolved and I am greatly indebted for all of your help. Thanks a lot.

This program will be run on Windows 2000 for quite a while but it will eventually have to be moved to Vista or higher, what "headaches" are you refering to, I am not at all familiar with Vista since the company I work for still has some machines that are running 95 and One that is running DOS, yeah thats right I said DOS. I guess however that I should probably read up on the New OS any recomended reading?

start reading at http://technet.microsoft.com/en-us/windowsvista/aa905108.aspx, http://technet.microsoft.com/en-us/windowsvista/aa906021.aspx, ....

and look in this forum for Vista troubles with UAC..

regards

Connecting to local cube created from AS 2000 and AS 2005 cubes using ADOMD.NET 9.0

Hello,

I created two local cubes, first one: from an AS 2000 cube and the second one from an AS 2005 cube. Then I tried to connect to them using the following code:

' AS 2000

Dim strDataSource As String = "MyFolderPath\AS2000LocalCube.cub"

Dim strDatabase As String = "AS2000LocalCubeName"

' AS 20005

'Dim strDataSource As String = "MyFolderPath\AS2005LocalCube.cub"

'Dim strDatabase As String = "AS2005LocalCubeName"

strConnectString ="Provider=MSOLAP;Data Source=" & strDataSource &";Catalog=" & strDatabase &";MDX Compatibility=2;"

Dim clConnectionAsNew AdomdConnection

clConnection.ConnectionString = strConnectString

clConnection.Open()

It works properly for AS 2000 local cube but for AS 20005 local cube, it return the following exception:

InnerException{"The 'MyFolderPath\AS2005LocalCube.cub' local cube file cannot be opened."}System.Exception

Message"A connection cannot be made. Ensure that the server is running."String

Source"Microsoft.AnalysisServices.AdomdClient"String

StackTrace"at Microsoft.AnalysisServices.AdomdClient.XmlaClient.Connect(ConnectionInfo connectionInfo, Boolean beginSession)

at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.XmlaClientProvider.Microsoft.AnalysisServices.AdomdClient.AdomdConnection.IXmlaClientProviderEx.ConnectXmla()

at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.ConnectToXMLA(Boolean createSession, Boolean isHTTP)

at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.Open()

Both local cubes were created using the same MDX query.

Abdel

Can you connect to the AS2005 local cube using OLEDB. Excel and the MDX Sample app both use OLEDB, so try one of these.

Try getting rid of MDX Compatibility=2... shouldn't matter.

How did you create the local cube?

|||

Yes I am able to connect using MDX Sample App and Excel 2003.

But for AS 2005 local cube and using Excel 2003, if you are already connected to the file using MDX Sample App, the following message is returned: “AS2005LocalCube.cub’ cannot be accessed. The file may be read-only, or you may be trying to access a read-only location. Or, the server the document is stored on may not be responding”.

I create the local cube with the following MDX query:

CREATE GLOBAL CUBE [AS2005LocalCube]

STORAGE 'MyFolderPath\AS2005LocalCube.cub'

FROM [2005SQLServerCube] (

MEASURE [2005SQLServerCube].[Value1],

MEASURE [2005SQLServerCube].[Value1_Footnote1] HIDDEN ,

MEASURE [2005SQLServerCube].[Value1_Footnote2] HIDDEN ,

MEASURE [2005SQLServerCube].[Value2],

DIMENSION [2005SQLServerCube].[GenderDim].[Genders] (

LEVEL [(All)], LEVEL [Genders]

),

DIMENSION [2005SQLServerCube].[ProductDim].[Products] (

LEVEL [(All)], LEVEL [Products]

)

)

|||In AS2005 only one process at a time can open local cube file. This is why if you are already connected in Excel - you won't be able to connect from MDX Sample App.

Connecting to local cube created from AS 2000 and AS 2005 cubes using ADOMD.NET 9.0

Hello,

I created two local cubes, first one: from an AS 2000 cube and the second one from an AS 2005 cube. Then I tried to connect to them using the following code:

' AS 2000

Dim strDataSource As String = "MyFolderPath\AS2000LocalCube.cub"

Dim strDatabase As String = "AS2000LocalCubeName"

' AS 20005

'Dim strDataSource As String = "MyFolderPath\AS2005LocalCube.cub"

'Dim strDatabase As String = "AS2005LocalCubeName"

strConnectString = "Provider=MSOLAP;Data Source=" & strDataSource & ";Catalog=" & strDatabase & ";MDX Compatibility=2;"

Dim clConnection As New AdomdConnection

clConnection.ConnectionString = strConnectString

clConnection.Open()

It works properly for AS 2000 local cube but for AS 20005 local cube, it return the following exception:

InnerException{"The 'MyFolderPath\AS2005LocalCube.cub' local cube file cannot be opened."}System.Exception

Message"A connection cannot be made. Ensure that the server is running."String

Source"Microsoft.AnalysisServices.AdomdClient"String

StackTrace"at Microsoft.AnalysisServices.AdomdClient.XmlaClient.Connect(ConnectionInfo connectionInfo, Boolean beginSession)

at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.XmlaClientProvider.Microsoft.AnalysisServices.AdomdClient.AdomdConnection.IXmlaClientProviderEx.ConnectXmla()

at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.ConnectToXMLA(Boolean createSession, Boolean isHTTP)

at Microsoft.AnalysisServices.AdomdClient.AdomdConnection.Open()

Both local cubes were created using the same MDX query.

Abdel

Can you connect to the AS2005 local cube using OLEDB. Excel and the MDX Sample app both use OLEDB, so try one of these.

Try getting rid of MDX Compatibility=2... shouldn't matter.

How did you create the local cube?

|||

Yes I am able to connect using MDX Sample App and Excel 2003.

But for AS 2005 local cube and using Excel 2003, if you are already connected to the file using MDX Sample App, the following message is returned: “AS2005LocalCube.cub’ cannot be accessed. The file may be read-only, or you may be trying to access a read-only location. Or, the server the document is stored on may not be responding”.

I create the local cube with the following MDX query:

CREATE GLOBAL CUBE [AS2005LocalCube]

STORAGE 'MyFolderPath\AS2005LocalCube.cub'

FROM [2005SQLServerCube] (

MEASURE [2005SQLServerCube].[Value1],

MEASURE [2005SQLServerCube].[Value1_Footnote1] HIDDEN ,

MEASURE [2005SQLServerCube].[Value1_Footnote2] HIDDEN ,

MEASURE [2005SQLServerCube].[Value2],

DIMENSION [2005SQLServerCube].[GenderDim].[Genders] (

LEVEL [(All)], LEVEL [Genders]

),

DIMENSION [2005SQLServerCube].[ProductDim].[Products] (

LEVEL [(All)], LEVEL [Products]

)

)

|||In AS2005 only one process at a time can open local cube file. This is why if you are already connected in Excel - you won't be able to connect from MDX Sample App.

Sunday, March 11, 2012

Connecting to another SQL Server Instance

I created another instance of SQL Server and am trying to access a table on
it from the other server. I set up the code listed below and got the error,
Line 1: Incorrect syntax near '\'. I tried removing the '\' and then it
indicated, Could not find server 'UMDPSMB7VSQLSERVERALT' in sysservers. Is
it possible to do this ?
Code: Select * From UMDPSMB7V\SQLSERVERALT.dbo.Rmtest.Table1This is a multi-part message in MIME format.
--=_NextPart_000_06FD_01C69CE1.737BB6A0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: quoted-printable
For Server 'instance' names, becasue of the backslash '\', you need to =put the server\instance name in square brackets. For example:
Select Column1
, Column2
, etc. From [UMDPSMB7V\SQLSERVERALT].dbo.Rmtest.Table1
Note: It's bad form to use SELECT *. Much better to list the columns you =want. If future needs cause any changes in the database, you code is =less likely to 'break'.
-- Arnie Rowland, YACE* "To be successful, your heart must accompany your knowledge."
*Yet Another Certification Exam
"rmcompute" <rmcompute@.discussions.microsoft.com> wrote in message =news:B79703B6-DABD-4D7F-92E7-E7E056D66CA3@.microsoft.com...
>I created another instance of SQL Server and am trying to access a =table on > it from the other server. I set up the code listed below and got the =error, > Line 1: Incorrect syntax near '\'. I tried removing the '\' and then =it > indicated, Could not find server 'UMDPSMB7VSQLSERVERALT' in =sysservers. Is > it possible to do this ?
> > Code: Select * From UMDPSMB7V\SQLSERVERALT.dbo.Rmtest.Table1
>
--=_NextPart_000_06FD_01C69CE1.737BB6A0
Content-Type: text/html;
charset="Utf-8"
Content-Transfer-Encoding: quoted-printable
=EF=BB=BF<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&

For Server 'instance' names, becasue of =the backslash '\', you need to put the server\instance name in square =brackets. For example:
Select
Column1
, =Column2
, etc. =From [UMDPSMB7V\SQLSERVERALT].dbo.Rmtest.Table1
Note: It's bad form to use SELECT *. =Much better to list the columns you want. If future needs cause any changes in the =database, you code is less likely to 'break'.
-- Arnie Rowland, YACE* "To =be successful, your heart must accompany your knowledge."
*Yet Another Certification =Exam
"rmcompute" wrote in message news:B79703B6-DABD-4D7F-92E7-E7E056D66CA3@.microsoft.com...>I =created another instance of SQL Server and am trying to access a table on > it =from the other server. I set up the code listed below and got the error, => Line 1: Incorrect syntax near '\'. I tried removing the '\' and =then it > indicated, Could not find server 'UMDPSMB7VSQLSERVERALT' in sysservers. Is > it possible to do this ?> > Code: Select * From UMDPSMB7V\SQLSERVERALT.dbo.Rmtest.Table1>

--=_NextPart_000_06FD_01C69CE1.737BB6A0--|||It worked. Thank you.
"Arnie Rowland" wrote:
> For Server 'instance' names, becasue of the backslash '\', you need to put the server\instance name in square brackets. For example:
> Select
> Column1
> , Column2
> , etc.
> From [UMDPSMB7V\SQLSERVERALT].dbo.Rmtest.Table1
> Note: It's bad form to use SELECT *. Much better to list the columns you want. If future needs cause any changes in the database, you code is less likely to 'break'.
>
> --
> Arnie Rowland, YACE*
> "To be successful, your heart must accompany your knowledge."
> *Yet Another Certification Exam
>
> "rmcompute" <rmcompute@.discussions.microsoft.com> wrote in message news:B79703B6-DABD-4D7F-92E7-E7E056D66CA3@.microsoft.com...
> >I created another instance of SQL Server and am trying to access a table on
> > it from the other server. I set up the code listed below and got the error,
> > Line 1: Incorrect syntax near '\'. I tried removing the '\' and then it
> > indicated, Could not find server 'UMDPSMB7VSQLSERVERALT' in sysservers. Is
> > it possible to do this ?
> >
> > Code: Select * From UMDPSMB7V\SQLSERVERALT.dbo.Rmtest

Thursday, March 8, 2012

Connecting to Analysis Services cubes from Reporting Services

Hi,
I have created cubes using Analysis Services. Could I please know how to create a data source to connect to those cubes in Reporting Services to generate reports out of them. When I choose to create a data source in Reporting Services, I am able to see options only to connect to Sql Server, ODBC and Oracle. I do not see an option like 'OLAP Services' to connect to cubes in Analysis Services. I would be happy if anyone could help by giving me the steps to connect to the cubes in Analysis Services and to generate report/pivot table out of it.
Thanks,
Raj.Information on the integration of Reporting Services (RS) 2000 and Analysis
Services (AS) 2000 is provided at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsql2k/html/olapasandrs.asp
It describes how to connect to AS 2000 cubes and use multidimensional data
in RS 2000. The data provider is OleDB provider for OLAP 8.0.
You might also want to check out some samples on parameterized MDX available
for download:
http://www.microsoft.com/downloads/details.aspx?FamilyID=f9b6e945-1f4c-4b7c-9c83-c6801f0576ff&DisplayLang=en
Note: The upcoming SQL 2005 Beta 2 will contain graphical MDX and DMX query
designers, which will work best against AS 2005 cubes, but they also support
AS 2000 cubes.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Raj" <Raj@.discussions.microsoft.com> wrote in message
news:66825BE3-5342-4C34-AD06-589B73491B01@.microsoft.com...
> Hi,
> I have created cubes using Analysis Services. Could I please know how to
create a data source to connect to those cubes in Reporting Services to
generate reports out of them. When I choose to create a data source in
Reporting Services, I am able to see options only to connect to Sql Server,
ODBC and Oracle. I do not see an option like 'OLAP Services' to connect to
cubes in Analysis Services. I would be happy if anyone could help by giving
me the steps to connect to the cubes in Analysis Services and to generate
report/pivot table out of it.
> Thanks,
> Raj.

Connecting to an alias fails

Created a new alias with the SQL Server client network utility. With
the connection parameters, changed the server name to the IP address -
still no success.
Edited the Sql Server Network utility to use port 1433 to use port 0
(per another google discussion), still no success.
Any other ideas? The goal is to use the alias identically as how we
access the server name. Using the default instance of SQL Server.
Thanks,
-KevinError message? Version of SQL Server? Service packs?
Inquiring minds want to know
Kevin Hill
3NF Consulting
http://www.3nf-inc.com/NewsGroups.htm
Real-world stuff I run across with SQL Server:
http://kevin3nf.blogspot.com
"Justin" <kfwolf@.hotmail.com> wrote in message
news:1166725627.977804.61320@.42g2000cwt.googlegroups.com...
> Created a new alias with the SQL Server client network utility. With
> the connection parameters, changed the server name to the IP address -
> still no success.
> Edited the Sql Server Network utility to use port 1433 to use port 0
> (per another google discussion), still no success.
> Any other ideas? The goal is to use the alias identically as how we
> access the server name. Using the default instance of SQL Server.
> Thanks,
> -Kevin
>

Connecting to an alias fails

Created a new alias with the SQL Server client network utility. With
the connection parameters, changed the server name to the IP address -
still no success.
Edited the Sql Server Network utility to use port 1433 to use port 0
(per another google discussion), still no success.
Any other ideas? The goal is to use the alias identically as how we
access the server name. Using the default instance of SQL Server.
Thanks,
-Kevin
Error message? Version of SQL Server? Service packs?
Inquiring minds want to know
Kevin Hill
3NF Consulting
http://www.3nf-inc.com/NewsGroups.htm
Real-world stuff I run across with SQL Server:
http://kevin3nf.blogspot.com
"Justin" <kfwolf@.hotmail.com> wrote in message
news:1166725627.977804.61320@.42g2000cwt.googlegrou ps.com...
> Created a new alias with the SQL Server client network utility. With
> the connection parameters, changed the server name to the IP address -
> still no success.
> Edited the Sql Server Network utility to use port 1433 to use port 0
> (per another google discussion), still no success.
> Any other ideas? The goal is to use the alias identically as how we
> access the server name. Using the default instance of SQL Server.
> Thanks,
> -Kevin
>

Wednesday, March 7, 2012

Connecting to a remote sql server for merge replication (push) in SQL Server 2005 Replicat

I am trying to setup a merge (push) replication to a server/database
in a
remote network. I created the publication and connected to the remote
network using VPN but cannot register nor see the remote sql server.
In sql
server 2000, I was able to register the server in my Enterprise
Manager
(after creating an alias) and then created the push subscription. I
connect
to the remote network server using VPN. How do I go about doing this
in SQL
Server 2005? The publisher is a WorkGroup edition while the subscriber
is
standard edition. Authentication is set to both win and sql and
verified
the user and password used to attempt registration. Any help will be
greatly appreciated.
Create an alias on the publisher to the subscriber. Use client network
utility to do this, and for the server name use its fully qualified domain
name. Try to ping both servers from each other.
You may have to use anonymous subscribers to get this to work if you can't
map an unc drive between the two.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
<pete970t@.gmail.com> wrote in message
news:1182891307.332293.251610@.u2g2000hsc.googlegro ups.com...
>I am trying to setup a merge (push) replication to a server/database
> in a
> remote network. I created the publication and connected to the remote
> network using VPN but cannot register nor see the remote sql server.
> In sql
> server 2000, I was able to register the server in my Enterprise
> Manager
> (after creating an alias) and then created the push subscription. I
> connect
> to the remote network server using VPN. How do I go about doing this
> in SQL
> Server 2005? The publisher is a WorkGroup edition while the subscriber
> is
> standard edition. Authentication is set to both win and sql and
> verified
> the user and password used to attempt registration. Any help will be
> greatly appreciated.
>

connecting to a linked server using VS2005

hi,

i've currently created a linked server using sql server management studio express (it connects to an oracle database to draw data), i can query it all fine using the query analyzer with sql server etc.

how can i start using the linked server data with visual studio 2005? i can't seem to find the linked server anywhere inside the server explorer, am i suppose to import it / connect to it any specific way so i can start using the data retreived from the linked server?

thanks in advance!

create a view in SQL that reads from this linked server, and in ur server explorer, browse ur view,

Hope this helps

|||

Ramzi.Aynati:

create a view in SQL that reads from this linked server, and in ur server explorer, browse ur view,

Hope this helps

thanks, but how do i create a view?

|||

if you would like to hit linked server in you code just add database name to each object your would like to access. You can run query on server to which you are connected and server will forward your query to linked server. for example if your SQLServer2 is linked server in SQlServer1 you can run query like this om SQLServer1 ( if user you used to link servers have rights to objects in your query)

select * from [SQLserver2].[database].dbo.[tablename]

you can connect results from multiple servers

select * from [SQLserver2].[database].dbo.[tablename]
left join [SQLserver1].[database1].dbo.[tablename1]
ON tablename.aa=tablename1.bb

If you only use linked server in your query you can use OpenQuery which will process data on the linked server and returns only results to you.

SELECT * from OPENQUERY([SQLServer2,' select * from [database].dbo.[tablename]')

Thanks

|||

In your SQL, go to ur query analyzer

and type

Create View View_name as

SELECT *
FROM TEST1.Northwind.dbo.Orders

//where test is ur linked server

This is it, u got urself a view accessible from ur server explorer

|||

I would not recommend to create view like this because it will work very slow. To create view SQL server will try to load all data required to generate view from linked server to your server so it will generate very heavy network traffic and will be very slow. The better way is to get exactly what you need from your linked server or create view on linked server and access it from your main server.

Best solution will be to use Stored procedure to do this or table returned function (but not everything will work in function)

Thanks

|||

jpazgier:

I would not recommend to create view like this because it will work very slow. To create view SQL server will try to load all data required to generate view from linked server to your server so it will generate very heavy network traffic and will be very slow. The better way is to get exactly what you need from your linked server or create view on linked server and access it from your main server.

Best solution will be to use Stored procedure to do this or table returned function (but not everything will work in function)

Thanks

thanks, i might try both options.. would you happen to know of any tutorials that would put me to the right direction in creating a stored procedure to do this? thanks

|||

Dear Frank

As long as the table ur querying is less than 10000 records, u wont feel a pinch, the difference will be in milli seconds,

The topic jpazgier is raising is for really advanced SQL programming and for huge amount of records over 1 million

|||

thanks, have given it a go and i get this error message, any idea what i'm doing wrong?

OLE DB error trace [Non-interface error].

Msg 7312, Level 16, State 1, Procedure OracleComDir, Line 3

Invalid use of schema and/or catalog for OLE DB provider 'MSDAORA'. A four-part name was supplied, but the provider does not expose the necessary interfaces to use a catalog and/or schema.

|||nevermind, worked it out, thanks :)|||

Dear Frank

Please dont forget to mark the post that helped u the most as answered for sake of future readers

Glad to be of help my friend

|||

jpazgier:

I would not recommend to create view like this because it will work very slow. To create view SQL server will try to load all data required to generate view from linked server to your server so it will generate very heavy network traffic and will be very slow. The better way is to get exactly what you need from your linked server or create view on linked server and access it from your main server.

Best solution will be to use Stored procedure to do this or table returned function (but not everything will work in function)

Thanks

turns out there's about 500,000 records in the database, so results are generating really slow.

i've been attempting to create a stored procedure, but it's still taking 20 odd seconds to bring up the results, here's a basic summary of my stored procedure:

ALTER PROCEDURE GetOracleData
AS

SELECT
oracle_table1.field1,
oracle_table1.field2,
oracle_table2.field1,
oracle_table2.field2

from
OracleCD..oracle_database1.table1,
OracleCD..oracle_database2.table2

WHERE
(oracle_table1.field1 = oracle_table2.field1) AND
(oracle_table1.field2 = oracle_table2.field2)

OracleCD = name of the linked server i created, i'm thinking the fact that i'm calling the data from the linked server is the reason why it's taking soo long for the data to load? what's the best way to call upon data from different databases in a stored procedure?

thanks in advance!

Connecting to a DB in a non-trusted domain

SQL Server 2000 mainly, but also 2005 (Management Studio only)
We are restructuring our network and have created a new QA (clustered)
server in a new, non-trusted domain (named QA). To do the initial setup of
the server, I've been using rdp to login to the box and run EM there (the
server is 2000). The rdp login process is flawless.
When I attempt to create a New Server registration in EM, or MS I get the
error:
machine.qa.name.com - SQL Server does not exist access denied.
ConnectionOpen (Connect())
Checking the event log on the remote server, I see the attempted login with
the CORP domain, not the QA domain
So, I tried to create a local SQL Server login: QA\myname and when I check
the event log, I get the same CORP\myname "Unknown user, or bad password"
error. I've also tried entering the server as QA\machine.qa.name.com and
several other combinations.
I'm at a loss. I really need to register this server.
Thanks,
JayFWIW, I get two messages in the remote computers event log:
-- message #1 --
Event Type: Failure Audit
Event Source: Security
Event Category: Account Logon
Event ID: 680
Date: 11/6/2007
Time: 10:53:08 AM
User: NT AUTHORITY\SYSTEM
Computer: __QA_ClusterNode-A__
Description:
Logon attempt by: MICROSOFT_AUTHENTICATION_PACKAGE_V1_0
Logon account: __MyLoginName__
Source Workstation: __MyWorkstation__
Error Code: 0xC0000064
For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.
--
-- message #2
Event Type: Failure Audit
Event Source: Security
Event Category: Logon/Logoff
Event ID: 529
Date: 11/6/2007
Time: 10:53:07 AM
User: NT AUTHORITY\SYSTEM
Computer: __QA_ClusterNode-A__
Description:
Logon Failure:
Reason: Unknown user name or bad password
User Name: MyLoginName
Domain: __MYDOMAIN__
Logon Type: 3
Logon Process: NtLmSsp
Authentication Package: NTLM
Workstation Name: __MyWorkStation__
Caller User Name: -
Caller Domain: -
Caller Logon ID: -
Caller Process ID: -
Transited Services: -
Source Network Address: __My_IP_Address__
Source Port: 0
For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.
--
"Jay" <nospan@.nospam.org> wrote in message
news:OymY1FKIIHA.4808@.TK2MSFTNGP05.phx.gbl...
> SQL Server 2000 mainly, but also 2005 (Management Studio only)
> We are restructuring our network and have created a new QA (clustered)
> server in a new, non-trusted domain (named QA). To do the initial setup of
> the server, I've been using rdp to login to the box and run EM there (the
> server is 2000). The rdp login process is flawless.
> When I attempt to create a New Server registration in EM, or MS I get the
> error:
> machine.qa.name.com - SQL Server does not exist access denied.
> ConnectionOpen (Connect())
> Checking the event log on the remote server, I see the attempted login
> with the CORP domain, not the QA domain
> So, I tried to create a local SQL Server login: QA\myname and when I check
> the event log, I get the same CORP\myname "Unknown user, or bad password"
> error. I've also tried entering the server as QA\machine.qa.name.com and
> several other combinations.
> I'm at a loss. I really need to register this server.
> Thanks,
> Jay
>
>|||I have completly uninstalled all of my SQL Server instances and reinstalled
the 2000 tools and am still getting the error.
The only thing I can think of that could have caused this was that I had
previously changed all of the login accounts in services to local to fix a
domain issue that prevented my local instances from starting when the domain
policy was updated. However, as I said, I've removed everything.
"Jay" <nospan@.nospam.org> wrote in message
news:OymY1FKIIHA.4808@.TK2MSFTNGP05.phx.gbl...
> SQL Server 2000 mainly, but also 2005 (Management Studio only)
> We are restructuring our network and have created a new QA (clustered)
> server in a new, non-trusted domain (named QA). To do the initial setup of
> the server, I've been using rdp to login to the box and run EM there (the
> server is 2000). The rdp login process is flawless.
> When I attempt to create a New Server registration in EM, or MS I get the
> error:
> machine.qa.name.com - SQL Server does not exist access denied.
> ConnectionOpen (Connect())
> Checking the event log on the remote server, I see the attempted login
> with the CORP domain, not the QA domain
> So, I tried to create a local SQL Server login: QA\myname and when I check
> the event log, I get the same CORP\myname "Unknown user, or bad password"
> error. I've also tried entering the server as QA\machine.qa.name.com and
> several other combinations.
> I'm at a loss. I really need to register this server.
> Thanks,
> Jay
>
>

Saturday, February 25, 2012

Connecting sql server with asp.net


i have created an asp.net application with sql server2000 as backend in my localsystem.

when i deployed the project in other sytem in network,
i receive the following error message.
"sql server does not exsist or access denied"
when i create the same database in local system and change the data source name with local system in configuration file, the application is working.

i do not face this problem with vb.net application as it takes its datasource from network system.

is there anything like i have to give permission for asp.net in sql server network utility.

can anyone sort out the problem

tell me the connection string ?

|||

i have sorted out this issue.

The solution is go to secuity create a new login and give permission to remote server.

connecting sql server

i created a database, when i query a simple select statement , i get an
error:
"Cannot open database requested in login 'XYZ_Database'.
Login fails, Login failed for user 'sa''
But when i change , the database name to Northwind, it works.
i checked that user rights of 'sa' for XYZ_database and Northwind are the
same?
i get the same error, when i used integrated security to connect too.
what would be the case here?
Hi,
It seems the database creator/owner might be some other user.
Execute the below command to check the database owner:-
sp_helpdb 'XYZ_Database'
If the owner is a non SA user , then change the database owner using:-
sp_changedbowner system procedure (Refer books online for information)
Thanks
Hari
MCDBA
"e-mid" <someone@.somewhere> wrote in message
news:#uip9U6VEHA.208@.TK2MSFTNGP10.phx.gbl...
> i created a database, when i query a simple select statement , i get an
> error:
> "Cannot open database requested in login 'XYZ_Database'.
> Login fails, Login failed for user 'sa''
>
> But when i change , the database name to Northwind, it works.
> i checked that user rights of 'sa' for XYZ_database and Northwind are the
> same?
> i get the same error, when i used integrated security to connect too.
> what would be the case here?
>
|||Hari;
user of the database seems to be sa; here is the properties of the database:
"XYZ_database 3.00 MB sa 7 Jun 21 2004 Status=ONLINE,
Updateability=READ_WRITE, UserAccess=MULTI_USER, Recovery=FULL,
Version=539, Collation=Latin1_General_CI_AS, SQLSortOrder=0,
IsTornPageDetectionEnabled, IsAutoCreateStatistics, IsAutoUpdateStatistics
80"
what else can be the problem?
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:#Sh3WY6VEHA.1144@.TK2MSFTNGP10.phx.gbl...[vbcol=seagreen]
> Hi,
> It seems the database creator/owner might be some other user.
> Execute the below command to check the database owner:-
> sp_helpdb 'XYZ_Database'
> If the owner is a non SA user , then change the database owner using:-
> sp_changedbowner system procedure (Refer books online for information)
> Thanks
> Hari
> MCDBA
>
>
> "e-mid" <someone@.somewhere> wrote in message
> news:#uip9U6VEHA.208@.TK2MSFTNGP10.phx.gbl...
the
>
|||i am becoming insane.
i did not change even a letter but it is working now ?!
"e-mid" <someone@.somewhere> wrote in message
news:u7BQSe6VEHA.2520@.TK2MSFTNGP12.phx.gbl...
> Hari;
> user of the database seems to be sa; here is the properties of the
database:[vbcol=seagreen]
> "XYZ_database 3.00 MB sa 7 Jun 21 2004 Status=ONLINE,
> Updateability=READ_WRITE, UserAccess=MULTI_USER, Recovery=FULL,
> Version=539, Collation=Latin1_General_CI_AS, SQLSortOrder=0,
> IsTornPageDetectionEnabled, IsAutoCreateStatistics, IsAutoUpdateStatistics
> 80"
> what else can be the problem?
> "Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
> news:#Sh3WY6VEHA.1144@.TK2MSFTNGP10.phx.gbl...
an
> the
>
|||Good.
Thanks
Hari
MCDBA
"e-mid" <someone@.somewhere> wrote in message
news:OFRlQt6VEHA.2408@.tk2msftngp13.phx.gbl...[vbcol=seagreen]
> i am becoming insane.
> i did not change even a letter but it is working now ?!
>
> "e-mid" <someone@.somewhere> wrote in message
> news:u7BQSe6VEHA.2520@.TK2MSFTNGP12.phx.gbl...
> database:
IsAutoUpdateStatistics[vbcol=seagreen]
> an
are[vbcol=seagreen]
too.
>

connecting sql server

i created a database, when i query a simple select statement , i get an
error:
"Cannot open database requested in login 'XYZ_Database'.
Login fails, Login failed for user 'sa''
But when i change , the database name to Northwind, it works.
i checked that user rights of 'sa' for XYZ_database and Northwind are the
same?
i get the same error, when i used integrated security to connect too.
what would be the case here?Hi,
It seems the database creator/owner might be some other user.
Execute the below command to check the database owner:-
sp_helpdb 'XYZ_Database'
If the owner is a non SA user , then change the database owner using:-
sp_changedbowner system procedure (Refer books online for information)
Thanks
Hari
MCDBA
"e-mid" <someone@.somewhere> wrote in message
news:#uip9U6VEHA.208@.TK2MSFTNGP10.phx.gbl...
> i created a database, when i query a simple select statement , i get an
> error:
> "Cannot open database requested in login 'XYZ_Database'.
> Login fails, Login failed for user 'sa''
>
> But when i change , the database name to Northwind, it works.
> i checked that user rights of 'sa' for XYZ_database and Northwind are the
> same?
> i get the same error, when i used integrated security to connect too.
> what would be the case here?
>|||Hari;
user of the database seems to be sa; here is the properties of the database:
"XYZ_database 3.00 MB sa 7 Jun 21 2004 Status=ONLINE,
Updateability=READ_WRITE, UserAccess=MULTI_USER, Recovery=FULL,
Version=539, Collation=Latin1_General_CI_AS, SQLSortOrder=0,
IsTornPageDetectionEnabled, IsAutoCreateStatistics, IsAutoUpdateStatistics
80"
what else can be the problem?
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
news:#Sh3WY6VEHA.1144@.TK2MSFTNGP10.phx.gbl...
> Hi,
> It seems the database creator/owner might be some other user.
> Execute the below command to check the database owner:-
> sp_helpdb 'XYZ_Database'
> If the owner is a non SA user , then change the database owner using:-
> sp_changedbowner system procedure (Refer books online for information)
> Thanks
> Hari
> MCDBA
>
>
> "e-mid" <someone@.somewhere> wrote in message
> news:#uip9U6VEHA.208@.TK2MSFTNGP10.phx.gbl...
> > i created a database, when i query a simple select statement , i get an
> > error:
> >
> > "Cannot open database requested in login 'XYZ_Database'.
> > Login fails, Login failed for user 'sa''
> >
> >
> > But when i change , the database name to Northwind, it works.
> >
> > i checked that user rights of 'sa' for XYZ_database and Northwind are
the
> > same?
> >
> > i get the same error, when i used integrated security to connect too.
> >
> > what would be the case here?
> >
> >
>|||i am becoming insane.
i did not change even a letter but it is working now '!
"e-mid" <someone@.somewhere> wrote in message
news:u7BQSe6VEHA.2520@.TK2MSFTNGP12.phx.gbl...
> Hari;
> user of the database seems to be sa; here is the properties of the
database:
> "XYZ_database 3.00 MB sa 7 Jun 21 2004 Status=ONLINE,
> Updateability=READ_WRITE, UserAccess=MULTI_USER, Recovery=FULL,
> Version=539, Collation=Latin1_General_CI_AS, SQLSortOrder=0,
> IsTornPageDetectionEnabled, IsAutoCreateStatistics, IsAutoUpdateStatistics
> 80"
> what else can be the problem?
> "Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
> news:#Sh3WY6VEHA.1144@.TK2MSFTNGP10.phx.gbl...
> > Hi,
> >
> > It seems the database creator/owner might be some other user.
> >
> > Execute the below command to check the database owner:-
> >
> > sp_helpdb 'XYZ_Database'
> >
> > If the owner is a non SA user , then change the database owner using:-
> >
> > sp_changedbowner system procedure (Refer books online for information)
> >
> > Thanks
> > Hari
> > MCDBA
> >
> >
> >
> >
> > "e-mid" <someone@.somewhere> wrote in message
> > news:#uip9U6VEHA.208@.TK2MSFTNGP10.phx.gbl...
> > > i created a database, when i query a simple select statement , i get
an
> > > error:
> > >
> > > "Cannot open database requested in login 'XYZ_Database'.
> > > Login fails, Login failed for user 'sa''
> > >
> > >
> > > But when i change , the database name to Northwind, it works.
> > >
> > > i checked that user rights of 'sa' for XYZ_database and Northwind are
> the
> > > same?
> > >
> > > i get the same error, when i used integrated security to connect too.
> > >
> > > what would be the case here?
> > >
> > >
> >
> >
>|||Good. :)
Thanks
Hari
MCDBA
"e-mid" <someone@.somewhere> wrote in message
news:OFRlQt6VEHA.2408@.tk2msftngp13.phx.gbl...
> i am becoming insane.
> i did not change even a letter but it is working now '!
>
> "e-mid" <someone@.somewhere> wrote in message
> news:u7BQSe6VEHA.2520@.TK2MSFTNGP12.phx.gbl...
> > Hari;
> >
> > user of the database seems to be sa; here is the properties of the
> database:
> >
> > "XYZ_database 3.00 MB sa 7 Jun 21 2004 Status=ONLINE,
> >
> > Updateability=READ_WRITE, UserAccess=MULTI_USER, Recovery=FULL,
> >
> > Version=539, Collation=Latin1_General_CI_AS, SQLSortOrder=0,
> >
> > IsTornPageDetectionEnabled, IsAutoCreateStatistics,
IsAutoUpdateStatistics
> > 80"
> >
> > what else can be the problem?
> >
> > "Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message
> > news:#Sh3WY6VEHA.1144@.TK2MSFTNGP10.phx.gbl...
> > > Hi,
> > >
> > > It seems the database creator/owner might be some other user.
> > >
> > > Execute the below command to check the database owner:-
> > >
> > > sp_helpdb 'XYZ_Database'
> > >
> > > If the owner is a non SA user , then change the database owner using:-
> > >
> > > sp_changedbowner system procedure (Refer books online for information)
> > >
> > > Thanks
> > > Hari
> > > MCDBA
> > >
> > >
> > >
> > >
> > > "e-mid" <someone@.somewhere> wrote in message
> > > news:#uip9U6VEHA.208@.TK2MSFTNGP10.phx.gbl...
> > > > i created a database, when i query a simple select statement , i get
> an
> > > > error:
> > > >
> > > > "Cannot open database requested in login 'XYZ_Database'.
> > > > Login fails, Login failed for user 'sa''
> > > >
> > > >
> > > > But when i change , the database name to Northwind, it works.
> > > >
> > > > i checked that user rights of 'sa' for XYZ_database and Northwind
are
> > the
> > > > same?
> > > >
> > > > i get the same error, when i used integrated security to connect
too.
> > > >
> > > > what would be the case here?
> > > >
> > > >
> > >
> > >
> >
> >
>