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

Any plans to add socket timeout option in JDBC driver??

$
0
0
 

I have come across several threads stuck with the stack below and they are literally stuck. Other drivers (MySQL and Oracle) have options to timeout from a socket read but MS SQL driver does not seem to have that. Though the root cause of the issue might be environmental (network packet loss, firewalls etc), I would like to timeout the thread and handle it in our application (trying to make the application more resilient to environmental issues.)

 java.lang.Thread.State: RUNNABLE

at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at com.microsoft.sqlserver.jdbc.TDSChannel.read(IOBuffer.java:1525)
at com.microsoft.sqlserver.jdbc.TDSReader.readPacket(IOBuffer.java:3274)
- locked com.microsoft.sqlserver.jdbc.TDSReader@ffd8069
at com.microsoft.sqlserver.jdbc.TDSCommand.startResponse(IOBuffer.java:4433)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:386)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:338)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4026)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1416)
- locked java.lang.Object@4bf975b2
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:185)



JDBC Driver is making a sp_sproc_columns to get sproc column metadata for every sproc call

$
0
0

WE are using the Microsoft JDBC Driver v6.0 to connect to MSSQL 2014 databases, and call stored procedures. We use Named parameters when we call the sprocs. 

We are finding that the driver is making a call to get sproc parameter metadata for each sproc invocation. This is causing performance problems for us because it accesses system tables and causes a lot of read operations across many tables.

Why does the driver do this? Is there any way to switch it off using a properties setting, or something else?


feroze
--
My blog (including System.Net topics

 Subscribe in a reader

Instruction on how to create a tracelog with your System.Net application
System.Net Links and HOWTOs

The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine. (System.Data)

$
0
0

i use sql 2008r2 64 bit and windows server 2008 64bjt and office 2010 64 bit when i export data from sql server to excel file . i get message 

The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine. (System.Data)

i try download and install AccessDatabaseEngine_x64 but i still get message above

please help me

thank all


Storing Id to hostProcess in sys.sysprocesses

$
0
0

I am using SQL Server JDBC driver for our application & the application uses tomcat connection pool for database connections. The JDBC driver provided 'workstationID' as one of the connection properties which it is written to host_name in 'sys.sysprocesses'.

When connection's are created from the pool, there would be an sessionId associated with these connection's that are written to 'sys.sysprocesses' with 'hostProcess'=0. We would want to populate 'hostProcess' with uniqueId. Is there a way we can populate this column?

Thanks in advance.

 



The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" reported an error. Access denied.

$
0
0
Hi,

I am importing Excel 2007 file into SqlServer 2005 (Sqlexpress). The office 2007 is not installed in the machine. I have downloaded and installed "AccessDatabaseEngine". When I execute following statement

SELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0', 'Excel 12.0;Database=D:\File1.xlsx', 'SELECT * FROM [Sheet1$]');

The following error is comming:

Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" reported an error. Access denied.
Msg 7350, Level 16, State 2, Line 1
Cannot get the column information from OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)".

Can any one suggest what should I do to resolve?

Thanks,
Parmeshthee.


Learning .Net 3.5

How to create db link from sql server to oracle

$
0
0

HI,

I want to create link in sql server to oracle i installed:ODTwithODAC1120320_32bit but didnot add oracle provider for oledb in sql server link server wizard?

thanks

ODBC Always Encrypted problems

$
0
0

I'm having trouble getting this to work (from Access 2010). All I get is gibberish (which I think is the encrypted data):

Dim con As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rst As ADODB.Recordset

con.ConnectionString = "DRIVER=ODBC Driver 13 for SQL Server;SERVER=myServer;Trusted_Connection=Yes;DATABASE=TestAE;Column Encryption Setting=Enabled"
with con
	.Open
	With cmd
		.ActiveConnection = con
		.CommandType = adCmdStoredProc
		.CommandText = "Debtor4IDSP"
		.Parameters.Item("@id") = 68
	End With
	Set rst = cmd.Execute
	Do Until rst.EOF
		Debug.Print rst.Fields("SSnum")
Any ideas what's wrong?

ADO does not return the actual size of the columns [ (n)varchar(max), (n)text ] data

$
0
0

