Quantcast
Channel: SQL Server Data Access forum
Viewing all 4164 articles
Browse latest View live

Unable to complete login process due to delay in opening server connection

$
0
0

We have had new servers installed and i am trying to set up the system to run our database.  I have been trying to get the connection from the server which holds the application to the server with the database on. 

To test the connection i used the Data Sources (ODBC) set up window. 

I have 2 SQL drivers the standard one and the Native client:
SQL Server                                               6.01.7601.17514
SQL Server Native Client 10.0                  2009.100.1600.01

The standard one works fine but the native client keeps failing with the following error
Connection Failed
SQL State 08001
SQL Server Error: 0
[Microsoft][SQL Server Native Client 10.0] Unable to complete login process due to delay in opening server connection.

The problem is that the application uses the Native Client to run so i need that one connecting.
I have the same 2 drivers on the server with the database on and they both work fine on there.  I have also tried using the IP address instead of the server name but i still get the same outcome.  TCP/IP and named pipes are enabled for the Native Client.

Anyone any ideas?


Intermittent SQL State 08S01 in ODBC data access layer in high volume BLOB processing - dysfunction of one or more pool connections

$
0
0

Our high volume native (C++) data processing application is experiencing intermittent dysfunction in one or more ODBC data access threads when reading or writing a BLOB from a table, and in particular experiences dysfunction in the ODBC connection in use by one or more threads when the problem occurs.

The SQL State returned by ODBC (GetDiagRec) is 08S01, which according to documentation is an indication of SQL connection dysfunction.  

[Microsoft][ODBC Driver 13 for SQL Server] The connection is no longer usable because the server response for a previously executed statement was incorrectly formatted

We don't think the information we are collecting in association with this SQL State and the connection failure is indicative of the true nature of the problem.  In our native service applications, we are configuring a shared ODBC environment with a per-driver connection pool.  As near as I can determine from documentation, this means we have one connection pool shared by all data access threads per service application (per-process), because there is only one driver in use.

We have concerns that we may be responsible for this failure by calling SQLEndTran with SQL_ROLLBACK on a connection handle in this shared environment in our data access threads, when a BLOB read failure occurs, leading to the SQLEndTran call.  Specifically, we have concerns about what the following ODBC documentation really means:

Note

SQLEndTran cannot be used to commit or roll back transactions on a shared environment. SQLSTATE HY092 (Invalid attribute/option identifier) will be returned if SQLEndTran is called with Handle set to either the handle of a shared environment or the handle of a connection on a shared environment.

What this documentation seems to imply is that manual commit transactions are not supported on pooled ODBC connections and bad things will happen if you call SQLEndTran on these connection handles.  This is a very big deal.

Our code is doing exactly what is described here - calling SQLEndTran on a connection handle in a shared environment.  However, we do not see SQLSTATE HY092 when the problem occurs and a pool connection appears to die.  Instead, we see 08S01.  In addition, we do not encounter SQL_ERROR when we call SQLEndTran with SQL_COMMIT on any connection handle in any of the hundreds of thousands of successful BLOB read and write calls we make each day.  So it would appear to us that SQLEndTran with SQL_COMMIT on a connection handle in a shared environment may be benign, whereas SQLEndTran with SQL_ROLLBACK may not be benign, and may kill the pool connection.

We also have irrefutable evidence that one or more connections in our shared environment pool remain dysfunctional after each 08S01, and cause thousands of repeated data access failures as they are (apparently) served up by the driver manager in subsequent calls in data access threads.

Could someone please comment on, or explain the ODBC documentation note shown above, and on its potential relation to our problem?

Thanks in advance...




Invalid cursor state

$
0
0

hi

i 'm using sql server 2008 sp1 and i'm using ODBC to connect to it.

when i call (execute) a procedure, most of the times i get this error " [Microsoft][ODBC SQL Server Driver]Invalid cursor state".

pleas help me how to solve this problem.

SQL Server driver to SQL 2012 - Protocol Negotiation fails

$
0
0

