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

how many systems can be accessed to a single SQL Server?

$
0
0

I am a C# developer. I am developing a C# application. I need to install application in all the client PC's and I am planning it to install SQL Server in a single pc or server. I am planning to give the connection to sql server from the client pc's. How many connections is possible? Is it depends on OS? If I need more connections what to do?

Thank's in Advance.


.net sqlclient data provider for connecting to a Sql Server on Amazon cloud (similar to how it works with SQL Azure)

$
0
0

Hi All,

Is it possible to use the .NET sqlclient data provider to connect to a Sql Database which is hosted on Amazon? I am aware that this is possible with Sql Azure. I am wondering if there is any component that I need to install to securely expose my SQL Server database on the cloud?

My final objective is to use SSMS and SSIS with my SQL Database on Amazon.

thanks,
Saurabh



sdg

Windows Service Enterprise Library Data Access Application Blocks Connection Pooling Issue

$
0
0

Hello,

We are developing a windows service using c# .net v 4.5.1 which communicates with SQL database (SQL 2008 R2 x64), communication with SQL server is done using Enterprise Library data access block v 6, The windows service does a file copy process in bulk & updates the database about the status of file copy, it is observed that as soon as we start the service the number of connections get max out & we start receiving a "Timeout expired.  The timeout period elapsed prior to obtaining a connection from the pool.  This may have occurred because all pooled connections were in use and max pool size was reached."

This issue is only observed when we run the code logic by deploying it as a windows service, When we run the exactly same code as a standalone exe (right click -> run as administrator) / non windows service, the connections on database are not exceeded& we do not receive the above mentioned error.

The code block which makes calls to the database is under the c# "using" statement, hence connection pooling should be handled by default.

Could you please recommend any suggestions on areas which I might have missed on to investigate this issue.

Thanks in advance.

Cannot read Excel file through ADODB in SCCM 2012 R2 WinPE

$
0
0

Hi,

I'm trying to read an excel file from WinPE 5, and get this error :"Provider cannot be found. It may not be properly installed.". My code is (Vbscript, in a HTA) :

Dim cn
Set cn = CreateObject("ADODB.Connection")
With cn
  .Provider = "Microsoft.Jet.OLEDB.4.0"
  .ConnectionString = "Data Source=" & Fic_ref_deploy & ";Extended Properties=Excel 8.0;HDR=Yes;IMEX=1;"

  .Open
End With

I've included many packages from SCCM 2012 console : WinPE-DismCmdlets ; WinPE-Dot3Svc ; WinPE-HTA ; WinPE-MDAC ; WinPE-NetFx ; WinPE-PowerShell.

Have I missed something ? May I add something else ?

Thanks,

Fabrice

Connecting to a remote database engine with SSMS 2012

$
0
0

I'm working on a project where I need to connect to the Sql Server on a remote machine. Admittedly, I am pretty much a novice on this, so a detailed description of the steps involved is greatly appreciated. 


Thomas G Magaro

OLE DB provider "OraOLEDB.Oracle" for linked server "XXXXXX" returned message "New transaction cannot enlist in the specified transaction coordinator.

$
0
0

Hi Friends,

  I am using Sql server 2005 and when I execute a procedure which is using some oracle linked server in it and fetching information accordingly . It is working perfectly fine for most of the things but some times it is giving below error .

 

Perfectly executing with the below :

exec

GetRecords_test '1058989'

Giving error when I try to insert the data to some temp table from the procedure output as below

1)

EXECUTE

sp_ExecuteSQL N'INSERT into #MyTempTable exec GetRecords_test ''1065252'''

2) tried with the below also by creating temporary table with the same columns which are output from the procedure, but no luck

insertinto #MyTempTableexecGetRecords_test '1065252'

