Showing posts with label odbc. Show all posts
Showing posts with label odbc. Show all posts

Friday, March 30, 2012

Multi Value Parameter Passing in OLEDB or ODBC

Hi Robert
We are integrating Sql server 2005 with sybase through ODBC.We are using
named parameters in the query...query which will fetch data from sybase
database.Now named parameters are those parameters which we specify with
'@.'.i.e. @.emp_id.
As we are conneting sybase from sql server 2005 through ODBC...but ODBC
doesnt support named parameter...so we are using unnamed parameters (?)
that is for e.g.
Select emp_id,emp_name from t_employee where emp_id = ?
but this is single value unnamed paramater...do u have idea how to pass
multivalue unnamed parameter which i can use with "In" clause..
Select emp_id,emp_name from t_employee where emp_id in ()
if i use ? along with "In" clause...it throws an error saying "Multivalue
Parameter is not supported in Data Extension"
Based on your last thread , we try to get something regarding creation of Custom Data Extension, but unfortunately we are not able to find much more on this particular topic.
We are able to find some readymain Custom Data Extension code from following link
http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=B8468707-56EF-4864-AC51-D83FC3273FE5
but unfortunately we are not able to find more from that link also.
Can u plz help us regarding this, as we are passing through very crucial problem.
We will really very glad, if you can help us to solve this problem.
Thanks in advance :).

Take your sql and replace the ? with a valid emp_id and then run the query:

Select emp_id,emp_name from t_employee where emp_id = 2056

Goto report parameters and delete all of the query parameters the sql was using. Then create a report parameter named EmpID. Set in to multivalue. You then can change your sql to the following:

="Select emp_id,emp_name from t_employee where emp_id in (" & Parameters!EmpID.Value & ")"

You have to follow the process as described. Also, if EmpId is a string then you need to surround your values with single quotes. ie. When you select your drop down to choose the EmpID's to run for you should see" '20034' and '23456' etc. This will then pass a comma delimited string value to the SQL.

Wednesday, March 7, 2012

MSSQL2005 64 bit + Client's 32 bit ODBC

Hi,
If I have a Intel x86 64 bit server, installed Win2003 64bit OS + MSSQL2005
64 bit version, and the client running Intel "Core2 Duo" (32 bit), installed
WinXP Prof, is the client able to connect to MSSQL2005 64 bit Database thro
ODBC drivers?
Thanks.Correcttion: Intel x64 not x86. x86 is 32 bit.
Of course they can.
You even can even install SQL Server 2005 x86 on your x64 environment. (of
course you better install x64 ver.)
However you can not install x64 on an x86 environment.
--
Ekrem Önsoy
"Markco Wong" <markcowong@.markcowong.com> wrote in message
news:erneasQ8HHA.3900@.TK2MSFTNGP02.phx.gbl...
> Hi,
> If I have a Intel x86 64 bit server, installed Win2003 64bit OS +
> MSSQL2005 64 bit version, and the client running Intel "Core2 Duo" (32
> bit), installed WinXP Prof, is the client able to connect to MSSQL2005 64
> bit Database thro ODBC drivers?
> Thanks.
>

MSSQL, Access 2000, and ODBC Interplay

To date I've used nothing but MySQL and have loved it.
The company I work for uses MSSQL and Access for their
product database. Here is the situation:
Product Manager has created a product database Products.DBF
This file is saved on the same server as the SQL server.
The goal is to have the SQL server use this DBF file so
that she can update the DB via access.
More info: The purpose of this is such that, when people
visit a certain ASP page, that page queries the SQL server
and pulls the data from the DBF file. I'm assuming this
has to be done via ODBC some how, with which I have some
experience, and I'm sure I'm missing something obvious but
any help would be greatly appreciated."Philip" <phil@.fizur.net> wrote in message news:<021101c33f43$fefd55c0$a501280a@.phx.gbl>...
<<>>
> More info: The purpose of this is such that, when people
> visit a certain ASP page, that page queries the SQL server
> and pulls the data from the DBF file. I'm assuming this
> has to be done via ODBC some how, with which I have some
> experience, and I'm sure I'm missing something obvious but
> any help would be greatly appreciated.
Well.. to my mind there is something obvious...
Store the data in sql server.
Forget my mysql.
Or.
Obtain some odbc driver allows access to connect to mysql and forget sql server.

Saturday, February 25, 2012

MSSQL Server 2005 reported account locked out for user 'sa'

Greetings,

I receive an error message in event log when i try to connect to the Database Server using ODBC on a client machine. The database server is running on Windows 2003 Server Standard Edition and the client machine is Windows XP Professional. Following is the error message from the event log:

2147467259 - [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'sa' because the account is currently locked out. The system administrator can unlock it.

What causes the error to occur and how to resolve it?Appreciate for your assistence.

Thanks and regards,

Viknes

That error message means that the number of unsuccessful attempts to connect as the ‘sa’ account on your server and triggered the lockout policy on SQL Server 2005 for this account.

I would recommend verifying the logs and trying to find out the reason why the account was locked out. It is possible that one of your applications is using an outdated password and it needs to be fixed, but it may also be possible it was an automated attack trying to guess the SA password.

The following links will hopefully help you to resolve your problem, but if you have any further question or if the documentation is not clear enough, please let us know:

· Password Policy (http://msdn2.microsoft.com/en-us/library/ms161959.aspx)

· Alter Login (TSQL) (http://msdn2.microsoft.com/en-us/library/ms189828.aspx)

· Changing password programmatically (http://msdn2.microsoft.com/en-us/library/ms131024.aspx)

-Raul Garcia

SDE/T

SQL Server Engine

|||Also remember that SQL Server accounts can now use Windows Security policies on whiche SQL Server is running(Password complexity, password expiration, etc.) This only works for Windows Server 2003

Monday, February 20, 2012

MSSQL ODBC vs. ADO

We have in our applications written in VC++ access also to MSSQL but only over ODBC. Is there any performance difference (is ADO faster) between ODBC and ADO access? And if yes how much it could be ?
Thanks for your answer.Yes, ADO is faster. How much faster depends on a lot of things but the generally accepted figures range from three to ten times faster.

-PatP

MSSQL ODBC problem

Hello everyone,
I have big problem with the speed of the ODBC connection.
Speed of the connectino depends of user which starts application.
For examle:
Main user (which usualy works on this computer) of computer open
application - connection is very very slow.
New user opens application - connection very fast.
I'm writing about windows user. Database user has not influence.
Help me please. I don't know what is going on.
System:
WinXP, MSSQL 2000, driver standard "SQL Server"
Zbyszek
Ensure ODBC tracing is OFF for that user. Refer to
http://kb.synametrics.com/FrontController?operation=1&id=41 for
information on how to turn in off.
zwi wrote:
> Hello everyone,
> I have big problem with the speed of the ODBC connection.
> Speed of the connectino depends of user which starts application.
> For examle:
> Main user (which usualy works on this computer) of computer open
> application - connection is very very slow.
> New user opens application - connection very fast.
> I'm writing about windows user. Database user has not influence.
> Help me please. I don't know what is going on.
> System:
> WinXP, MSSQL 2000, driver standard "SQL Server"
> Zbyszek

MSSQL ODBC problem

Hello everyone,
I have big problem with the speed of the ODBC connection.
Speed of the connectino depends of user which starts application.
For examle:
Main user (which usualy works on this computer) of computer open
application - connection is very very slow.
New user opens application - connection very fast.
I'm writing about windows user. Database user has not influence.
Help me please. I don't know what is going on.
System:
WinXP, MSSQL 2000, driver standard "SQL Server"
ZbyszekEnsure ODBC tracing is OFF for that user. Refer to
http://kb.synametrics.com/FrontCont...eration=1&id=41 for
information on how to turn in off.
zwi wrote:
> Hello everyone,
> I have big problem with the speed of the ODBC connection.
> Speed of the connectino depends of user which starts application.
> For examle:
> Main user (which usualy works on this computer) of computer open
> application - connection is very very slow.
> New user opens application - connection very fast.
> I'm writing about windows user. Database user has not influence.
> Help me please. I don't know what is going on.
> System:
> WinXP, MSSQL 2000, driver standard "SQL Server"
> Zbyszek

MSSQL ODBC difference compared to MySQL

The source for this problem can be found http://www.wellytop.com/SQLProblem.zip

This test creates two threads each with a database connection and uses transactions to insert values into the same table.
The objective of this test is to check that a thread cannot read the results from a pending transaction on a different thread.
In effect this checks dirty reads do not happen and transaction locking.

The test runs correctly and displays "PASSED" with MySQL indicating the transaction and threading worked.
When running with MSSQL Express 2005 it reports a deadlock error during a transaction.
It's not really possible to re-run the transaction and I would like MS SQL to operate similar to MySQL, i.e. MySQL waits for the other transaction to finish before the next transaction can operate on those table rows. I'd like to use MSSQL but I am wondering why this error doesn't happen with MySQL and so have, for the moment, chosen to use it as my preferred database solution.
I have experimented with transaction isolation levels and this doesn't seem to solve the problem.

I've tested this with a fresh install of Windows XP SP2 and no firewall turned on.

To run this test with MSSQL Express2005 use the ODBC Data Source Administrator (odbcad32.exe) to create a data source named MyExpressTest and attach this to an empty database that has been created with the default values. Enable the #define MSSQL in the coude otherwise it tests with MySQL.

To run this test with MySQL (to show how this test should work) use the ODBC Data Source Administrator (odbcad32.exe) to create a data source named mySQLNewTest and attach this to an empty database that has been created with the default values. Comment out the #define MSSQL to switch to MySQL mode.

Replying to my own old post is a bad sign, it's one step away from talking to myself. Wink

However that said I thought it would be useful to summarise my findings. The problem above is a limitation of the MSSQL ODBC interface. Basically, MSSQL ODBC connections with transactions from different processes work whereas if two or more connections come from the same process there is no transaction waiting. The workaround is to not use more than one MSSQL ODBC connection from each process. An alternative would be to use something like ADO instead, but that would break the example given in the problem where the code is meant to be cross platform and have a choice of database.

|||

Hi Martin,

After running your repro and experimenting with sqlcmd, I can see the same thing happening in sqlcmd with two separate processes running your statements in transactions. If I set the transaction isolation level to 'snapshot', the problem does not surface and each thread sees only the rows that existed before their transaction started or were inserted during the transaction, so perhaps snapshot isolation is for you.

For reference, I ran sqlcmd twice and executed:

SETUP:

create table t2 (id integer identity primary key, thing integer)

WINDOW 1:

-

begin tran

go

insert into t2(thing) values(10)

insert into t2(thing) values(14)

insert into t2(thing) values(15)

go

select * from t2

go

WINDOW 2:

begin tran

go

insert into t2(thing) values(100)

insert into t2(thing) values(110)

insert into t2(thing) values(120)

go

select * from t2

go

However, setting the transaction isolation level to 'serializable' seems as though it should also address your issue; but it does not.

From looking at the locks that get held, it is clear that thread 1 and thread 2 each obtain an exclusive lock on a subset of the rows in the table, then try to obtain a shared lock on the whole table to select. Since each holds an exclusive lock on a subset of the table, they reach deadlock. Effectively, the isolation level needs to be set such that they do not see each other's rows during the transaction so they can read without locking the table -- or what they see as the table. Snapshot isolation level clearly does this for you, but one would expect serializable to do it as well.

In order to ensure that your question is addressed by experts in this particular domain, I am transferring this question to T-SQL forums.

I hope this helps,

John

|||

Thank you very much for your extremely helpful answer. Smile I just tried the test source here (configured for MSSQL) and found your suggestion does indeed solve the problem without any code changes needed.

After a bit more digging and searching for ALLOW_SNAPSHOT_ISOLATION this link http://msdn2.microsoft.com/en-us/library/tcbchxcb(vs.80).aspx describes the same solution.

So with the RNLobby database created (or in a new create database script) I then issue this command:

ALTER DATABASE [database name] SET READ_COMMITTED_SNAPSHOT ON

GO

Turning this option on by default for all connections means the code doesn't need changing to enable the snapshot isolation level for each connection which is perfect for this test case but may not be perfect for everyone.

MSSQL ODBC (SQL) connection issue (sqlstate 2800)

I am trying to make an ODBC connection to a MSSQL 2K server on a remote machine. I am using the SQL Server driver and can see the server in the drop down list when asked which server I would like to connect to. I am using SQL authentication over TCP/IP.

The error occurs when ODBC tries to connet to SQL server to obtain the default settings. The error I receive is as follows:

Connection Failed;
sqlstate '28000';
sql server error: 18456;
[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'XXXX'

I have tried setting up alternate SQL Server users with varying security rights on the server but am not able to setup the ODBC connection.

I am setting the ODBC connection up on a windows XP SP2 machine.
The remote server is running Windows server 2003 (patched upto date) and MS SQL server 2K (SP3). The connection is over a LAN and does not pass through any firewalls (hardware or software). I can create the ODBC connection without issue locally on the server.

This is my first time creating an ODBC connection to a Windows 2003 Server and I am wondering if there is some additional config I may have missed out.

Many thanks.what authentication mode is your sql server running in? windows only or mixed mode?|||The server is running in mixed mode for this instance. I have tried connecting using windows authentication, but the connection times out at the same stage as above.

Many thanks.|||1. make sure that you can ping the server
2. Open your Security\Logins, check the "Database Access" and "Server Roles" that are set to the correct setting.