I've got a .NET program that quit has quit working after the December 11, 2019 updates.
Those updates caused trouble with my Active Directory system that I've put back together. I have tested my TCP and Named Pipes connection to the SQL server from the machines that are having trouble with this program. oSql and SSMS connect just fine. If I run the program from a Server 2012 machine it connects just fine.
However, packet tracing shows this .NET program is trying a TCP connection to \\server\instance, but the protocol negotiation fails. The program then tries a Named Pipe connection to \\server\pipe\sql\query and it fails as well. Nothing is showing up in the server, or client event logs.

Were any security protocols removed from the December update that would cause this disconnect? Or is there something wrong with the SQL instance?


Mark

Registering logins in master=>dbo.userLogins is absent. Why?

$
0
0

I have developer SQL Server 2017. I just noticed that there are no tows in the above mentioned table. Why? How can I correct it?

Thanks, - MyCatAlex

How to use Database Diagrams?

$
0
0

Now that I have access to Database Diagrams DB Diagrams

I tried to make some sense out of them.

This is my first step

So what? What's the next (sensible) step? Perhaps I chose the wrong objects out of the list? If so, there should be some guidelines? Please explain

Thank you, - NyCatAlex




Security logins in SQL Server Developer 2017

$
0
0

SQL Server 2017 ==> Databases ==> Security ==> Logins I have this:

##MS_PolicyEventProcessingLogin##
##MS_PolicyTsqlExecutionLogin##
dbo                                       <== this is familiar, I know it
DESKTOP-54NQG25\Admin                     <== My SQL Server's name
NT AUTHORITY\SYSTEM
NT Service\MSSQLSERVER
NT SERVICE\SQLSERVERAGENT
NT SERVICE\SQLServerReportingServices      <== This is probably for Report Builder application
NT SERVICE\SQLTELEMETRY
NT SERVICE\SQLTELEMETRY
NT SERVICE\Winmgmt
sa                                         <== System administrator ? Security Administrator?

I would appreciate if someone explain to me the meaning of those I did not mark with left looking arrows.

I will also appreciate a comment if I need them all and perhaps some of them could be removed for the sake of....... SECURITY of course.

Thank you, - MyCatAlex










