Showing posts with label connecting. Show all posts
Showing posts with label connecting. Show all posts

Tuesday, March 20, 2012

Odd issue connecting to a named instance.

Hi everyone,

Please forgive me for the newbie question, I've done almost all of my DBA work on Oracle(on UNIX so I'm learning alot of AD stuff too) and am new to MS SQL Server.

I've got a SQL 2005 standard server that I'm trying to get to act as a publisher for a SQL 2005 Express instance, and I think I've narrowed down my problem to a connection issue.

(FYI, the Publisher works fine with another 2005 Standard server)

When I try to connect from the standard server to the express server using 'XYZ\SQLEXRESS' as my server name, it fails stating that it couldn't find the service, but I can connect just fine if I use 'XYZ' as the server name.

I think this is why I'm having trouble getting replication going as the replication wizard tells me that I have to connect via 'XYZ\SQLEXPRESS' in order to run the replication scripts.

Can anyone point me to the correct documentation to resolve this problem? Everything was easy-mode DBA work until we tried to add SQL Express to the mix, and I'm sort of running out of time on this one.

Thanks for any help!

The main thing to check is SQLExpress will default to local only connectivity mode. So if you are trying to access SQLExpress from a different machine this will not work unless you enable remote access. To do this run the SQL Server 2005 Surface Area Configuration tool and select your instance and enable remote connections (then restart SQLExpress instance).

If everything is local, then I would suspect that the SQL Browser service is disabled. This service is used to locate named instances. So enable this service and start it and everything should start working.

|||

Ahh, I'm sorry I didn't clairify.

I've got network connections on the SQL Express machine enabled, and is setup on port 1433. I'm attempting to connect from a remote machine via the management tool for testing purposes. If I try to connect using 'XYZ' as my server, it works, but if I try to connect using 'XYZ\SQLEXPRESS', it fails. I can connect as ether if I am doing it locally on the SQL Express machine.

Thanks again!

EDIT: Hahaha! You gave me the answer anyways. I enabled the SQL browser, and it worked. :-)

Thanks for beign a life-saver.

|||

Ahh cool!

Odd FMTONLY statements

Hi,

I recently started using ADO

for connecting to a remote SQL Server from Delphi.

Prior to this I used BDE (Borland Database Engine).

I noticed that all SQL communication seemed slow – only

half the speed of using BDE!

I ran a trace using the Profiler (from MS SQL Server)

and noticed that ADO

generated roughly twice the amount of traffic compared to BDE. Every SQL statement (SELECT,

INSERT and UPDATE) send from my application was preceded by the exact same

statement encapsulated in ‘SET FMTONLY ON/OFF’.

-Example Start-

SET FMTONLY ON SELECT * FROM TabelVersion SET FMTONLY

OFF

SELECT * FROM TabelVersion

-Example End-

Why are these odd statements being passed to the

server?

Shouldn’t the provider be able to handle the returned

dataset without sending the FMTONLY statement in advance? And if not, why doesn’t

it cache this information?

Is it possible to minimize this traffic?


I also spotted quite a lot ‘SET NO_BROWSETABLE ON/OFF’

statements. What is the use for these?

