Showing posts with label string. Show all posts
Showing posts with label string. Show all posts

Tuesday, March 27, 2012

Connection problem

My VB 6 program uses this connection string to connect to the server:
user id=coord;data source=GS;persist security
info=True;Password=coord;initial catalog=CoordinatorTest
It works fine on all XP machines, but it doesn't work on only some of Vista
Business machines. It says Server doesn't exists or access denied. On some
other Vistas it works.
When I replace the name of the SQL Server with IP:
user id=coord;data source=10.22.52.4;persist security
info=True;Password=coord;initial catalog=CoordinatorTest
then it works.
I wouldn't want to create the different Connection strings for different
operating systems.
What's wrong with some of non working Vista's machines? What should be done
in order to make all of Vista machines work?
Thank you
vovan"vovan" <v@.v.com> wrote in message
news:%23v2T$CGEIHA.3332@.TK2MSFTNGP04.phx.gbl...
> When I replace the name of the SQL Server with IP:
> user id=coord;data source=10.22.52.4;persist security then it works.
It sounds like your Vista machines can locate data sources by IP address,
but not by hostname. You'd want to troubleshoot this as a general TCP/IP
Name resolution problem - make sure DNS Settings are correct; does a "ping
<hostname> from an Vista Command Line give same results as "ping <IP
address>"?; etc.
The Netdiag tool from the XP Support Tools also runs on Vista; just copy
over the netdiag.exe file from XP. Then run
C:\FOO>netdiag /v /debug
on the Vista machine, to run a comprehensive test for DNS and Domain
problems.
You don't say whether you're using ODBC, OLE DB, SQL Native Client, or what;
but generally, they should all work on Vista much the same as on XP. More
likely to be networking than compatibility, I'd guess.
Hope it helps,
--
Andrew McLaren
amclar (at) optusnet dot com dot au

Sunday, March 25, 2012

Connection problem

Hello!
Recently i have found SQLAPI++ library and it convinced me.
BUT i have some problems to connect to the SQL Server.
My connection string looks like that:
con.Connect(
"MOON", // database name
"abc", // user name
"abc", // password
SA_SQLServer_Client);

I always receive this message trying to connect:
[DBNETLIB][ConnectionOpen
(Connect()).]SQL Server does not exist or access denied

or with this connectioj string

con.Connect(
"MOON@.myClient", // database name
"abc", // user name
"abc", // password
SA_SQLServer_Client);

my authication seems to be wrong!

Is that a sql server configuration problem? I use windows authication to connect to the database server.

Any hints are welcome

Thanks

StefanWhat language are you using to program ? The authentification method could be your problem. Have you tried to enable sql server authetification and adding the userid abc and password abc ? Also, check out the connection method parameters - there should be a parameter that allows you to choose authentification method.|||Originally posted by rnealejr
What language are you using to program ? The authentification method could be your problem. Have you tried to enable sql server authetification and adding the userid abc and password abc ? Also, check out the connection method parameters - there should be a parameter that allows you to choose authentification method.

I use C++ with the SQLAPI++ Library!
I found out how it does it work. The userID and the password string have to be empty! Too easy
Thanks
Stefan

Connection pooling issues!

I've got a function that returns a connection to a DataReader:

static public SqlDataReader GetDR(string sql,string connString){SqlConnection myConn =new SqlConnection(connString);SqlCommand cmd =new SqlCommand(sql, myConn);SqlDataReader dr;myConn.Open();dr = cmd.ExecuteReader();return dr;}

I call it like so:

SqlDataReader dr = PAS.GetSqlDataReader.GetDR(sql, connString);

And I'm always careful to close the connection when I'm done using it via dr.Close(). Except I just started noticing that when I run my app and
start doing a fair amount of work around it - I very quickly get a timeout that I've run out of connections. D'oh! I've triple checked my code and
verified that Ialways remember to close my connections. It's there -every single time!

So I'm obviously missing something. Should I not be using a function like GetDR since it doesn't close the connection within the function? 

closing a reader does not automatically close the connection.

dr.close() simply closes the reader leaving the connection open.

if you want to close the connection automatically when the reader is closed, you need to use an overload to the ExecuteReader method

 dr = cmd.ExecuteReader(Data.CommandBehavior.CloseConnection);
http://msdn2.microsoft.com/en-us/library/y6wy5a0f.aspx|||What's the proper way to close the connection then?|||

Am I correct that this opens the connection:

SqlConnection myConn = new SqlConnection(connString);

And this closes it:

myConn.Dispose();

I guess my problem is that my GetDR function returns a DataReader leaving me no access to close myConn. Anything I can do about that?

|||