IDENTYTY_INSERT is set to OFF. (#544)

$
0
0

Since office updates 12325.20288 I receive the folowing error

IDENTYTY_INSERT is set to OFF. (#544)

when i want to add a record.

I downgraded back to 12228.20364 and it works fine again.

What can I do to resolve this error.

Afrer October's updates problem, Microsoft office seems to surprise us with every folowing update?!

Thank you for any suggestion.


[DBNETLIB][ConnectionWrite (send()).]General network error. Check your network documentation

$
0
0

considering the oldest version of sql 2008, when try to access application I receive the following error:

[DBNETLIB][ConnectionWrite (send()).]General network error. Check your network documentation

constructor TDBRowset.OpenQuery

function Rowset_OpenQuery

constructor TFrRowset.FrsOpen

function TdmMain.IsTempDB

procedure TMainForm.CheckMenuAccessRights

function TMainForm.DoCommand

procedure TMainForm.mSetPlanGroupsClick

SQL | TDBRowset.OpenQuery()

SQL | Msg: 11, Level: 16, State: 1, Line: 0

SQL | [DBNETLIB][ConnectionWrite (send()).]General network error. Check your network documentation

SQL | Error: -2147467259, Minor Error: 11, SQL State: 08S01

Please help, thanks all for your kindly assistance. 

Native Client 11 - Authentication Fails Using SQL Server Login

$
0
0

Hello everyone,

Using SQL Server 19 in this scenario, but the problem persists with a v17 backend as well.  sp_readerrorlog returns "Error: 18456, Severity: 14, State: 8" only when using Native Client 11 with SQL Server Login credentials.

The server is set for mixed-mode (Windows Integrated and SQL Server Login) authentication.  Authentication scheme is NTLM.  Native Client 11 is set for Named Pipes and TCP/IP protocols.

All other providers function fine using both Integrated Security and SQL Server Logins.  The connection string from the Data Link dialog is passed to open the connection.  With SQLNCLI11, the connection string never contains the PWD= parameter, which I suppose is causing the State 8.  When using any OLE DB provider, or Native Client 10 provider, the PWD= (or Password=) is always returned by the Data Link dialog.  The only exception is when using Native Client 11.

If I pass a manually created, properly formed connection string that includes valid credentials using SQLNCLI11, the symptom remains the same... error with State 8.  It seems to be discarding/ignoring the password.  If I change the connection string to use SSPI, no problem.

I also confirmed that OLE DB Driver for SQL Server handles the SQL Server Login credentials fine, and using that provider, the PWD value is returned by the Data Link dialog in the connection string as expected. 

A bit stumped at the moment.  If you've run into this and know of a solution, please share.

Thank you!

Error odbcConnect after sql update

$
0
0

The database which I want to connect to has recently updated SQL Server from 2008 to 2016.
I was using these lines of code (this is R language using RODBC library) which worked well before the update:

myconn <- odbcDriverConnect("Driver=ODBC Driver 17 for SQL Server;server=199.___.___.__;database=***;uid=***;pwd=***")
city <- sqlFetch(myconn, "RT_CITY_NAMES")

but now I have this error:

Error: first argument is not an open RODBC channel. ODBC connection failed
Calls: source -> withVisible -> eval -> eval -> sqlFetch

In addition: Warning messages:

1: In RODBC::odbcDriverConnect("DSN=Driver=ODBC Driver 17 for SQL Server;server=199.___.___.__;database=***;UID=***;PWD=***") :

  [RODBC] ERROR: state IM012, code 0, message [unixODBC][Driver Manager]DRIVER keyword syntax error

2: In RODBC::odbcDriverConnect("DSN=Driver=ODBC Driver 17 for SQL Server;server=199.___.___.__;database=***;UID=***;PWD=***") :

  ODBC connection failed

Do you know what I need to modify?


SQL Server Driver missing (SQLSRV32.DLL)

$
0
0

Hi everyone,

I have a problem with the SQL server driver.

I'm using a 32-bit application in my laptop, so with a new update of SQL Server Management Studio this driver was missing anddoesn't appears in the Drivers menu in OBDC Data Source Administrator  (only appears the name SQL Server) and I cant connect my application with our server.

There is some issue with this driver? Is it possible that the driver has been corrupted?

Thanks

connect Sql server using Power Shell from sharepoint server

$
0
0

Hi,

I am trying Sql database with window authentication to open connection from SharePoint server using Power Shell.SharePoint server and SQL server are same network but different server.I used the following power Shell command.

$SQLConnection = New-Object System.Data.SQLClient.SQLConnection
$SQLConnection.ConnectionString ="Server =(servername); Database = (DatabaseName);User ID = (userid); Password = (passward);Integrated Security=True"
$SQLConnection.Open()

After running this PowerShell, I show error.

Exception calling "Open" with "0" argument(s): "Cannot open database " DBName " requested by the login. The login failed.
Login failed for user 'Userloginname'."

Shall I put server name just only server name? I mean not included IP Address or something.


Connect Sql server from sharepoint server using power sell

$
0
0

Hi ,

I had already write power Shell to connect and insert data from sharepoint server to Sql server.But I got the following errors.

Exception calling "ExecuteNonQuery" with "0" argument(s): "Invalid object name 'tbl_actiontracker'."
At line:21 char:1
+ $SqlCmd.ExecuteNonQuery() #
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : SqlException

My Power Shell Script is,

Add-PSSnapin Microsoft.Sharepoint.Powershell
$SPWeb = Get-SPWeb "http://XXXXXX"
$SPList = $SPWeb.Lists["Action Tracker"]
$SPListItems = $SPList.Items #or $SPList.GetItems()
foreach($a in $SPListItems)
{
#Write-host $a[1] $a[6] $a[8]
$sqlVAL1=$a[1]

$insert_stmt = "INSERT INTO tbl_actiontracker([Title]) VALUES ('$sqlVAL1');"

#Connect to the SQL database
$connection = New-Object System.Data.SqlClient.SqlConnection
$connection.ConnectionString = "Server =SPDB; Database=SecondEPM_DB;Initial Catalog=Master;Integrated Security=True"
$connection.Open()
$SqlCmd = New-Object System.Data.SqlClient.SqlCommand
$SqlCmd.Connection = $connection

## Create your command
$SqlCmd = $connection.CreateCommand()
$SqlCmd.CommandText = $insert_stmt
$SqlCmd.ExecuteNonQuery() #
}
$connection.Close()
$SPWeb.Dispose()

Please help me.How can I do it?

Is it possible to parameterize a table name in SQL SqlCommandText?

$
0
0

I have this C# code and I get an exception on @tableName.

        private void NumericUpDown_PG1_ValueChanged(object sender, System.EventArgs e)
        {
            string tableName = combo_SQLCodePackages_PG1.Text;
            if (tableName == System.String.Empty)
            {
                TSP.textToSpeech2("Please select a database first");
                return;
            }
            numericUpDown_PG1.Maximum = 1000000;
            int max = GetMaxRecord_ID_Number();
            tLabRecordCount_PG1.Text = max + " records";
            decimal value = numericUpDown_PG1.Value;
            Service service = new Service();
            Server srv = service.GetServer("SqlCodeSamples");
            using (SqlConnection conn = new SqlConnection
                                (srv.ConnectionContext.ConnectionString))
            {
                conn.Open();
                SqlCommand cmdm = new SqlCommand();
                cmdm.Connection = conn;
                cmdm.CommandType = CommandType.Text;
                cmdm.CommandText = "SELECT * FROM [dbo].[@tableName] WHERE [RECORD_ID] = @record_ID";
                cmdm.Parameters.Clear();
                cmdm.Parameters.Add("@tableName",SqlDbType.Text).Value = tableName;
                cmdm.Parameters.Add("@record_ID",SqlDbType.Int).Value = this.numericUpDown_PG1.Value;
                try
                {
                    using (SqlDataReader rdr = cmdm.ExecuteReader(CommandBehavior.SequentialAccess))
                    {
                        if (rdr.HasRows == true)
                        {
                            foreach (System.Data.Common.DbDataRecord row in rdr)
                            {
                                numericUpDown_PG1.Value = (int)row["RECORD_ID"];
                                tBoxRecords_PG1.Text = (string)row["CODE_TITLE"];
                                richTextBox1_PG1.Text = (string)row["SQL_CODE"];
                            }
                        }
                        if (rdr.IsClosed == false)
                        {
                            rdr.Close();
                        }
                    }
                }
                catch (System.Exception ex)
                {
                    System.Console.WriteLine(ex.Message + "  " + ex.InnerException);
                    TSP.textToSpeech2("Operation failed");
                }
            }
        }     // NumericUpDown_PG1_ValueChanged

I get an Exception that

Invalid object name 'dbo.@tableName'

That's it. Why is it so?

Thanks, -MyCatAlex



Invalid cast

$
0
0

I have this code.

        private int GetMaxRecord_ID_Number()
        {    // for PG1
            int max = 0;
            Service service = new Service();
            Server srv = service.GetServer("SqlCodeSamples");
            using (SqlConnection conn = new SqlConnection
                  (srv.ConnectionContext.ConnectionString))
            {
                conn.Open();
                SqlCommand cmdm = new SqlCommand();
                cmdm.Connection = conn;
                cmdm.CommandType = CommandType.Text;                
                cmdm.CommandText = "SELECT MAX (RECORD_ID) FROM [dbo].[" +
                    combo_SQLCodePackages_PG1.Text.Trim() + "]";
                cmdm.Parameters.Clear();
                try
                {
                    using (SqlDataReader rdr = cmdm.ExecuteReader
                                    (CommandBehavior.SequentialAccess))
                    {
                        if (rdr.HasRows)
                        {
                            foreach (System.Data.Common.DbDataRecord row in rdr)
                            {
                                try
                                {
                                    max = (int)row[0];
                                }
                                catch (System.Exception ex)
                                {
                                    max = 0;
                                    System.Console.WriteLine(ex.Message);
                                }
                            }
                        }
                    }
                }
                catch (System.Exception ex)
                {
                    System.Console.WriteLine("{0},  \r\n {1},  \r\n {2}",
                        ex.Message, ex.InnerException, ex.StackTrace);
                }
                numericUpDown_PG1.Maximum = max;
                return max;
            }
        }   // GetMaxRecord_ID_Number

I need to get maximum record ID's for a bunch of tables. It works but for the case when there are zero records. In this case I get an exception. The exception is "Invalid Cast." Well, I still recover my zero in a clumsy way but I want a better code without exceptions. Help will be appreciated.

Thanks, - MyCatAlex


SQL server connection and OBDC failed

$
0
0

I am running Windows 2003 x64 with SQL Server Enterprise 2005 (x64 edition).. Complete install was done (along with reporting services & Integration services)

However, after I run up SQL Management Studio I can only login as .\ as "Server Name'

Using the actual name, fails even though its all services are running.:

When I try and add OBDC Data source The list to select "Which SQL connection to use" is empty..

 I try and enter the server name: MSSQLSERVER and I get the same error

Checked protocols under Confguration Manager, and Remote access is checked under "connections" pane of Management Studio...

Firewall is also "OFF" as one less thing to troubleshoot. This is all on local system

Any other suggestions I could try ?



Connect to SQL Server with seek and index support

$
0
0

Hello,

I am a programmer, at work we use Harbour (https://harbour.github.io/) and we would like to convert our application to SQL Server. Our problem is that harbour (like Clipper and Fox pro) uses a RDD interface.

We are able to implement an RDD interface with any API, our problem is that none of them looks supports seek...

We tryied ADODB https://stackoverflow.com/questions/54746974/adodb-sqlserver-connection-with-seek-and-index

and OLEDB https://stackoverflow.com/questions/58839237/how-to-check-if-ole-db-drivers-supports-opening-indexes-through-iopenrowset

There is a way to connect to SQL server, take a table and set ordering and go to a value by index values?

Thanks,

Antonino

Linked Server from Linux Docker 2017/2019 to SQL Server 2005 ??

$
0
0
Howdy all

Is this supported?

I tried a bunch of ideas but the closest I get is the following error:
"[S0001][10054] TCP Provider: An existing connection was forcibly closed by the remote host."

-------

EXEC sp_addlinkedserver @server = N'abc123', @srvproduct = N'', @provider=N'SQLNCLI', @datasrc = N'abc123.assoc.com,1433'
EXEC sp_addlinkedsrvlogin @rmtsrvname=N'abc123', @useself=N'FALSE', @locallogin=NULL, @rmtuser=N'user', @rmtpassword=N'xxxxxx';

-------

FROM:
Docker Image:
Docker Hub
mcr.microsoft.com mssql server:2017-latest
mcr.microsoft.com mssql server:2019-latest



TO:
Windows Server 2003 R2
SQL Server Microsoft SQL Server 2005 - 9.00.4340.00 (X64)

-------

Any ideas are welcome.

Thanks in advance.


ODBC Error 07009 getting column 0 bookmark.

$
0
0

Hello,

I am doing some test with ODBC, and I have some issue with bookmark use, what I do is:

  • Allocate enviroment
  • Set ODBC version to 3 on enviroment
  • Allocate the connection
  • connect to: TEXT("Driver={ODBC Driver 17 for SQL Server};Server=localhost;Trusted_Connection=yes;Mars_Connection=yes;")
  • allocate a statement
  • ExecDirect TEXT("use MyDatabase")
  • Free the statement
  • allocate a statement
  • set the attribute SQL_ATTR_USE_BOOKMARKS to SQL_UB_VARIABLE or SQL_UB_FIXED (I tryed both)
  • ExecDirect TEXT("select * from tableName where something")
  • SQLFetch
  • SQLGetStmtAttr to check if SQL_ATTR_USE_BOOKMARKS  is still what I setted
  • Get data of column 0 with:

SQLCHAR book1[100] = { 0 };
SQLGetData(hStmt1, 0, SQL_C_VARBOOKMARK, book1, sizeof(SQLCHAR) * 100, NULL);

in case of variable bookmark, and 

BOOKMARK book1;
SQLGetData(hStmt1, 0, SQL_C_BOOKMARK, &book1, sizeof(BOOKMARK), NULL));

In case of fixed.

Both the gets return error 07009.

Any hint?

Regards,

Antonino

Viewing all 4164 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>