I found this article (http://support.microsoft.com/kb/836830/en-us)

on MSKB, but I should already have the hotfix for this installed by MDAC 2.8 SP1!


This slow pace is killing me – please help - egeskov


My configuration:

Workstation:

WinXP SP2

MDAC 2.8 SP1

(2.81.1117.0)

ConnectionString=’Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist

Security Info=False;Application Name=PD:KE;Data Source=SMIL;Initial

Catalog=PDDebug’

Server:

Windows

Server 2000

SP4

MS SQL

Server 8

FMTONLY is an indication that the provider needs parameter or result metadata prior to execution because the application has not made this available. It would help to see some sample code, but essentially you need to avoid things like cmd.Parameters.Refresh and always set the Type property of parameters, etc. If the application doesn't provide all the metadata the provider needs then it costs a round trip to the server to get it. In most cases applications can be written to avoid this and will perform much better as a result.|||

Chris has well explained why the FMTONLY statements come.

My question is that what is the duration you see of these FMTONLY statements in Profiler trace? How is it compared with the duration of the actual select statement? Based on my experience, these FMTONLY statements usually completes instantly and should not cause severe/noticable performance hit.

|||I have made a small code sample that only connects to the server, runs a single query and disconnects:

// Procedure that runs then the main form is shown
procedure TForm1.FormShow(Sender: TObject);
var Conn: TADOConnection;
Q: TADOQuery;
begin
// The Connection object is constructed and initialized with the connection string
Conn:=TADOConnection.Create(Nil);
Conn.ConnectionString:='Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Application Name=PD:KE;Data Source=Main;Initial Catalog=ProduktData';

// Connecting to the server
Conn.Open;

// The query object is constructed and binded to the connection object
Q:=TADOQuery.Create(Nil);
Q.Connection:=Conn;

// SQL is feed to the query
Q.SQL.Add('SELECT COUNT(*) FROM Param');

// The query is executed
Q.Open;

// The resulting single cell resultset is written to the forms title
Caption:=Q.Fields[0].AsString;

// Objects are destructed
Q.Free;
Conn.Free;
end;

My trace from running this sample code is visible here:
http://www.diku.dk/hjemmesider/studerende/egeskov/ADOTrace.trc

I have no clue what parameters my code mught be missing.|||FMTONLY itself should execute fairly quickly at the server and profiler will show you the actual cost. The main concern is the rount trip to the server. This may or may not be significant to your application. It depends if the client and server are on the same system, how scalable the app has to be, how heavily loaded the server is, etc.|||i agree that in this case it's hard to see why the FMTONLY is needed. Maybe Delphi always checks for parameters and somehow is somehow focing this. I don't have access to a copy of Delphi and couldn't find any online documentation so can't investigate further myself. They key thing to try is to supply parameter information before executing the query when the query does have parameters, and check if there is a way to tell Delphi that there are no parameters otherwise.|||

Note the FMTONLY statements will be generated by the ADO client cursor code when it is trying to create the client side cursor.

For example look at ->

http://groups.google.com/group/borland.public.delphi.database.sqlservers/browse_thread/thread/99a3a60f8fefa14f/9f7edb9e622d7cfb%239f7edb9e622d7cfb

My recommendation (note I don't know much about TADOQuery but I culled this from searching around the internet) ->

Switch CursorLocation to clUseServer, CursorType to ctOpenForwardOnly and LockType to ltReadOnly

This should avoid it.

|||Thanks for

your interest.

Due to your

suggestions a got hold of the ADOQuery’s ParamCheck property. By disabling

this, I got rid of the FMTONLY statements which increased the performance by

almost 100 % – the number of round trips really is significant!
I have also

done some fiddling about with the CursorLocation, CursorType and LockType, but

my first attempts didn’t improve performance compared to disabling ParamCheck.

I’ll definitely have to look further into this.|||Nice. I have the same problem. I will try this. Did you find a solution for the NO_BROWSE. I have the same thing. Bill.|||No I haven't really looked

into it jet.

Monday, March 12, 2012

ODBC--call failed

I have an Access 97 database (using Jet 4.0) connecting to a SQL 2000
via ODBC - the OS is Win XP Pro SP2. When i open a form to display the
records in the linked table they come up fine, but after about 30
seconds it dings and i get the pop up ODBC--call failed. If i close the
form and reopen it, the records are there again, but the connection
drops again in another 30 seconds.
I'm stumped here because my connection does work, it just keeps
dropping.
Any help or ideas would be greatly appreciated.
Thanks!
Vicki
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!
What happens if after you open the form, you go to the last
record and then go about and do whatever with the form? Does
the same thing still happen?
ODBC call failed can happen for a lot of different reasons.
A good way to track them down is to turn on ODBC tracing to
look for specific errors. You would want to make sure to
turn it back off after you get the error as it will really
slow things down.
To turn on tracing, go to the ODBC Data Source Administrator
applet and go to the tracing tab. Just click on start
tracing now and note the location for the trace file. After
you hit the error, go back and click on the stop tracing now
button. Then you can go to the trace file and see what other
information you can get out of the trace file.
-Sue
On Thu, 13 Jan 2005 13:19:15 -0800, vespo
<anonymous@.devdex.com> wrote:

>
>I have an Access 97 database (using Jet 4.0) connecting to a SQL 2000
>via ODBC - the OS is Win XP Pro SP2. When i open a form to display the
>records in the linked table they come up fine, but after about 30
>seconds it dings and i get the pop up ODBC--call failed. If i close the
>form and reopen it, the records are there again, but the connection
>drops again in another 30 seconds.
>I'm stumped here because my connection does work, it just keeps
>dropping.
>Any help or ideas would be greatly appreciated.
>Thanks!
>Vicki
>*** Sent via Developersdex http://www.codecomments.com ***
>Don't just participate in USENET...get rewarded for it!
|||Thanks Sue!
That ODBC Trace really helped! It turns out it is an issue with Access
97 where even if you bracket an alias fieldname in a SQL View, it
considers reserved words as reserved words and can't bring them across.
I was trying to enable my client the usage of their old Access 97 forms
and reports by linking to the data i migrated into SQL, so to do that i
had created a view that mimicked their old fields names ("Phone Number",
"Date Updated", etc) and had no problems staying connected when i tried
it on my server (which has Access 2000) but unfortunately my client
isn't ready to upgrade their Access version.
Oddly though -- reports will work in Access 97 using the reserved field
name, it's just the forms and opening the table directly which caused
the ODBC to drop.
Thanks again!
Vicki
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!

ODBC--call failed

I have an Access 97 database (using Jet 4.0) connecting to a SQL 2000
via ODBC - the OS is Win XP Pro SP2. When i open a form to display the
records in the linked table they come up fine, but after about 30
seconds it dings and i get the pop up ODBC--call failed. If i close the
form and reopen it, the records are there again, but the connection
drops again in another 30 seconds.
I'm stumped here because my connection does work, it just keeps
dropping.
Any help or ideas would be greatly appreciated.
Thanks!
Vicki
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!What happens if after you open the form, you go to the last
record and then go about and do whatever with the form? Does
the same thing still happen?
ODBC call failed can happen for a lot of different reasons.
A good way to track them down is to turn on ODBC tracing to
look for specific errors. You would want to make sure to
turn it back off after you get the error as it will really
slow things down.
To turn on tracing, go to the ODBC Data Source Administrator
applet and go to the tracing tab. Just click on start
tracing now and note the location for the trace file. After
you hit the error, go back and click on the stop tracing now
button. Then you can go to the trace file and see what other
information you can get out of the trace file.
-Sue
On Thu, 13 Jan 2005 13:19:15 -0800, vespo
<anonymous@.devdex.com> wrote:

>
>I have an Access 97 database (using Jet 4.0) connecting to a SQL 2000
>via ODBC - the OS is Win XP Pro SP2. When i open a form to display the
>records in the linked table they come up fine, but after about 30
>seconds it dings and i get the pop up ODBC--call failed. If i close the
>form and reopen it, the records are there again, but the connection
>drops again in another 30 seconds.
>I'm stumped here because my connection does work, it just keeps
>dropping.
>Any help or ideas would be greatly appreciated.
>Thanks!
>Vicki
>*** Sent via Developersdex http://www.codecomments.com ***
>Don't just participate in USENET...get rewarded for it!|||Thanks Sue!
That ODBC Trace really helped! It turns out it is an issue with Access
97 where even if you bracket an alias fieldname in a SQL View, it
considers reserved words as reserved words and can't bring them across.
I was trying to enable my client the usage of their old Access 97 forms
and reports by linking to the data i migrated into SQL, so to do that i
had created a view that mimicked their old fields names ("Phone Number",
"Date Updated", etc) and had no problems staying connected when i tried
it on my server (which has Access 2000) but unfortunately my client
isn't ready to upgrade their Access version.
Oddly though -- reports will work in Access 97 using the reserved field
name, it's just the forms and opening the table directly which caused
the ODBC to drop.
Thanks again!
Vicki
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!

Friday, March 9, 2012

ODBC Trusted_Connection call to SQLGetInfo returns DBO as user name, not NT User

Hello, all:
I am connecting to SQL Server 2000 with a trusted connection, and that is working fine. I then am issuing a SQLGetInfo call to find out the SQL_USER_NAME, which is always returning dbo instead of (my) Windows NT login name, which I expect to see. THe authentication is (apparently) confirmed by the SQL Server session monitor where it shows the right Windows NT user name logged in, over ODBC. With a standard SQL Login, untrusted, I definitely get the right user name back, not dbo.

So:

Login Type / user id /returned value from SQLGetInfo

Windows Authentication / Windows login / dbo
SQL Authentication / Windows login (UID) / UID

The problem is that I am trying to confirm that the userid entered in a dialog or passed on the command line to my application matches the actual connected user name inside SQL Server...

My questions:
Is there some pathology in Trusted_Connections that masks the Windows/NT login name and always returns UID 'dbo' from a call to SQLGetInfo? Is there a MSS (public) stored procedure that can robustly give back the logged in user name so I can bypass the SQLGetInfo call?I think I have finally wrestled this beast to the ground. Here's the story, in case anybody is interested:

1) When making an NTLM trusted connection to MSS, logging in using my NT login name e.g. as amarshall, the system was always saying the connected user is dbo, no matter what. This can be verified by using a SQL tool like SQL Query Analyzer, connecting over a trusted connection to MSS, and entering SELECT USER; or SELECT USER_NAME() or any variants. These will always return dbo, which is not the real 'user' of interest, but the schema owner. What we want is to confirm 'amarshall' is a (legitimate) user, meaning, SQL Server knows who this is..

2) So, use the SYSTEM_USER call, and the result is AMARSHALL-CAM\amarshall (Host\user).

