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

Client losing connection to SQL database

$
0
0

We have an application that is intermittently losing connection to the database from the client. The vendor indicates that latency is an issue. As the problem is intermittent, I am hoping that there is something we can do from the client side.

Ideally, we would run a utility on the client, making a connection to the database and then monitor that connection for several hours. It would record several statistics, including latency. Several searches have not produced what I am hoping for.

Is there any such utility? The only thing I have found is using SSMS to run a point-in-time query, but I don't see anything that runs continuously.

If this is the wrong forum for such a question, I apologize!


-Richard


Trying to Connect to MSSQL 2012 from linux using AD and sqlcmd

$
0
0
We are trying to set up sqlcmd on a linux box to connect to a MSSQL 2012 instance. It works using sqlcmd -Sinstance -Uusername plus a password, but does not when we try using Active Directory and Kerberos:

/usr/bin/sqlcmd -S tcp:nnn.nn.nnn.nnn,ppppp
Sqlcmd: Error: Microsoft ODBC Driver 11 for SQL Server : Cannot generate SSPI context.
Sqlcmd: Error: Microsoft ODBC Driver 11 for SQL Server : SSPI Provider: Server not found in Kerberos database.

I'm not sure what the 'correct' syntax should be as I've found examples where -SMSSQLSvc/ is used instead of tcp. Looks like we need to update our Kerberos database with the principle, but not sure where to head next. Any help would be much appreciated!

A transport-level error has occurred

$
0
0

I have encounted a question as below scenario:

two machines, one is my client and the other is the server, client OS is win7, server OS is Windows server 2008 enterprise. both client and server install sqlserver management studio.

1. I have server OS administrator and sqlserver sysadmin permissions

2. xp_cmdshell can be run on the server side sqlserver management studio with such sentence:

EXEC master.sys.xp_cmdshell 'dir "d:\"'

3. go to client side, connect the database on server side, run the same sentence, only get the error like:

Msg 121, Level 20, State 0, Line 0
A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The semaphore timeout period has expired.)

thanks.


SQL - data conversion error

$
0
0

Hi,

While trying to enter the data "Dëshmorët" in Sql Server Column of datatype varchar(40). I'm receiving the following error:
Error Description: System.Data.SqlClient.SqlException (0x80131904): Bulk load data conversion error (truncation) for row 4, column 378 (PAX_EO).
Bulk load data conversion error (truncation) for row 7569, column 378 (PAX_EO).

When I change the value to "Deshmoret" i.e. english 'e', it works perfectly fine. How to resolve it?

Thanks.


Kunal G

Problem with TransactionScope with Linked server to DB2

$
0
0

Hi

I have an windows application built on ADO.net for executing procedure present in SQl server 2008 DB. This procedure in turn executes query in DB2 via linked server. Everything works fine untill I use Transactionscope inside my dotnet code. I get below exception when I put the execute inside a transactionscope in dotnet code.

The operation could not be performed because OLE DB provider "IBMDADB2.DB2COPY1" for linked server "<ProjLinkedServer>" was unable to begin a distributed transaction.OLE DB provider "IBMDADB2.DB2COPY1" for linked server "<ProjLinkedServer>"returned message " SQL0998N  Error occurred during transaction or heuristic processing. Reason Code = "16". Subcode = "2-FFFFFFFF80004005".  SQLSTATE=58005".

Other Info:

Source: .Net SqlClient Data Provider

SqlConnection Properties: Provider=SQLOLEDB.1;Trusted_Connection=Yes;Packet Size=12288;Integrated Security=SSPI; User Procedure for prepare=0

MSTDC at Sql DB server side lies in a remote server[Common for all Sql DB servers] where the configurations are proper.

Please advice what all do I need to verify/configure to make it work.

Unable to connect to SQL Server database.

$
0
0

Hello every one I am using visual studio 2010.I want to use asp.net administration tool .But when I click on security tab in admin tool. I got the error .

Unable to connect to SQL Server database.

Then I clicked to choose data store and then select Select a single provider for all site management data. and select  AspnetsqlProvider.

Then I got this message.

Could not establish a connection to the database.
If you have not yet created the SQL Server database, exit the Web Site Administration tool, use the aspnet_regsql command-line utility to create and configure the database, and then return to this tool to set the provider.

I have google this problem but I can not find any suitable soloution . Help me please

Find Connection String used by SQL Server Management Studio

$
0
0