No luck :( :( . Please post if any body has same issue come across

Thanks in advance

Regards

Ravi

The operation could not be performed because OLE DB provider "OraOLEDB.Oracle" for linked server "XXXXXX" was unable to begin a distributed transaction.

OLE DB provider "OraOLEDB.Oracle" for linked server "XXXXXX" returned message "New transaction cannot enlist in the specified transaction coordinator. ".


Ravishankar Maduri MCTS,MCPD,MCP


Data integration into One Centralized Database

$
0
0

Hi All

I would like to seek your advise on data integration.

I need to integrate different databases located different geographical location but same structure into once centralized database on daily or weekly basis.

The connection between the databases are very slow and not reliable.

What would be the best approach to integrate the data from different databases into one centralized database?

Thanks.

Can't get data from table if table's name have number character.

$
0
0

Hello everyone,

I have a problem with my SQL Server 2014 Management Studio.

I creat a database then creat a table in it. I write a small demo to get data from table. but if my table's name without number (tablenamea, tablenameb,...), I can't get data, if I insert 1 or more number into table 's name (tablenamea1, tablenameb12,..), I can get data. (Attach 2 picture)

table name with number

https://social.technet.microsoft.com/Forums/getfile/619694

table name without number
https://social.technet.microsoft.com/Forums/getfile/619695
Why? and how to fix it?

thank you.


Update query string ,containing multiple REPLACE statements, fails to run when executed from within Stored Procedure

$
0
0

I have a dynamically compiled update query which really has a bunch of statements in it. Now the syntax seems correct as I am able to, in a new query window(SSMS) execute the same string with no errors returned and the changes are indeed made in the table. i.e

DECLARE @sqlstring as NVARCHAR(4000) SELECT @sqlstring = ' BEGIN TRANSACTION T1;   UPDATE  ##Details  SET   [##Details.FieldName] =  (Replace ( Replace ( Replace ( Replace ( Replace ( Replace ( Replace ( Replace ( Replace ( Replace ( [##Details.FieldName], Char(92),''___reversesolidusChar___'') , Char(91),''___leftsquarebracketChar___'') , Char(59),''___Semicolon___'') , Char(58),''___ColonChar___'') , Char(47),''___SolidusChar___'') , Char(46),''___fullstopChar___'') , Char(44),''___CommaChar___'') , Char(39),''___apostropheChar___'') , Char(34),''___DoubleQuotesChar___'') , Char(32),''___SpaceChar___'') )  ;  COMMIT TRANSACTION T1; 'EXECUTE sp_executesql @sqlstring 

However when I set the same string to execute, in exactly the same was above, only from within my query, the following error is thrown instead.

.Net SqlClient Data Provider: Msg 50000, Level 15, State 1, Procedure GenerateActivitiesQuestionResponseResultSet, Line 251 Incorrect syntax near ' UPDATE ##Details SET [FieldName] = (Replace ( Replace ( Replace ( Replace ( Replace ( Replace ( Replace ( Replac'.

. Thank you in advance.


tokorie@gmail.com

Firebird linked server via ODBC

$
0
0

hi,

my system:

Win7 pro 64

SQL Server 2012 Express 64

Firebird 2.5 64

ODBC Driver 64

but i still have this compatibility mismatch when i try to add a linked server.

also based on some web searches , i have modified the ODBCINST.INI registry key to point the path to the 64 version of the driver (syswow64/odbcfb.dll), but the driver was not detected after that !

so any help is more than welcome .... really !

thanks and good day

Getting input from several tables into one table

$
0
0
hello Forum,
I've got several tables (tab1, tab2, tab3..), each one of them having a diffrent count of records. There is no link between the tables (no joins of any kind). How to get the values from those tables into just one table?
An example:
tab1: values: tab1value1; tab1value2
tab2: values: tab2value1;tab2value2;tab2value3
tab3:values: tab3value1
tab4: value: NULL

my aim is to get the values into the aimTable:
the aimTable; columns:
value_tab1   value_tab2   value_tab3   value_tab4
=======================================
tab1value1   tab2value1   tab3value1   NULL
tab1value2   tab2value2   NULL             NULL
NULL             tab2value3  NULL              NULL


thanks
Purclot

[Solved] Firebird linked server via ODBC !!!!

$
0
0

hi,

my system:

Win7 pro 64

SQL Server 2012 Express 64

Firebird 2.5 64

ODBC Driver 64

but i still have this compatibility mismatch when i try to add a linked server.

also based on some web searches , i have modified the ODBCINST.INI registry key to point the path to the 64 version of the driver (syswow64/odbcfb.dll), but the driver was not detected after that !

so any help is more than welcome .... really !

thanks and good day


Fetching Wrong data When Insertion of the data process is going on

$
0
0

Hi,

i am troubling with the issue that i have made one stored procedure which will returns  data based on the datetime and it works fine but at the time of data insertion process is going ( insertion of new row with latest updated datetime ) on  that time stored proc will fetch wrong data or half of the data and once insertion process is complete after a some period of time data will come as what i expect to be..

to resolved this issue i found Table Hint i.e (NOLOCK) and i tried that also but that was also fetching same.. 

so please suggest me if there is having any more things to fetch the data correctly without troubling if at the same time 

data insertion process is going.

If You Need here is my stored procedure.

SELECT SUM(FINAL.TOTALTERMINALCOUNT) TOTALTERMINALCOUNT,SUM(FINAL.LIVEWITHOUTFAULT) LIVEWITHOUTFAULT,
SUM(FINAL.LIVEWITHFAULT) LIVEWITHFAULT,SUM(FINAL.DOWN) DOWN  FROM

(SELECT COUNT( STEP1.SSTID) AS TOTALTERMINALCOUNT,0 AS LIVEWITHOUTFAULT,0 AS LIVEWITHFAULT,0 AS DOWN FROM
(select distinct(sstmaster_cdms.sstid) as sstid,dbo.GetDateXMLLandingOnSSTID(sstmaster_cdms.sstid) as xmlDate
from sstmaster_cdms left outer join xml_landing_summary

on sstmaster_cdms.sstid=xml_landing_summary.sstid) as STEP1

left outer join 

(select distinct(sstmaster_cdms.sstid) as sstid,dbo.GetPrblmDateTroubleTicketDetailOnSSTID(sstmaster_cdms.sstid) as ProblemStatus
from  sstmaster_cdms
left outer join TroubleTicketDetail_SHMS

on sstmaster_cdms.sstid=TroubleTicketDetail_SHMS.sstid) AS STEP2

ON STEP1.SSTID=STEP2.SSTID

UNION 

 SELECT 0 AS TOTALTERMINALCOUNT,COUNT(STEP1.SSTID) AS LIVEWITHOUTFAULT,0 AS LIVEWITHFAULT,0 AS DOWN FROM
(select distinct(sstmaster_cdms.sstid) as sstid,dbo.GetDateXMLLandingOnSSTID(sstmaster_cdms.sstid) as xmlDate
from sstmaster_cdms left outer join xml_landing_summary

on sstmaster_cdms.sstid=xml_landing_summary.sstid) as STEP1

left outer join 

(select distinct(sstmaster_cdms.sstid) as sstid,dbo.GetPrblmDateTroubleTicketDetailOnSSTID(sstmaster_cdms.sstid) as ProblemStatus
from  sstmaster_cdms
left outer join TroubleTicketDetail_SHMS

on sstmaster_cdms.sstid=TroubleTicketDetail_SHMS.sstid) AS STEP2

ON STEP1.SSTID=STEP2.SSTID
WHERE (DATEDIFF(mi,CONVERT(datetime,STEP1.xmldate , 108),CONVERT(datetime, GETDATE(), 108))<120
AND DATEDIFF(mi,CONVERT(datetime,STEP1.xmldate , 108),CONVERT(datetime, GETDATE(), 108))>0) 
AND (STEP2.ProblemStatus ='CLOSE' OR STEP2.ProblemStatus IS NULL)

UNION

 SELECT 0 AS TOTALTERMINALCOUNT,0 AS LIVEWITHOUTFAULT,COUNT(STEP1.SSTID) AS LIVEWITHFAULT,0 AS DOWN FROM
(select distinct(sstmaster_cdms.sstid) as sstid,dbo.GetDateXMLLandingOnSSTID(sstmaster_cdms.sstid) as xmlDate
from sstmaster_cdms left outer join xml_landing_summary

on sstmaster_cdms.sstid=xml_landing_summary.sstid) as STEP1

left outer join 

(select distinct(sstmaster_cdms.sstid) as sstid,dbo.GetPrblmDateTroubleTicketDetailOnSSTID(sstmaster_cdms.sstid) as ProblemStatus
from  sstmaster_cdms
left outer join TroubleTicketDetail_SHMS

on sstmaster_cdms.sstid=TroubleTicketDetail_SHMS.sstid) AS STEP2

ON STEP1.SSTID=STEP2.SSTID
WHERE (DATEDIFF(mi,CONVERT(datetime,STEP1.xmldate , 108),CONVERT(datetime, GETDATE(), 108))<120
AND DATEDIFF(mi,CONVERT(datetime,STEP1.xmldate , 108),CONVERT(datetime, GETDATE(), 108))>0) 
AND (STEP2.ProblemStatus <>'CLOSE')

UNION 

SELECT 0 AS TOTALTERMINALCOUNT,0 AS LIVEWITHOUTFAULT,0 AS LIVEWITHFAULT,COUNT(STEP1.SSTID) AS DOWN FROM
(select distinct(sstmaster_cdms.sstid) as sstid,dbo.GetDateXMLLandingOnSSTID(sstmaster_cdms.sstid) as xmlDate
from sstmaster_cdms left outer join xml_landing_summary

on sstmaster_cdms.sstid=xml_landing_summary.sstid) as STEP1

left outer join 

(select distinct(sstmaster_cdms.sstid) as sstid,dbo.GetPrblmDateTroubleTicketDetailOnSSTID(sstmaster_cdms.sstid) as ProblemStatus
from  sstmaster_cdms
left outer join TroubleTicketDetail_SHMS

on sstmaster_cdms.sstid=TroubleTicketDetail_SHMS.sstid) AS STEP2

ON STEP1.SSTID=STEP2.SSTID
WHERE (DATEDIFF(mi,CONVERT(datetime,STEP1.xmldate , 108),CONVERT(datetime, GETDATE(), 108))>120
AND DATEDIFF(mi,CONVERT(datetime,STEP1.xmldate , 108),CONVERT(datetime, GETDATE(), 108))>0) 
OR STEP1.xmldate IS NULL

) AS FINAL


Provider Connection String and Extended Protection

$
0
0

Good morning,

I have an application which by default uses OLEDB as Provider in the Connection String and I cannot change this. The Connection String that it uses is the following:

"Provider=SQLOLEDB.1;Data Source=ServerName;Initial Catalog=DatabaseName;Persist Security Info=False;Integrated Security=SSPI"

The database server (SQL Server 2012) and the client application are placed in two different computers but in the same domain. 

The problem is that I cannot connect to the server from the application when I configure the SQL with Force Encryption On and Extended Protection as Required or Allowed. If I disable Force Encryption, then the connection works (Extended protection as Required and Allowed). This happens when I use Windows Authentication, with SQL Server Authentication there is no problem.

I've tried to use this connection string in a Visual Basic script and it doesn't work either. But when I change the provider to "Provider=SQLNCLI11" then it works (with Force Encryption On, Extended Protection as Required/Allowed, and using Windows Authentication).

With SQL Server Management Studio everything works fine.

Anyone can explain me the reason why this happens? and if is there a solution?

Thank you!

JDBC 4.J - Connection reset

$
0
0

Hi,

I have problem with JDBC(4.1) cennection to MS SQL 2012. I have java application which is running in loop and contacting sql server. Java program works for few minutes(max 4hours) and then going to down with error message:

com.microsoft.sqlserver.jdbc.SQLServerException: Connection reset
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerC
onnection.java:1668)
        at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerC
onnection.java:1655)
        at com.microsoft.sqlserver.jdbc.TDSChannel.read(IOBuffer.java:1789)
        at com.microsoft.sqlserver.jdbc.TDSReader.readPacket(IOBuffer.java:4881)

        at com.microsoft.sqlserver.jdbc.TDSReader.nextPacket(IOBuffer.java:4791)

        at com.microsoft.sqlserver.jdbc.TDSReader.ensurePayload(IOBuffer.java:47
67)
        at com.microsoft.sqlserver.jdbc.TDSReader.readUnsignedByte(IOBuffer.java
:4970)
        at com.microsoft.sqlserver.jdbc.SQLServerResultSet.initializeNullCompres
