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

Can't connect from linux with ODBC Driver 11 for SQL Server to sql 2016 on Windows Server 2016 Technical Preview 5

$
0
0

I can connect to SQL Server 13.9.1691.5 on Windows Server 2012 R2 without a problem. When I try to connect to SQL Server 13.0.2149.0 on Windows Server 2016 Technical Preview 5 it fails:

# sqlcmd -S<server> -U<user> -P<passwd>
Client unable to establish connection
SSL Provider: [error:1408D13A:SSL routines:SSL3_GET_KEY_EXCHANGE:unable to find ecdh parameters]

I'm using driver /opt/microsoft/msodbcsql/lib64/libmsodbcsql-11.0.so.2260.0 on SuSE SLES11 SP3, also tried SP4 and that fails the same way.

Any ideas?  Why SSL3? 
I have tried disabling Diffie-Hellman, that didn't help.

Thanks.


Gudmundur Karlsson


Linked Server

$
0
0

Hi, I have SQl-server 2012 and want to use linked server against an ODBC driver to get data from an Interbase database.

The driver is "Data Direct ODBC for Interbase". The driver is installed on same server and its an 32 bit platform.

When i tried to setup the connection thru linked server i used the OLE DB provider MSDASQL and pointed ut

as a source the ODBC "Data Direct ODBC for Interbase", but i got error code 7303.

Is it some other sql-driver i should use to be able to connect the "Data Direct ODBC for Interbase"

Thanks in advance for any help

Query to insert record in another table based on 1 of 4 columns

$
0
0

So we have a table and in that table there are 4 columns that can contain values. In some cases no values for all 4 columns and in some all 4 columns populated and other instances, one or more populated.. 

So we need to insert a record into a different table and pull in one of those column values(not sure yet which one, meeting on it next week) but basically once they decide, we will need to find the appropriate value out of the 4 columns and insert that value into the other table.

So in this example below the first item has no values in either of the 4 columns, so for that we would default it to a value on insert. The other 2 records have both the first 2 columns with values, Ive added the "type" column because that is what we want to pull and insert into the other table.. so with the below example they chose they wanted the value from val1, but like i said its not 100% yet on if they are going to just go with one column(that will be easy), but if they want to decide based on other criteria, then id like to know how i can pull the correct value based on the initial criteria.



So in the other table we will be inserting 

Hibernate and MSSQL 2016 issue

$
0
0

I'm facing a problem with a Java application (JVM 1.6) that is using Hibernate 3.6 to access a Microsoft SQL Server via Microsoft JDBC Driver for SQL Server.

When working with SQL JDBC driver 3.0 and MSSQL 2008 - 2014 all is working just fine.

But when I'm trying to use MSSQL 2016, the latest "Microsoft JDBC Driver 6.0" (sqljdbc4.jar) - I get a bunch of those errors:

org.hibernate.StaleObjectStateException:Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect)

It happens on different entities, and can happen on a get or update operations.

My question: is this an issue with Hibernate that also needs to be updated to a newer version? I wasn't able to find any information about compatibility issues when accessing MSSQL 2016 via Java/Hibernate.

Thanks!

Protocol Error In TDS Stream

$
0
0
I have a client workstation trying to pull data from a SQL 2012 server.  It is set up with an ODBC connection.  An error is encounter while the report is pulling the data.  Database Connector Error: 'HY000:[Microsoft][SQL Native Client 11.0] Protocol error in TDS stream'  I figured the issue was with the ODBC connection so I dropped and re-created it but the error persisted.  I've removed the firewall as well.  I tried updating the native client driver.  I don't know what else to try.

Sqljdbc4.1 in hung state on initializer

$
0
0

We are frequently observing hung state on initializing sql server jdbc driver. Thread dump looks like below

"SpringOsgiExtenderThread-26" prio=6 tid=0x000000000e357000 nid=0xd40 in Object.wait() [0x0000000015abd000]   
java.lang.Thread.State: RUNNABLE
at com.microsoft.sqlserver.jdbc.SQLServerDriver.<clinit>(SQLServerDriver.java:903)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)

Our application is running with jdk1.7.0_25 on windows server 2012 and hosted on MS Azure PaaS.


Linked Server Licensing

$
0
0

I apologize in advance if this is in the wrong forum.

If you have a linked server on a test instance pointing to a production instance, is this a problem from a licensing point of view?

thanks

Online Form to Query Azure SQL Database

$
0
0

I know almost nobody would advise me to dive into the deep end of the pool like this, however it is the method I've used to learn virtually everything I know so...indulge me please, if just for the sake of this exercise. 