I am having problems getting my VS C# .NET application to connect to a SQL Server Database, even though I can connect to it (on the same machine) using SQL Server Management Studio.

Is there any way I can find the connection string that SQL Server Management Studio generates when it connects?

sqlserver 2008 linkeed server ms access

$
0
0
İ have two server 

Server A -- Sql server 2008

server B MS Access

I define linked server Sql server to Ms Access.using this command.

EXEC sp_addlinkedserver 
@server = N'test4', 
@provider = N'Microsoft.ACE.OLEDB.12.0', 
@srvproduct = N'Access', 
@datasrc = N'\\192.168.1.9\TESTSERVER\ACCESS.mdb', 
@provstr = N';PWD=ABC'

after execute this command 
s
SELECT * FROM test4...EMPLOYEES
this commandd execute succesfuly.

after create sql server agent job 
and job step command 
SELECT * FROM test4...EMPLOYEES 
and execute job but given error 
error is :

executed as user deneme\egemen cannot initialize the datasource object of oledb provider "Mıcrosoft.ACE.OLEDB.12.0" for linked server test4[sql state 42000] error [7303]
test4 returned message:the microsoft access database engine cannont open or write \\192.168.1.9\TESTSERVER\ACCESS.mdb. it is already opened exclusive by another user you need permission view or write data

how can i solve this problem tahnk you


How to Improve Query Performance

$
0
0

HI,

How to Improve Query Performance?

How many ways to Improve performance of a Query.

Recently I said 10+ ways but they need more ways.

What are that?

Very Irritating .....

-

Krish

Cannot create an instance of OLE DB provider "MSDASC" for linked server "(null)..

$
0
0

I am trying to aceess remote database using following query,

SELECT * FROM

OPENDATASOURCE('SQLOLEDB','Data Source=kvdbcl3ins1,40050;User ID=pprs_uid;Password=pprs_pwd').ppr_s.dbo.table_weekly

I am getting following error.....

Msg 7302, Level 16, State 1, Line 1

Cannot create an instance of OLE DB provider "MSDASC" for linked server "(null)..

Both servers are SQL 2008. ANYONE HAVE ANY IDEA, What can be the issue here.

Mike

Autofetch behavior with firehose cursor, when SQL_SOPT_SS_CURSOR_OPTIONS option is set to SQL_CO_FIREHOSE_AF

$
0
0

Hello ODBC Driver Team,

On firehose cursor, when statement attribute SQL_SOPT_SS_CURSOR_OPTIONS is set to SQL_CO_FIREHOSE_AF, and the  statement is executed, observed different behavior for autofeth which are mentioned below:

1) When SQLExecute is called first time it does not autofetch.
2) When SQLExecute is called second time on the same stament handle, after closing cursor using SQLFreestmt(hstmt, SQL_CLOSE), it  autofetch 1 row  with SQLExecute.

So what is the expected behavior, whether it  should  autofetch or not ?  This seems to be bug in SQL Native client drivers.

Also I didn't see documentaion for SQL_CO_FIREHOSE_AF but it is listed in sqlncli.h ?

code snippet with comments:
++++++++++++++++++++++
  rc = SQLSetStmtAttr(hstmt1, (UWORD) SQL_SOPT_SS_CURSOR_OPTIONS, (SQLPOINTER) SQL_CO_FIREHOSE_AF, 0);
...
 rc = SQLSetStmtAttr(hstmt1, SQL_ATTR_ROW_ARRAY_SIZE, (SQLPOINTER)1, 0);   
 // Execute first statement
 rc = SQLExecute(hstmt1);  // it does not autofetch the data.

rc = SQLFreeStmt(hstmt1, SQL_CLOSE);
...
 rc = SQLSetStmtAttr(hstmt1, SQL_ATTR_ROW_ARRAY_SIZE, (SQLPOINTER)1, 0);   
 // Execute first statement
 rc = SQLExecute(hstmt1);  // it  autofetch 1 record.
+++++++++++++++

Thanks,

Mukesh

SQL server error to connecting public ip address or name

$
0
0

HI

Getting the error to connecting through public ip address or name. I have opened tcp and udp port 1433, 1434, 1954, 4120 on firewall, windows firewall is turn off but able to connect in local IP address.

 TITLE: Connect to Server
ADDITIONAL INFORMATION:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (Microsoft SQL Server, Error: -1)

Regards

suresh

Access denied to filestream data

$
0
0

SQL 2008R2/VS2012/Win 2008R2

error: {"Access is denied"}