Environment : 
SQL Server 2008 R2
Microsoft Visual Studio 2010
ADO : msado28.tlb

Please see the below test case. 

Table :

create table dbo.Test1
(
id int, 
varchar_col varchar(max) null, 
nvarchar_col nvarchar(max) null, 
ntext_col ntext null, 
text_col text null
)

INSERT :

Insert into dbo.Test1(id, varchar_col, nvarchar_col, ntext_col, text_col) 
SELECT 1, 
REPLICATE ('A', 50000), 
REPLICATE (0x153, 24000), 
REPLICATE('T', 24000), 
REPLICATE ('D', 24000)
;

I am using below C++ code in my program  - 

FieldPtr field = RS_->Fields->GetItem(variant_t(index));
LONG ColumnValueSize = field->ActualSize;
LONG DefinedSize = field->DefinedSize;
std::cout << "Actual Size: " << ColumnValueSize << "  Defined Size : " << DefinedSize << endl;

Output of above code - 
Actual Size: 4  Defined Size : 4
Actual Size: 8000  Defined Size : 2147483647
Actual Size: 16000  Defined Size : 1073741823
Actual Size: 16000  Defined Size : 1073741823
Actual Size: 8000  Defined Size : 2147483647

The above API does return the actual size of the data stored in a column. Is there any other way to get the actual size ? Am I missing anything here ?


SQL Server loosing connections

$
0
0
Hello all,

If this is not best forum to ask this question on, please advise.
We have two Server 2005 boxes and one Sever 2000.
About 3 months ago we started experiencing random database connection drops.
These were manifested by exception errors in database applictions that had worked fine for years.
The exception error stated that no db connection exists even though it had been fine a moment ago.
Server Management Studio also started giving the error:
"Msg 10054, Level 20, State 0, Line 0
A transport-level error has occurred when sending the request to the server. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.)"
All three servers randomly lose connections.
All our clients randomly lose connections.
I don't think its a network problem because only db applications seem to be affected.
Also, a client can be running two db applications.  Application A will fail, while B marches on unaffected.

Does anyone have any ideas what could be causing this?
I would like a way to monitor the SQL Server connections but am not sure how.
sys.sysprocesses seems to show all the connections, but it doesn't show when a connection is being terminated.
SQL Server log shows no connection messages.

Thank you and Help!

Message DSQ20969

$
0
0

Hola, 

Quiero hacer un GRANT para una tabla y me aparece el siguiente mensaje y por lo que estoy viendo, no lo ejecuta en la tabla. 

Mensaje luego de ejecutar el query: 

"OK, your query was run. Please proceed"

Busqué en GOOGLE y encontré que el error parece ser "DSQ20969" pero no encuentro cuál es el problema. Alguna idea? Gracias a todos!

ADO query timeout only with SQL Server 2016

$
0
0

Hi All,

I'm trying to make a complex query with many joins using a vbscript and SQLOLEDB Provider, here a code snippet:

...

Set lConnection = CreateObject("ADODB.Connection") lConnection.connectionstring = "Provider=SQLOLEDB;Password=*****;User ID=sa;Initial Catalog=xxxx;Data Source=xxxx" lConnection.Open() lSQL = " SELECT T1.ID_T1 FROM T1 " & _" INNER JOIN T2 ON (T1.ID_T1 = T2.ID_T1) " & _" LEFT OUTER JOIN T3 ON (T1.ID_T1 = T3.ID_T1) " & _" INNER JOIN T4 ON (T1.ID_T1 = T4.ID_T1) " & _" LEFT OUTER JOIN T5 ON (T2.ID_T2 = T5.ID_T2) "" ... more than 50 joins....." Set lRS = CreateObject("ADODB.Recordset") lRS.CacheSize = 1 lRS.CursorLocation = adUseClient lRS.Properties("Batch Size").Value = 1 lRS.Open lSQL, lConnection, adOpenForwardOnly, adLockBatchOptimistic, adCmdText

...

With a connection to a SQL Server 2016 instance, I receive a timeout error: "Query timeout expired". Connecting to other DBMS Server likeSQL Server 2014/2012/2008 the execution is immediate.

If I try to execute the same query statement on SQL Server 2016 using SQL Server Management Studio it takes 0 sec to execute.