I am familiar enough with building SQL databases and using SSMS that I was able to create an Azure server, put a database on it, and use SSMS, Excel, and Access to interface with the data. 

I want to build a a web page that someone can use to run predefined SELECT queries against my Azure SQL database. Initially it can be just a form with some simple instructions, allowing the user to enter some values and click submit to get results.

It seems that Azure comes with a wealth of tools, virtual machines, etc that I should have the framework already to do this. 

Can anyone point me in a general direction? I don't expect to know how it works, but I will absorb the material and figure it out. I just simply don't know how to start. 

tod


SQL int to string

$
0
0

Hi everyone,
I have a problem trying to retrieve the value of a string variable from VB.NET code behind. After converting the value from integer to nvarchar, I see the result ok in SQL. But when trying to retrieve it in VB, it always defaults to "1"

have anyone here encountered any similar issue?    (see code below)

                                                                                           

BEGIN
SET NOCOUNT ON;
BEGIN TRY
BEGIN TRANSACTION

DECLARE @NoConnected int, @MaxNoCon int = 2, @Con int, @ConIsAvailable bit
DECLARE @NumberRecords int, @RowCount int
SET @NoConnected = 0
CREATE TABLE #Check_Connections
(
 RowID int IDENTITY(1, 1), 
 DBName nvarchar(30),
 NumberOfConnections int,
 LoginName nvarchar(30)
)

INSERT INTO #Check_Connections (DBName, NumberOfConnections,  LoginName)
SELECT 
DB_NAME(dbid) AS DBName,
COUNT(dbid) AS NumberOfConnections, 
loginame AS LoginName 
FROM     
sys.sysprocesses
where DB_NAME(dbid) = 'anydatabasename'
GROUP BY dbid, loginame

SET @NumberRecords = @@ROWCOUNT 
SET @RowCount = 1  PRINT '@RowCount = ' + cast(@RowCount as nvarchar(10)) 
-- loop through all records in the temporary table using the WHILE loop construct
WHILE @RowCount <= @NumberRecords 