SqlFileStream fileStream = new SqlFileStream(filePath, objContext, System.IO.FileAccess.Read);

I changed my connection string from Integrated Security to a SQL User account.  I thought I gave the user account the necessary permissions but I can no longer read filestream data.  The user can log into SMS and run queries.

How to read SQL Server column collation metadata using ODBC API?

$
0
0

Our C++ application is able to get collation related column metadata from SQL Server using OLEDB API’s (using DBCOLUMN_COLLATINGSEQUENCE, DBCOLUMN_TDSCOLLATION, etc.), but I need to use ODBC as our application has to be cross platform. We are using ODBC API SQLColAttribute to read rowset metadata, but this API does not have any identifiers which can return the collation name. I tried using SQL_CA_SS_COLUMN_COLLATION (defined in sqlncli.h) as an identifier, but SQLColAttribute only returns “Collation Name” as the collation. I also tried using SQLGetStmtAttr followed by SQLGetDescField, using the same identifier, and I got “Collation Name” back. I have scoured all of MSDN for answers, but haven’t been able to find any. I can get the collation name from INFORMATION_SCHEMA.COLUMNS, but that will not work for calculated columns returned by queries. I am looking for a clean way to get collation information from result set metadata using ODBC.

Any ideas?

How to use alias column value in a for each loop

$
0
0

Hi can any one help me to give me a suggestion how to get alias column value from i'm trying to use a for each loop in vb.net using a datatable.

My code is actually shown below 

                                                                 

If CInt(RowItem.Item("TOTALLINENO")) > 500 Then
                                For c As Integer = 0 To tblRawTesterShutdown.Columns.Count - 1
If CInt(tblRawTesterShutdown.Rows(c)(10)("Percentage")) < Max Then
                                        Max = CInt(tblRawTesterShutdown.Rows(c)(10)("Percentage"))
                                    End If
                                Next
  Max = Max - Convert.ToInt32(tblRawTesterShutdown.Rows(tblRawTesterShutdown.Rows.Count - 1))
                            Else
                                Return False
                            End If 'End here

I have do it in vs 2005. The percentage is a sql server query. the query is shown below

SELECT  t1.LINE_NO, t1.E_FIELD, t1.F_FIELD, t1.G_FIELD, t1.FAMILY, t1.HSA_STATUS,t1.CACHE_FAMILY, 
    SUM(t1.TOTAL) AS CountOfLineNo, t2.TotalOfLineNo, 
    convert(decimal(18,3),(convert(decimal(8,1),SUM(t1.TOTAL)) * 100 / t2.TotalOfLineNo )/100)AS Percentage
    FROM(
          SELECT LINE_NO, E_FIELD,F_FIELD,G_FIELD,HSA_STATUS,FAMILY,CACHE_FAMILY, Count(LINE_NO) as Total
          FROM TX_HSA_SUMM WITH(NOLOCK)
          WHERE MT_TIMESTAMP2 BETWEEN ('2013-04-03 14:28:00.000') AND ('2013-04-03 14:28:00.000')
          AND  E_FIELD!='00000' AND F_FIELD!='00000' AND G_FIELD!='00000' -- added new line
          GROUP BY LINE_NO,E_FIELD,F_FIELD,G_FIELD,HSA_STATUS,FAMILY,CACHE_FAMILY
        ) AS t1 
    LEFT JOIN (
          SELECT LINE_NO, COUNT(LINE_NO) AS TotalOfLineNo
          FROM TX_HSA_SUMM WITH(NOLOCK)
          WHERE MT_TIMESTAMP2 BETWEEN ('2013-04-03 14:28:00.000') AND ('2013-04-03 14:28:00.000')
          GROUP BY LINE_NO 
          ) AS t2 
    ON t1.LINE_NO = t2.LINE_NO    
GROUP BY t1.LINE_NO, t1.E_FIELD, t1.F_FIELD, t1.G_FIELD, t1.HSA_STATUS, t1.FAMILY, t1.CACHE_FAMILY, t1.Total,t2.TotalOfLineNo
HAVING t2.TotalOfLineNo > '500' and t1.line_no='64072m' and hsa_status='r'
ORDER BY   t1.E_FIELD, t1.F_FIELD, t1.G_FIELD, t2.TotalOfLineNo,t1.Total,t1.HSA_STATUS, t1.LINE_NO, t1.FAMILY, t1.CACHE_FAMILY

The bold Percentage value from sql server should be used in the vb.net for each loop actually. I'm using vs 2005 ans sql server 2000. Thanks in advance