3) Then, just perform substring match to see if what the user has typed into the login dialog (amarshall) matches what is in the call result. If so, good user, otherwise, reject (program decides).

4) I do NOT strip off the host name or anything - just substring match result of SYSTEM_USER call to logins userid.

5) Database connectstring for Powerbuilder must include SECURE=1. For ADO/VB/.NET, has to have something like TRUSTED_CONNECTION=yes (PB does this for me)

6) Have not tested this against the SQL Server Desktop Edition. Should be identical, but who knows?

7) If anybody has a superior resolution, or security concerns, please advise, but this suffices for now.|||dbo is a database user. You seem to want the server login information, which is quite different. I'd use suser_sname (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_setu-sus_86xx.asp).

-PatP

ODBC Timeout Error

Hi All,

I have one problem in connecting to SQL Server DSN thru Microsoft ODBC. The program was working properly and suddenly from few days, getting "-21472117871 [Microsoft][ODBC SQL Server Driver] Timeout Expired". And no new MS patches or SP installed recently.

I am using this in vbscript with the database connection with execute statement. Sometimes it takes 20-40 secs to get the resultset or sometimes timesout. What could be reason ? Is the database size, memory, transaction log size ?

For Example : Set adoAcctsRst = comDatabaseConnection.Execute("Services.dbo.AISSP_GetAccts '" & strUser & "' " )