Changing the Recordset property CursorLocation to adUseServer it's immediate, but I need a disconnected editable recordset. 

Finally it seems an issue of ADO classic connected to a SQL Server 2016 instance. Any idea on what could be the problem? Or if exist a patch on this?

Thanks

Giovanni

 

Steps to troubleshoot SQL connectivity issues

$
0
0

Please follow this blog to troubleshoot SQL connectivity issue and post question here.

Steps to troubleshoot SQL connectivity issues

Lot of blogs related to SQL connectivity issue are available sql_protocols blog.

http://blogs.msdn.com/sql_protocols


(Update: Please search your error message in this forum before you post your question, there are probably already answers in previous posts. If your scenario is different, please start a new thread rather than appending to old ones. Please reply this thread if this searching step solves your issue. We would like to hear from you. Thanks).

 

CONFIGSYSDSN: Could not write to the registry with error code -2147467259

$
0
0

I am trying to update a bat file that we use to install a DSN on new machines. Our machines are now 64-bit (Windows 7) but we need the DSN to still be 32-bit, which I have only been able to get the DSN to work if we use C:\Windows\SysWOW64\ instead of C:\Windows\system32.  When I change the bat to point to this directory, as in:

C:\Windows\SysWOW64\odbcconf.exe /a {CONFIGSYSDSN "SQL Server" "DSN=test|Description=test|SERVER=MyServer|Trusted_Connection=Yes|Database=test"}

I always get the error "CONFIGSYSDSN: Unable to create a data source for 'SQL Server' driver: Could not write to the registry with error code -2147467259"

Can someone please help me figure out how to get around this error?  I am aware that odbcconf is supposedly going to be deprecated, but the alternative using powershell is not something any of us on my team are familiar with so we would need several days just to learn how to use the powershell commands when I was really hoping this would be a 5 minute quick-fix to the existing bat file. 

TIA

-VG


VG_mnet

MSADO28 and TLS1.2

$
0
0

Hello All, 

I am using Msado28.tlb in my application. Now, I would like to upgrade SQL Server 2008 R2 to support TLS 1.2. Is it also required to upgrade ADO version (2.8 to 6.0) to support TLS 1.2 for SQL Server 2008 R2 ?

Thanks,

-Anuj

SA account locked out

$
0
0
iam using Sql 2008 and my sa account is locked out and i cant get in or reset from command line, need help 

How to connect to SQL Server 2014 installed on one PC from a 2nd PC without Windows server and domain involved?

$
0
0

Hi,
I have a Toshiba laptop with Windows 7 on which I have installed SQL Server 2014 for my database and use Microsoft Access 2016 to manage the data in a user-friendly way.

Everything worked perfectly fine till I tried to connect to the database from another PC on the same network WORKGROUP, also with Windows 7.

I am able to connect to the database from the second PC using Microsoft SQL Server Management Studio and ODBC connection, logging in as <g class="gr_ gr_241 gr-alert gr_spell gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="241" id="241">sa</g> using SQL Server authentication.

However, when I open the Microsoft Access database file from the second PC, a window pops up, saying that:
SQL State: 28000
SQL Server Error: 18452
[Microsoft][ODBC SQL Server Driver][SQL Server] Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.

And when I press OK a second window pops asking <g class="gr_ gr_237 gr-alert gr_gramm gr_run_anim Punctuation only-del replaceWithoutSep" data-gr-id="237" id="237">for:</g> Use Trusted Connection or Login ID and Password. After I enter the ID and Password the first windows <g class="gr_ gr_225 gr-alert gr_gramm gr_run_anim Grammar multiReplace" data-gr-id="225" id="225">pops</g> again and so on... 

God knows why, but It <g class="gr_ gr_227 gr-alert gr_gramm gr_run_anim Grammar multiReplace" data-gr-id="227" id="227">look</g> like it still <g class="gr_ gr_228 gr-alert gr_gramm gr_run_anim Grammar multiReplace" data-gr-id="228" id="228">try</g> to connect using Windows authentication?