For some reason, I totally looked over your piece of code to close the connection when the reader is closed. It's exactly what I needed (obviously). Thanks for your help. Seems to be working great now!

mbanavige:

closing a reader does not automatically close the connection.

dr.close() simply closes the reader leaving the connection open.

if you want to close the connection automatically when the reader is closed, you need to use an overload to the ExecuteReader method

 dr = cmd.ExecuteReader(Data.CommandBehavior.CloseConnection);
http://msdn2.microsoft.com/en-us/library/y6wy5a0f.aspx

Monday, March 19, 2012

Connection Manager ignores expressions with script component

I have written a script source component and attached a flat file connection. The connection string of which is defined by an expression.

However when I get the connectionstring from the connection in the script it has the default filename value of flat file not the value of the expression. This is proved by passing in the filename variable, and comparing the 2.

The flat file has an expression on the ConnectionString of @.[User::filename]

Can someone confirm this is a bug.

Is this any help to you: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=295220&SiteID=1

-Jamie

|||Looks like it, needs some clarification though.

Sunday, March 11, 2012

Connection For Clustered Server

We have having a problem connecting to our 4 node cluster using an ado.net connection.
Here is what we have:

Connection String:


<appSettings>
<add key="ConnectionString" value="workstation id=AH501780;packet size=4096;integrated security=SSPI;data source=XXXXXX\XXXXXX;persist security info=False;initial catalog=xxxx" />
</appSettings>

We added in the Web.config file:


<identity impersonate="true"/>
<authentication mode="Windows" />

In IIS 6 we have windows authentication checked.

We get the following error when we try to run the program:


SQL Server does not exist or access denied.
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.

We have the SQL Profiler running and we don't see any connection being made. Any help would be appreciated!

Thanks,
TreyTry this for general error message troubleshooting:

http://support.microsoft.com/default.aspx?kbid=328306

It could also be caused due to an incorrect renaming of the cluster:

http://support.microsoft.com/default.aspx?kbid=307336

Are you going through a firewall? Try this:

http://support.microsoft.com/default.aspx?kbid=318432

Also, is the SQL Server updated with SP3?|||We got a little further with our problem. We have a VB.net windows application that will connect using that connection string. But the asp.net app will not. We also now added a port number to the connection string and we get the following error:


Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
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: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.

So once again I hit another wall.

Trey|||In IIS, check under Authentication to see if "Anonymous" authentication is still enabled. Or you could add the following to your web.config (if it is already there, replace it with this):

<authorization>
<deny users="?" />
</authorization>|||Just wondering...dose my server need to use Active Directory?|||Is the SQL Server on the same server as the web server? If so, no. Otherwise, you need to configure the setup differently if you are not using AD.|||the web server and the SQL culter are on different boxes. where do i need to look now?|||Try creating a domain account on the network, then give that account permission to log into the SQL Server cluster. Then have your web app impersonate that account and see what happens.

Friday, February 24, 2012

Connection Error