BEGIN
SET @Con = (SELECT NumberOfConnections FROM #Check_Connections WHERE RowID = @RowCount) 
SET @NoConnected = @NoConnected + @Con PRINT '@NoConnected = ' + cast(@NoConnected as nvarchar(10)) 

SET @Con = 0
SET @RowCount = @RowCount + 1
END

DROP TABLE #Check_Connections  

if @NoConnected  < @MaxNoCon 
SET @ConIsAvailable = 1 -- TRUE there are still available connections
else
SET @ConIsAvailable = 0 -- FALSE no connections available

SELECT @ConIsAvailable [ConIsAvailable],  @NoConnected [NoConnected] 

COMMIT TRANSACTION
END TRY

BEGIN CATCH --in case of errors
IF @@TRANCOUNT > 0
ROLLBACK TRANSACTION --dont execute anything
SELECT 'There was an error! ' + ERROR_MESSAGE()

END CATCH
END

Using SQLBindCol to get column length of unbound long data column

$
0
0

Hello,

according to the documentation of SQLBindCol it should be possible to get only the column length information by setting TargetValuePtr to NULL and StrLen_or_IndPtr to a valid value:

TargetValuePtr

...

If TargetValuePtr is a null pointer, the driver unbinds the data buffer for the column. ... An application can unbind the data buffer for a column but still have a length/indicator buffer bound for the column, if theTargetValuePtr argument in the call to SQLBindCol is a null pointer but theStrLen_or_IndPtrargument is a valid value.

I tried that, but StrLen_or_IndPtr does not get filled.

My idea is to get the length of an unbound long data column this way and then later call SQLGetData only if the length is > 0.

What am I doing wrong?

SQL Server Connection Timeout - pre-login handshake

$
0
0

I have a few ASP.NET web applications that are connecting to Microsoft SQL Server. Two of them tend to sometimes get hit with the following errors. Once it a while this issue happens and sometimes not happening for a couple of days.

Connection Timeout Expired.  The timeout period elapsed while attempting to consume the pre-login handshake acknowledgement.  This could be because the pre-login handshake failed or the server was unable to respond back in time.  The duration spent while attempting to connect to this server was - [Pre-Login] initialization=10; handshake=14992;

The value for initialization and handshake tend to change when it happens. But i'm unsure what does it mean.

I have verified the following:

- The ASP.NET web applications closed the database connection after done using it.

- It is not IPv6 issue.

- Incoming and outgoing for port 1433 is enabled.

The SQL Server and the web applications are in different servers. The applications connect to the database using the hostname defined in the hosts file.

I would like to request for assistance regarding this issue.

SQL Server Connector for Linux

$
0
0

Hi,

Is there any SQL Server Connector for Linux Similar to PDO to access SQL Server from PHP hosted on Linux?

Thanks,

Jassim

Slow database connection over VPN

$
0
0
I just found out the response time of open a connection or execute a SQL command over VPN is very slow. It takes around 150ms for each round trip. If the same program run on LAN, it takes less than 1ms. I understand that VPN may have encryption and thus have a bit delay. However, if the delay happens whethever I make a SQL call, it will be unacceptable. Is there anything that I have missed out? If the delay occurs once only, it will be still great. (I think this is the point of connection pooling. Right?) However, it's really bad if the delay occurs each time I call SQL. Please 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!


SQL Database corrupted which was created by Sharepoint

$
0
0
What steps to be followed to repair corrupted SharePoint Admin Content SQL DB.

Executing Stored procedures in select statement through linked servers

$
0
0

Hi all,

I'm facing a problem executing a stored procedure through select statement. 

SELECT*FROM OPENQUERY(NEW,'EXEC sunaina.dbo.sp_status 111,hi')j

Where 'NEW' is a linked server. Below is the error message that i'm getting.

Msg 7357, Level 16, State 1, Line 1
Cannot process the object "EXEC sunaina.dbo.sp_status @id_p=111,@comm_p=hi".
 The OLE DB provider "SQLNCLI10" for linked server "new" indicates that either the object has no columns 
or the current user does not have permissions on that object.

The linked server has all the databases from my actual server.

ex: 

   -> Server Objects

     -> Linked servers

       -> NEW(linked server name)

         -> Catalogs

          -> Sunaina(database name)

              -> Tables(folder)

                 -> dbo.status(table name)

And there is also a 'views' folder along with 'tables' folder. But i dont have the stored procedures folder where i should be getting 'sp_status' procedure in my linked server.

i created 'sp_status' procedure in 'sunaina' database in the main server.

why is it that i'm unable to get the other objects apart from tables and views in to the linked servers?

if i don't have stored procedures in my linked servers, will it be possible to execute a stored procedure using OPENQUERY?

SELECT * FROM OPENQUERY(NEW,'EXEC sunaina.dbo.sp_status 111,hi')j

Because i felt that it needs the procedure to be in the linked server if i have to execute it inside a select statement.

So how can i get the procedure objects into linked servers and execute the above select statement.

Regards

Sunaina 

   

The login packet used to open the connection is structurally invalid; the connection has been closed. Please contact the vendor of the client library

$
0
0
Hi there, we have one wesite which is built using php, the website is trying to connect to a database on another server which uses SQL 2008, when trying to connect we get the following error message.

The login packet used to open the connection is structurally invalid; the connection has been closed. Please contact the vendor of the client library. [CLIENT: ***.**.**.**]

We have done some research and found the following.

http://www.microsoft.com/technet/support/ee/transform.aspx?ProdName=SQL%20Server&ProdVer=10.0&EvtID=17832&EvtSrc=MSSQLServer&LCID=1033

MaxTokenSize 20000

The recomendation has been followed with no change in the result.

This is the local error message that we have been receiving.

Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: remote..................com:.... in /home/............/public_html/sql/index.php on line 8
Couldn't connect to SQL Server on remote......................com:.....

Can anyone suggest where to go from here?

DatabaseMetaData of JDBC Drivers until 6.0 returning wrong update and delete rules

$
0
0

Hi all,

we get wrong update and delete rules with all JDBC drivers for SQL Server starting with 4.0 until 6.0 (6.0.7728.100) and SQL Server 2005 and 2008 R2 (10.50.2500). Other versions will probably have the same problem. We are using recent versions of Oracle JDK 8 on various Windows versions since 7 and Linux Mint 17.3 Cinnamon.

Create 4 tables with different update and delete rules:

CREATE TABLE NoAction (i INTEGER NOT NULL DEFAULT -1, FOREIGN KEY(i) REFERENCES Base(a) ON UPDATE NO ACTION ON DELETE NO ACTION);
CREATE TABLE Casc (i INTEGER NOT NULL DEFAULT -1, FOREIGN KEY(i) REFERENCES Base(a) ON UPDATE CASCADE ON DELETE CASCADE);
CREATE TABLE SetNull (i INTEGER, FOREIGN KEY(i) REFERENCES Base(a) ON UPDATE SET NULL ON DELETE SET NULL);
CREATE TABLE SetDefault (i INTEGER NOT NULL DEFAULT -1, FOREIGN KEY(i) REFERENCES Base(a) ON UPDATE SET DEFAULT ON DELETE SET DEFAULT);

Retrieving the update and delete rules via Connection.getMetaData().getImportedKeys() yields the following results:

NoAction(i): updRule: 1 (expected: 3), delRule: 1 (expected: 3)
Casc(i): updRule: 0 (expected: 0), delRule: 0 (expected: 0)
SetNull(i): updRule: 1 (expected: 2), delRule: 1 (expected: 2)
SetDefault(i): updRule: 1 (expected: 4), delRule: 1 (expected: 4)

This seems like a bug. I have a corresponding Java program to easily reproduce the problem.

Kind regards,

Ulrich

ParameterMetaData of JDBC Drivers until 6.0 returning wrong data types

$
0
0

Hi all,

we get wrong data types for parameters of prepared statements via parameter meta data. We tested it with all JDBC drivers for SQL Server starting with 4.0 until 6.0 (6.0.7728.100) and SQL Server 2005 and 2008 R2 (10.50.2500). We are using Oracle JDK 8 in the most recent variant with various Windows versions since 7 and Linux Mint 17.3 Cinnamon.

Create a table with different datat types and several prepared statements (updates in this example):

CREATE TABLE ParamType (i INT UNIQUE NOT NULL, bi BIGINT, b BIT, c CHAR, PRIMARY KEY(i));

UPDATE ParamType SET i = ? and bi = ? WHERE b = ? AND c = ?;
UPDATE ParamType SET i = ? and bi = ? WHERE b = ? AND c = 'a'
UPDATE ParamType SET i = ? and bi = ? WHERE b = 1 AND c = ?
UPDATE ParamType SET i = ? and bi = ? WHERE b = 1 AND c = 'a'
UPDATE ParamType SET i = ? and bi = 2 WHERE b = ? AND c = ?
UPDATE ParamType SET i = ? and bi = 2 WHERE b = ? AND c = 'a'
UPDATE ParamType SET i = ? and bi = 2 WHERE b = 1 AND c = ?
UPDATE ParamType SET i = ? and bi = 2 WHERE b = 1 AND c = 'a'
UPDATE ParamType SET i = 3 and bi = ? WHERE b = ? AND c = ?
UPDATE ParamType SET i = 3 and bi = ? WHERE b = ? AND c = 'a'
UPDATE ParamType SET i = 3 and bi = ? WHERE b = 1 AND c = ?
UPDATE ParamType SET i = 3 and bi = ? WHERE b = 1 AND c = 'a'
UPDATE ParamType SET i = 3 and bi = 2 WHERE b = ? AND c = ?
UPDATE ParamType SET i = 3 and bi = 2 WHERE b = ? AND c = 'a'
UPDATE ParamType SET i = 3 and bi = 2 WHERE b = 1 AND c = ?
UPDATE ParamType SET i = 3 and bi = 2 WHERE b = 1 AND c = 'a'

When requesting the data types of the parameters of the prepared statement (Connection.prepareStatement(string)getParameterMetaData()getParameterTypeName()) we get different results, a lot of them are wrong, for instance:

UPDATE ParamType SET i = ? and bi = ? WHERE b = 1 AND c = ?
Parameter 1: int (4)
Parameter 2: bigint (-5)
Parameter 3: bit (-7)

UPDATE ParamType SET i = 3 and bi = ? WHERE b = 1 AND c = ?
Parameter 1: int (4)
Parameter 2: bit (-7)

It seems as if the first real parameter after one or more fixed values gets the type of the first of these fixed values. I have a corresponding Java program to easily reproduce the problem.

Kind regards,

Ulrich

Linking my IBM u2 (UniVerse) to SQL Server

$
0
0

   I have seen this question posted in one form or another, but no "true" answer was ever given for UniVerse, only for db2, and those solutions do not work.   In short I'd like to setup my IBM UniVerse server as a Linked server so I can do all my code in Microsoft SQL Server, I have a work around for this moment, but I was hoping it would be short term.   I'm hoping someone might have some code I can use with sp_addlinkedserver that might work for their u2 server?

I've tried:

EXEC master.dbo.sp_addlinkedserver
    @server = N
'{Link Name}'
    ,@srvproduct=N'{Tried Serveral by Suggestions'
    ,@provider=N'IBMDASQL'
    ,@datasrc=N'ServersName'
    ,@catalog=N'ODBC' -- <-- that is my "Account" name in UniVerse, and that is how you reference them in the Uni drivers.

  So in short, I'm still without a "True" solution, the two solutions I've seen so far were actually ads from third parties trying to get us to buy something.   One was UniVerse to SQL (so I'd have to code in UniVerse) which is the opposite of what I want.

Ideas?

Viewing all 4164 articles
Browse latest View live


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