I have configured the database to use a specific TCP/IP = 1433
Windows authentication and SQL Server authentication is <g class="gr_ gr_198 gr-alert gr_spell gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="198" id="198">slected</g>, remote connections are enabled,"<g class="gr_ gr_193 gr-alert gr_spell gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="193" id="193">sa</g>" is enabled.
Also made new inbound rules in windows firewall for all SQL Server services. Please note that there is no domain involved here. I don't have a Windows server and the SQL Server is installed on PC #1.

If you require more information, please tell me, I'll be happy to provide!

Hope someone will be able to help!


ODBC 17 Driver: Encryption not supported on the client (Win 7 SP1)

$
0
0

All,

I attempted to create a new System DSN using the ODBC 17 driver to establish a connection to a database hosted locally by a SQL Server 2014 SP2 instance. Unfortunately, when I attempt to change the default database in the DSN configuration wizard I receive the following error message.

https://drive.google.com/open?id=1QMd-V0yzc9_dkWIJXWrPGSJtOGFqCycI

---------------------------
Microsoft SQL Server Login
---------------------------
Connection failed:
SQLState: '08001'
SQL Server Error: 21
[Microsoft][ODBC Driver 17 for SQL Server]Encryption not supported on the client.
Connection failed:
SQLState: '08001'
SQL Server Error: 87
[Microsoft][ODBC Driver 17 for SQL Server]SQL Server Network Interfaces: The parameter is incorrect.

Connection failed:
SQLState: '08001'
SQL Server Error: 21
[Microsoft][ODBC Driver 17 for SQL Server]Client unable to establish connection

---------------------------
OK   
---------------------------

OS Name:                   Microsoft Windows 7 Professional
OS Version:                6.1.7601 Service Pack 1 Build 7601
OS Manufacturer:           Microsoft Corporation
Hotfix(s):                 3 Hotfix(s) Installed.
                           [01]: KB3140245
                           [02]: KB958488
                           [03]: KB976902

It appears that updating the system with the latest from Windows Update resolves this problem, but I'd like to know which hotfixes are required as we're looking to deploy this driver in a disconnected environment. Any help that you can provide would be greatly appreciated! Thanks.


SQL Native Client 11 using with Visual Basic

$
0
0

When using SQL Native Client 11 with Visual Basic 6  unable return record set from stored procedures (ado 2.1 , SQL Server 2008)  


SQL Server DB connection failed with Windows authentication (Client-Server).

$
0
0

Hi All,

We have a software product based on the Client-Server architecture (Client application is developed with C++ and Server application is developed with C#). On the Server side, we have the SQL Database and the Client application would be accessing the SQL DB for retrieving the Server settings and policies (using procedure call). 

We have set all the client and server systems on a domain and connected the SQL DB with Windows Authentication. In this scenario when the Client application tries to access the SQL DB, it fails and the application is crashing (Open DB fails).  Our Client application is a Windows Service and running on the System account. And the Client computer is logged in with the domain user. 

When we configure SQL DB with SQL Authentication, everything works fine. Here is the code snippet which is causing the crash: 

CDatabase dbServer;
CStringstrConString = GetServerDBConnectionString(); //retrievs the SQL server DB connection string
if(dbServer.OpenEx(sConString,CDatabase::noOdbcDialog)) // this line of code makes the application crash (Client side)
{
//success
}

Kindly help us to solve this issue.

Thanks,

R-VR


MovePrev after MoveToBookmark in OLEDB consumer templates doesn't work properly

$
0
0
Hello,
I tried to use bookmarks in OLEDB consumer templates and I have problems with using MoveToBookmark. This method sets cursor position correctly on bookmarked row, but it seems to me it doesn't set the right cursor position in DB. When I call MovePrev after MoveToBookmark, I will not get previous row of the bookmarked row.
Simplified Example - I get bookmark of the first row, then move to the 3th row. Call MoveToBookmark (current row is no the first row). But when I call MovePrev I'will not get DB_S_ENDOFROWSET but the second row:


MoveFirst()
bk = GetBookmark()
MoveNext()
MoveNext()  // Now I'm on third row
MoveToBookmark(bk)
GetData() - Now I get data from 1st row
MovePrev()
GetData() - Now I get data from the second row!!


All calls to OLEDB returs S_OK.
Does somebody now, whats wrong?

Thanks
Viewing all 4164 articles
Browse latest View live


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