sedColumns(SQLServerResultSet.java:711)
        at com.microsoft.sqlserver.jdbc.SQLServerResultSet.discardCurrentRow(SQL
ServerResultSet.java:1709)
        at com.microsoft.sqlserver.jdbc.SQLServerResultSet.fetchBufferNext(SQLSe
rverResultSet.java:1774)
        at com.microsoft.sqlserver.jdbc.SQLServerResultSet.next(SQLServerResultS
et.java:1034)
        at javaapplication1.JavaApplication1.main(JavaApplication1.java:79)

Anybody idea?
Thanks
Tom


Problem with linked server...error 7302

$
0
0
I have a very perplexing problem with a linked server.

We are running SQL Server 2008 on Windows Server 2003. We have two instances, PROD and TEST. Both instances have a linked server to a DB2 environment using the IBMDADB2 driver. Both linked servers are identical. Up until a few days ago, both linked servers worked fine. Suddenly, I started to receive the following error when trying to access the linked server on TEST:

Msg 7302, Level 16, State 1, Procedure sp_testlinkedserver, Line 1
Cannot create an instance of OLE DB provider "IBMDADB2.DB2COPY1" for linked server "cm_nw".

I have tried *everything* save restart the server (which is going to come tonight), reregistering the .dll and querying through openrowset (openquery and testing the connection in SSMS both fail). This includes:

1) Recreating the linked server
2) Going into DCOM and modifying the msdainitialize and checking the permissions.

I am logging into the server using Windows Authentication, but this has worked and nothing has changed on that instance at all. I'm in the Administrators group anyway, as is the SQL Server service account, and that group has permissions on MSDAINITIALIZE. There is nothing in the SQL Server or Windows logs to indicate why the linked server cannot be called.

Note the linked server is set up to use a security context (user name and password) and both linked servers are identical in this aspect. If I recreate the linked server without a password and uncheck "Allow Inprocess" in the provider I get:

The OLE DB provider "IBMDADB2.DB2COPY1" for linked server "CM_NW" reported an error. Authentication failed.
Cannot initialize the data source object of OLE DB provider "IBMDADB2.DB2COPY1" for linked server "CM_NW".
OLE DB provider "IBMDADB2.DB2COPY1" for linked server "CM_NW" returned message " SQL30082N  Security processing failed with reason "3" ("PASSWORD MISSING").  SQLSTATE=08001
". (Microsoft SQL Server, Error: 7399)

I don't know if that is coming from the SQL Server end or the DB2 end.

HostName/Workstation ID Connection string question in Excel

$
0
0

I currently have the following connection string set up in Excel to connect to my SQL db:

 

Provider=SQLOLEDB.1;Persist Security Info=True;User ID=XXXXXX;Initial Catalog=YYYYY;Data Source=SQL;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=PROJMNT1;Use Encryption for Data=False;Tag with column collation when possible=False

 