Hi
I have a VB6 program that talks to SQL Server 2000 database. The Connection
String is as below:
Provider=SQLOLEDB.1;Persist Security Info=False;User ID=" & M_USER_NAME &
";Password=" & M_PASSWORD & ";Initial Catalog=" & Database & ";Data Source="
& M_SERVER
When the program is idle for a while, the connection terminates.
Also, when I try to connect using ODBC I get the following error
Connection failed;.
SQLState: '01000'
SQL Server Error: 53
[Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen(Connect())
Connection failed;
SQLState: '08001'
SQL Server Error: 17
[Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or
access denied.
Any ideas or suggestions. Dont know where to start looking.
The SQL Server is running. I have double-checked that.
Please HELP
ThanksHi, Raju
See:
http://support.microsoft.com/kb/328306
http://support.microsoft.com/kb/827422
Razvan|||trest
"Razvan Socol" <rsocol@.gmail.com> schrieb im Newsbeitrag
news:1132744113.256414.11460@.g43g2000cwa.googlegroups.com...
> Hi, Raju
> See:
> http://support.microsoft.com/kb/328306
> http://support.microsoft.com/kb/827422
> Razvan
>

Friday, February 17, 2012

connection

Please help me resolve I'm stuck and a novice
I have a connection string in a VB app that I am working
on but when i execute app I get
Run time Error -2147467259 (80004005) Login failed for
user *** reseaon not a trusted SQL Server connection.
I am set up on SQL server I can run enterprise manage from
my PC and run queries against server but I can not through
my application, I am set up using my windows user info..Hi, Chuck.
Refer to the following site:
http://www.able-consulting.com/ado_conn.htm
You can see many connection examples. This may help you.
"Chuck" <anonymous@.discussions.microsoft.com> wrote in message
news:051d01c3bbd7$20610da0$a501280a@.phx.gbl...
> Please help me resolve I'm stuck and a novice
> I have a connection string in a VB app that I am working
> on but when i execute app I get
> Run time Error -2147467259 (80004005) Login failed for
> user *** reseaon not a trusted SQL Server connection.
> I am set up on SQL server I can run enterprise manage from
> my PC and run queries against server but I can not through
> my application, I am set up using my windows user info..

Connectio String .SDE Vs .DBO

Hi. i have a problem.

I want to Update a Database like this GISETS.SDE.CADENA, but it sais that it wants update this GISETS.DBO.CADENA (Database that doesn′t exist).

I use a connection string .sde but it gets a conflict because the reference is for a database .dbo. how can I fix it?

thanks for advance. Sorry for my english.

Fernando.

which version of sql server is this? IF its 2005 then Object is owned by Schema and if its 2000 then the objects are owned by User. So *SDE* here is either schema (2005) or its a User(2000). First check who is the owner of CADENA Table. if the owner is DBO change the FQN (Fully qualified name) GISETS.DBO.CADENA or change the owner ship to SDE schema/user

Madhu

|||

Good Morning Madhu (I′m from Spain).

I Use 2005, and the schema of CADENA table is SDE. In the propierties I can′t see who is the owner of the table, where i can see this? How can I change the FQN and where?

thanks in advance.

Fernando.

|||

In 2005, Schema is the object owner. where as in 2000 user is the object owner. So SDE is the owner of the table. You can't change FQN, what i said what when we refer object , refer it like Database.Schema.TableName. Before changing Schema of table CADENA to DBO , think twice. why because the object may be refered in many place with schema SDE.

To change CADENA table schema from SDE to DBO run following query

ALTER SCHEMA DBO TRANSFER SDE.CADENA

Madhu

Connectio String .SDE Vs .DBO

Hi. i have a problem.

I want to Update a Database like this GISETS.SDE.CADENA, but it sais that it wants update this GISETS.DBO.CADENA (Database that doesn′t exist).

I use a connection string .sde but it gets a conflict because the reference is for a database .dbo. how can I fix it?

thanks for advance. Sorry for my english.

Fernando.

which version of sql server is this? IF its 2005 then Object is owned by Schema and if its 2000 then the objects are owned by User. So *SDE* here is either schema (2005) or its a User(2000). First check who is the owner of CADENA Table. if the owner is DBO change the FQN (Fully qualified name) GISETS.DBO.CADENA or change the owner ship to SDE schema/user

Madhu

|||

Good Morning Madhu (I′m from Spain).

I Use 2005, and the schema of CADENA table is SDE. In the propierties I can′t see who is the owner of the table, where i can see this? How can I change the FQN and where?

thanks in advance.

Fernando.

|||

In 2005, Schema is the object owner. where as in 2000 user is the object owner. So SDE is the owner of the table. You can't change FQN, what i said what when we refer object , refer it like Database.Schema.TableName. Before changing Schema of table CADENA to DBO , think twice. why because the object may be refered in many place with schema SDE.

To change CADENA table schema from SDE to DBO run following query

ALTER SCHEMA DBO TRANSFER SDE.CADENA

Madhu

connecting with database

Using web dev and sql 2005 express

I have published web app and database to my server but can,t get connection string to connect with the database.

---------------------

Login failed for user ''. The user is not associated with a trusted SQL Server connection.

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: Login failed for user ''. The user is not associated with a trusted SQL Server connection.

---------------------

I have created a user in the logins in the sql server security node and give him every permission

going.

I have also created a login in the security node for the database.... and given him all permissions

But I still can,t get the connection string from the web app to connect to the database?

Where am I going wrong

Can you show us your connection string?

|||Try to provide the user name and password in your connection string instead of using Integrated Security=True

|||

I have one database on the server with both the asp.net and my own database within it.

<addname="*******************"connectionString="Data Source=*********.*******.com;Initial Catalog=mydatabasename;Integrated Security=True;User Id=nameofpersonindatabaseschema;Password=hispassword;Connection Timeout=40;User Instance=True"providerName="System.Data.SqlClient" />

<removename="LocalSqlServer"/>

<addname="LocalSqlServer"connectionString="Data Source=*******.*********.com;Initial Catalog=mydatabasename;Integrated Security=True;User Id=nameofpersonindatabaseschema;Password=hispassword;Connection Timeout=40;User Instance=True"providerName="System.Data.SqlClient" />

Now I diid change a few minutes ago .........integrated security =false and got this

---------------

Failed to generate a user instance of SQL Server. Only an integrated connection can generate a user instance. The connection will be closed.

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: Failed to generate a user instance of SQL Server. Only an integrated connection can generate a user instance. The connection will be closed.
--------------

Never seen that error before.....

|||

Remove "User Instance=True" and "Integrated Security=True" and set the server to accept SQL Authentication.

|||

OOh sweet...all working...web app loading to server.

now to down grade permissions

well done fatman

Tuesday, February 14, 2012

Connecting to SQLExpress from classic ASP.

Migrating a site to a new server. Moved data to SQLExpress. Changed connection string to point to SQLExpress and now I am getting this error.

Microsoft OLE DB Provider for SQL Servererror '80004005'

Cannot open database "PHCSQL" requested by the login. The login failed.

/func/inc_DatabaseFunctions.inc, line 5
Do I need to do permissions differently than MSDE?
Did connection strings change?
Help?

Hi,
Download the full eval version and install it as a named instance and register the Express. How install the full version management studio which is a separate install and right click at the top to register the Express. Then create permissions for Asp in the security section of management studio. Another option is to just restore the backup .bak file of the MSDE with the backup and restore wizard and choose the restore from a device option. Try the links below to download the eval verion and connection strings including old style connection strings. Hope this helps.

http://www.microsoft.com/sql/downloads/trial-software.mspx

http://www.carlprothman.net/Default.aspx?tabid=81

Sunday, February 12, 2012

Connecting to SQL Server via a Lan Connection

Hi, I have developed a windows form application which connects to a sql server 2k database via the following conneciton string:

Private con As New SqlConnection("Data Source=(local);trusted_connection=true;Initial Catalog=Database1")

This works fine for running locally but I need to give my Windows form application to other users on the lan and have them reach my database server. So next I tried:

Private con As New SqlConnection("WorkStation ID= E134017.nw.nos.Boeing.com;Data Source=(local);trusted_connection=true;Initial Catalog=Database1")

where E134017.nw.nos.boeing.com is the full network path to my computer

It does not work and results in "Server does not exist or access is denied"

I next went in SQL and turned on tcp/ip and still no luck.

Any ideas,

Fred

Hi Fred
I think you have to change your Data source in the connection string to the Server Name (PC Name that the SQL server is installed on)
i.e.
Private con As New SqlConnection("Data Source=FredPC;trusted_connection=true;Initial Catalog=Database1")

Friday, February 10, 2012

Connecting to SQL Server database via windows form app

Hi, I have developed a windows form application which connects to a sql server 2k database via the following conneciton string:

Private con As New SqlConnection("Data Source=(local);trusted_connection=true;Initial Catalog=Database1")

This works fine for running locally but I need to give my Windows form application to other users on the lan and have them reach my database server. So next I tried:

Private con As New SqlConnection("WorkStation ID= E134017.nw.nos.Boeing.com;Data Source=(local);trusted_connection=true;Initial Catalog=Database1")

where E134017.nw.nos.boeing.com is the full network path to my computer

It does not work and results in "Server does not exist or access is denied"

I next went in SQL and turned on tcp/ip and still no luck.

Any ideas,

Fred

The good way of doing this, at least in my opinion is to kepp the connectin string in App.Config file, thus you can chage it without bother to compile again.
so you'll have something like

<configuration>
<add key="ConnectionString" value="server=(local);trusted_connection=yes;database=b1;"/>
</configuration>

when you copy the application to another workstation, you can change the connection string to server=DB_SERVER_NAME;trusted_connection=yes;database=b1;", where DB_SERVER_NAME is the name of the cmputer where the SQL Server is or the one that you refer to local. Then you have to add the remote users into your database server and grant access to db1.|||Your connection string is looking for a SQL Server on the user's workstation. Don't you want to change your Data Source property to point to the name of your database server?

Darrel|||that's the reason i explain in the 2nd paragraph to replace the DB_SERVER_NAME appropriately.|||Ok, this is the connection string I am using

Data Source = \\E134017.nw.nos.boeing.com;Trusted_Connection=True;Initial Catalog=Database1

\\E134017.nw.nos.boeing.com is the full path to the server computer. E134017 is the computer name.

Using this connection string, I go to another computer on the network and login and try to reach my server thru my connection string.

I get"Server does not exist or access is denied"

That same connection string works fine as a login on the server itself.

I am lost.

Fred|||

The SQL forum is a better venue for your question.

|||This is the connection string we use in our Winapps:
Data Source=<Your server name here>;user id=<your user ID here>;password=<users Password here>;initial catalog=<Database name here>
Hope this helps
Deasun|||then use this

server=E134017;trusted_connection=yes;database=Database1;