Services is the Database, and AISSP_ is the stored procedure to execute with the input parameter as UserName. comDataBaseconnection is the command to connect to DSN.

Its getting timedout in this statement. What could be the solution ? Is it at the SQL Database or network connection ?

Appreciate for ur immedaite reply as this is urgent !!
Thanks in advanceWell it could be that the load on the DB is too much, it could be that the table needs a decent index on for the search criteria it could be load on the network.

You could also include your timeout on your connection when you connect to the database...

I would try the others first though,.. starting with the index...|||Do you have a baseline of what this stored procedure should take to run ? Have you run the stored procedure in query analyzer (how long does it take) ? If it taks a long time, copy the stored procedure content in qa and see if the duration is the same. If you had a recent jump/decline in the number of records that this stored procedure normally handles, this could also cause these problems.

Wednesday, March 7, 2012

ODBC system dsn problem

We have a client that is trying to connect to a SQL DB on
a Win2003 server (thru Citrix) using a system dsn. When a
user tries connecting using the system dsn in Crystal
Reports (or anyting else for that matter), they get the
following error: data source name not found and no default
driver specified.
If you go into the ODBC manager, the data source is there
but when you try to configure it you get - dsnname is not
an existing data source name. when you click on ok you
then get - invalid dsn.
If you log onto the workstation as a user with
administrator rights, none of these errors occur.
I have looked at our Citrix machine and 2 other customer
Citrix machines that are running the same software and I
realy don't see any differences. Our's and the other 2
customers work without the user having admin privleges.
Everything points to a permissions problem but whatever it
is, is alluding me. any help at this point is appreciated.
TIA,
BillODBC entries are controlled in the registry. I would suggest using
regedt32 or regedit (if you are on Win 20003/XP), and go to
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC and try adding full control permissions
for the affected user/groups, replacing the values in the subkeys. Good
luck.
****************************************
Andy S.
MCSE NT/2000, MCDBA SQL 7/2000
andymcdba1@.NOMORESPAM.yahoo.com
Please remove NOMORESPAM before replying.
This posting is provided "as is" with
no warranties and confers no rights.
****************************************
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!|||Thanks Andy. I received a similar response on a SQL Mail
list that I posted to. The registry seems to have been the
problem. I changed the permissions giving access to the
everyone group. I then tested going into the odbc
configuration as one of the users that was having problems
and I no longer get an error. I have the customer testing
an Access program that has linked tables using the system
dsn.
Bill

>--Original Message--
>ODBC entries are controlled in the registry. I would
suggest using
>regedt32 or regedit (if you are on Win 20003/XP), and go
to
>HKEY_LOCAL_MACHINE\SOFTWARE\ODBC and try adding full
control permissions
>for the affected user/groups, replacing the values in the
subkeys. Good
>luck.
> ****************************************
>Andy S.
>MCSE NT/2000, MCDBA SQL 7/2000
>andymcdba1@.NOMORESPAM.yahoo.com
>Please remove NOMORESPAM before replying.
>This posting is provided "as is" with
>no warranties and confers no rights.
> ****************************************
>*** Sent via Developersdex http://www.examnotes.net
***
>Don't just participate in USENET...get rewarded for it!
>.
>

Saturday, February 25, 2012

ODBC on remote computer won't access

I'm attempting to connect to an SQL Server Express database from a remote PC, but it isn't connecting. I have a user account created in the database, and I'm using the SQL authentication with that user account. I have success with this if I'm on the server that the database is on, but not remotely. Both are on the same network, even plugged into the same hub. There doesn't appear to be any network problems.

Any ideas? Thanks!

Please follow this instruction to enable remote connections: http://support.microsoft.com/default.aspx?scid=kb;EN-US;914277

If you still see problem, follow the instruction here and give us more details http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=362498&SiteID=1