What I would like to do is replace the Workstation ID (which apparently is hard coded?) so that the user's workstation name pulls (%COMPUTERNAME%) so that I can see who is connecting, using what, for how long etc etc.

Is there anyway to accomplish this?

 

Thanks in advance.


Joe P.

UNABLE TO ESTABLISH ODBC CONNECTION TO SQL DB MOVED FROM SQL 2005 STANDARD TO SQL 2008 R2 BOX

$
0
0
Unable to create a new odbc connection to a database which was moved from a sql server 2005 standard to a sql server 2008 r2 machine.   The old server was a windows 2003 machine - 32 bit.  The new machine is a windows 2008 standard 64-bit machine.  TCP/IP is enabled.  SQL Services have been started and confirmed.  receive the following error:  

Connection failed:
SQLState:'01000'
[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.

Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection

$
0
0

"[DBNETLIB] Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection"

After patches applied on patch Tuesday the database reports the above error. 

All accounts are domain accounts and SQLServer uses Windows auth.
DCDIAG show no errors
All servers and DC have been restarted,
Message in db log confirms the connection is being denied due to trust.
Event log shows same rejection
Protocols enabled: named pipes, tcpip, memory

TESTS:
PortQry: "
TCP port 1433 (ms-sql-s service): LISTENING"
Connect with domain admin accounts works from multiple clients systems to DB.
Cannot connect with newly created domain admin account
Can connect if new admin account connect to server in terminal server session and uses UDL wizard or any other tool including isql.
New standard user also fails to connect.

NOTES:
I removed the SSL patch and the IE security update to see if that was an issue.


¯\_(ツ)_/¯

Query via linked server to DB2/NT gives different results

$
0
0

I have a DB2 9.7 database I need to query. I'm testing from four separate SQL Servers.

ServerA - SQL 2012 SP2

ServerB - SQL 2012 SP1

ServerC - SQL 2012 SP1 CU1

ServerD - SQL 2012 SP1

I set up a linked server from ServerA. I run QueryA, and am happy with the results.

I create a linked server from ServerB. I run QueryA and get the message, "Error converting data type DBTYPE_DBDATE to datetime."

I did the same test on ServerC. It works fine.

If, inside OPENQUERY, I convert the datetime to a varchar, call it QueryB, it mostly works, but will be missing a small percentage of datetime values from that converted column when run on ServerB. If I run QueryB on the on ServerA, those missing values are there. Same for ServerC.

At this point, I can think only that the main difference is the service pack and CU level. I can't find any documentation on updates that are relevant, but doesn't mean much.

Then, I did the same test on ServerD. ServerD is at the same SP/CU level as ServerB. ServerD worked just fine. Apparently it's not the service pack or cumulative update level making the difference.

My setup: On each server I loaded MS OLE DB Provider for DB2 Version 4.0. I used the same sp_addlinkedserver script with the same connection string on each server. QueryA and QueryB both used OPENQUERY. They were identical except for the CAST to varchar for a datetime field. This CAST became a call to a function VARCHAR on the DB2 server in later tests with the same result. 

Of course, the only place I actually need this working is ServerB.

tia,

Steve

Viewing all 4164 articles
Browse latest View live