sqlserver

$
0
0

Buenos dias a todos ,

sabria alguien decirme donde descargar una base de datos sqlserver que me permita importar una base e datos de 100 Gigas

GRACIAS

SQL to Oracle linked server throws errors

$
0
0
We have linked server from SQL server 2000 instance to Oracle server. Linked server has been working fine for last 3 years and suddenly it has started throwing errors.
 
When we run simple select statement on query analyzer (SELECT * FROM KDBPRD...GROUP MASTER) it throws different errors and brings back different row count every time we run this.  
 
Server: Msg 7399, Level 16, State 1, Line 1
OLE DB provider 'MSDASQL' reported an error.   
[OLE/DB provider returned message: [Oracle][ODBC][Rdb]  send() Ret -1 Err#10038 WSAENOTSOCK File descriptor not a socket]
OLE DB error trace [OLE/DB Provider 'MSDASQL' IOpenRowset::OpenRowset returned 0x80004005:   ].
 
SERVER: MSG 7399, LEVEL 16, STATE 1,  
OLE DB PROVIDER 'MSDASQL' REPORTED AN ERROR.   
[OLE/DB PROVIDER RETURNED MESSAGE: [ORACLE][ODBC][RDB]%SQLSRV-F-FATALEXECERR, FATAL EXECUTOR PROCESS ERROR]
OLE DB ERROR TRACE [OLE/DB PROVIDER 'MSDASQL' IROWSET::GETNEXTROWS RETURNED 0X80004005:   ].
 
 
OLE DB PROVIDER "MSDASQL" FOR LINKED SERVER "KDBPRD" RETURNED MESSAGE "[ORACLE][ODBC][RDB]%SQLSRV-F-FATALEXECERR, FATAL EXECUTOR PROCESS ERROR".
MSG 7330, LEVEL 16, STATE 2, LINE 1
CANNOT FETCH A ROW FROM OLE DB PROVIDER "MSDASQL" FOR LINKED SERVER "KDBPRD".
 
Select TOP 100 gets completed successfully periodically and throws errors. Has anyone seen this kind of behavior?

Sql Server Stored Procedure Error

$
0
0

I have Stored procedure with one output value called @ReportID we are getting this value as

select @ReportID =@@identity -- ReportID is the last # inserted into Reports

This ReportID is Primarykey in Reports table. I have declared this as Data Type numeric(14,0)

when i trying to execute the stored procedure i am getting below error..

"Cannot insert the value NULL into column 'ReportID', table 'EVRep.dbo.AddReports'; column does not allow nulls. INSERT fails.

The statement has been terminated."

what could be the problem why its not working?

Can anyone please help me on this.

Thanks

 


Diddi

Trying to Connect to MSSQL 2012 from linux using AD and sqlcmd

$
0
0
We are trying to set up sqlcmd on a linux box to connect to a MSSQL 2012 instance. It works using sqlcmd -Sinstance -Uusername plus a password, but does not when we try using Active Directory and Kerberos:

/usr/bin/sqlcmd -S tcp:nnn.nn.nnn.nnn,ppppp
Sqlcmd: Error: Microsoft ODBC Driver 11 for SQL Server : Cannot generate SSPI context.
Sqlcmd: Error: Microsoft ODBC Driver 11 for SQL Server : SSPI Provider: Server not found in Kerberos database.

I'm not sure what the 'correct' syntax should be as I've found examples where -SMSSQLSvc/ is used instead of tcp. Looks like we need to update our Kerberos database with the principle, but not sure where to head next. Any help would be much appreciated!

sa unable to log in after P2V

$
0
0

Hello,

After copying a production server to a Hyper-v vm development serverfor development/testing. I can no longer log in using the same sa password as production version. Both SQL2008 are on Server 2008 R2. Both are local to app accessing data

I am receiving Error 18456, Severity=14,  State = 1 in Management Studio, and auth errors with web.config when accessing on new dev server from dev server. I am able to access the prod sql database from dev server.

The only thing I found to change or try was changing server names: prod-servername\mssqlserver2008 to dev-servername\mssqlserver2008, localhost\mssqlserver2008 and just plain mssqlserver2008. I also changed alias to use correct machine name. I've tried shared memory and tcp/ip -- other protocols disabled

I am unable to browse the db locally or remotely -- sql browser service is running

Any ideas on where else I can look?

Thanks
Dean


Viewing all 4164 articles
Browse latest View live


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