Showing posts with label windows. Show all posts
Showing posts with label windows. Show all posts

Friday, March 23, 2012

retrieving unicode using odbc

I have a table that has arabic, japanese, utf8 and ascii strings in it. When I try and rerieve those strings using the windows odbc driver, the ascii and since byte utf8 characters come back fine, the arabic and japanese are returning as single byte characters. I read on microsofts page that odbc versions before 3.7 are considered non-unicode. When I look at the version of the odbc administrator it says 3.5. Is there a newer version of the sqlserver odbc driver or windows odbc administrator that I would need?

Is there some way to specify what the client charset is? I'm using SQLGetData with a target type of SQL_C_WCHAR.

Right now I have xp SP2 that has mdac 2.8 SP1.

Thanks for your help.You need to check the Driver's File Product Version, the administrator version.

Ex. My C:\WINDOWS\SYSTEM32\sqlsrv32.dll is 3.85.1117.

The version the administrator reports is the Driver Manager version, which is basically the ODBC API compliance level for the Driver Manager. Anything on your system should be at least 3.5. The Latest version is 3.5.2

Jay Grubb
Technical Consultant
OpenLink Software
Web: http://www.openlinksw.com:
Product Weblogs:
Virtuoso: http://www.openlinksw.com/weblogs/virtuoso
UDA: http://www.openlinksw.com/weblogs/uda
Universal Data Access & Virtual Database Technology Providers|||Oh yes, you also need to fiddle with the Perform Translation settings, and potentially the server code pages. From the Driver help:

Perform translation for character data check box

When selected, the SQL Server ODBC driver converts ANSI strings sent between the client computer and SQL Server by using Unicode. The SQL Server ODBC driver sometimes converts between the SQL Server code page and Unicode on the client computer. This requires that the code page used by SQL Server be one of the code pages available on the client computer.

When cleared, no translation of extended characters in ANSI character strings is done when they are sent between the client application and the server. If the client computer is using an ANSI code page (ACP) different from the SQL Server code page, extended characters in ANSI character strings may be misinterpreted. If the client computer is using the same code page for its ACP that SQL Server is using, the extended characters are interpreted correctly.

Jay Grubb
Technical Consultant
OpenLink Software
Web: http://www.openlinksw.com:
Product Weblogs:
Virtuoso: http://www.openlinksw.com/weblogs/virtuoso
UDA: http://www.openlinksw.com/weblogs/uda
Universal Data Access & Virtual Database Technology Providers|||Thanks for the replay John,

The Driver's File Product Version is... sqlsrv32.dll is 3.85.1117.

Unselecting Perform Translation has no effect on what is returned. The data return actually appears to be returned in Latin1 encoding. So for a table containing arabic characters ...

الفائز بكأس

returns ...

'DA'&2

When I inserted the arabic into mssql I made sure it was encoded properly by using the statment ...

insert into test values (N'{CHARACTERS}')

Is there something else I could be missing?

Thanks for your help.|||What is the Fields Collation/ default collation?

default is found with sp_helpsort

Jay Grubb
Technical Consultant
OpenLink Software
Web: http://www.openlinksw.com:
Product Weblogs:
Virtuoso: http://www.openlinksw.com/weblogs/virtuoso
UDA: http://www.openlinksw.com/weblogs/uda
Universal Data Access & Virtual Database Technology Providers|||For this table I have the Collation set to <database default>. When I click on ... to change the collation it is set to SQL_Latin1_Gerneral_CP1_CI_AS.

I thought the collation was for sorting results only?

Thanks again.|||Another thing I've noticed, when I export data and write it to a file, the characters are incorrect the exact same way they are when I try using the odbc driver.

I feel like there is something basica that I'm missing here. Any ideas?

Thanks a lot for your help.sql

Wednesday, March 21, 2012

retrieving SQL Server roles and permissions

Hi,

I am developping an application using Windows forms(C#.net) and SQL Server 2005 Express edition. I would like to use SQL Server authentication. This is what I would like my application to do:

When a user logs in and is authenticated by SQL Server, the application to be able read the user's permissions/rights from SQL Server and use them to restrict to access what the user can do in the application. I have gone through lots of articles but all articles talk either of security in the .net environment or SQL Server security. None talks about integrating database security with application security.

Any leads will be appreciated.

Jakiiki

Hi Jakiiki,

Applications connect to SQL Server either via SQL Authentication or Windows Authentication. Once Autheticated the Applications identity in SQL Server is determined and access to resources is determined by the permissions the identity possess.

You can retrieve permission and role information about a user from sql server's catalog views.

sys.server_permissions and sys.database_permissions will list out all of the permissions granted to sql logins and sql user respectively.

sys.server_principals and sys.database_principals will list the sql logins for the instance and the sql users for the current database.

database and server roles will be listed in sys.database_principals and sys.server_principals

membership in these roles is tracked in the catalog view sys.database_role_members and sys.server_role_members

HTH,

-Steven Gott

SDE/T

SQL Server

sql

Tuesday, March 20, 2012

Retrieving list of files from XML in SSIS

I have an XML file which is having path for source files.
<files>
<file>c:\windows\1.xml</file>
<file>c:\windows\2.xml</file>
<file>c:\windows\3.xml</file>
</files>
1. I need to retrive these list in SSIS.
2. Find out if any of the file is modified within last 24 hours
time ... only if it exists.
3. send a mail to a given e-mail address.
I want to run it as a daily job and the list of file can change every
day in XML file.
~ShijuI'd probably "cheat" and create a script task to do the job.
"shiju" <shiju.samuel@.gmail.com> wrote in message
news:1171689178.353072.302370@.l53g2000cwa.googlegroups.com...
>I have an XML file which is having path for source files.
> <files>
> <file>c:\windows\1.xml</file>
> <file>c:\windows\2.xml</file>
> <file>c:\windows\3.xml</file>
> </files>
> 1. I need to retrive these list in SSIS.
> 2. Find out if any of the file is modified within last 24 hours
> time ... only if it exists.
> 3. send a mail to a given e-mail address.
> I want to run it as a daily job and the list of file can change every
> day in XML file.
> ~Shiju
>|||Hi
"shiju" wrote:
> I have an XML file which is having path for source files.
> <files>
> <file>c:\windows\1.xml</file>
> <file>c:\windows\2.xml</file>
> <file>c:\windows\3.xml</file>
> </files>
> 1. I need to retrive these list in SSIS.
> 2. Find out if any of the file is modified within last 24 hours
> time ... only if it exists.
> 3. send a mail to a given e-mail address.
> I want to run it as a daily job and the list of file can change every
> day in XML file.
> ~Shiju
>
I am not a SSIS expert but I think you should be able to use a foreach loop
for the XML file and specify the XPATH query to retieve the nodelist into a
variable which you can then use in a script task to check it exists.
John

Retrieving Digital Signature from memory?

Would like to use the digital signature (i.e. PKI) from a smart card to authorize a PDF document. Is it possible to retrieve the PKI from Windows once its read in via the smart card using some sort of C++ or Java API call to apply it to the PDF form?

It is possible to retrieve the smartcard certificate. You should post on a Windows forum for details on how to achieve this.

Thanks
Laurentiu

Friday, March 9, 2012

Retrieve windows user account

Hi, All
I'm use SQL Server 2005 and want to know is any way can retrieve windows
user account?
I want to retrieve windows user account and insert into the table.
I don't want to use any program lanaguage just want to know SQL 2005 has any
kind of function
or store procedure can support this.
Please give me function or store procedure name and reference.
Thanks for any advice!
Angiangi
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/565984cd-60c6-4df7-83ea-
2349b838ccb2.htm
"angi" <angi@.news.microsoft.com> wrote in message
news:OgEkdW0xGHA.2400@.TK2MSFTNGP03.phx.gbl...
> Hi, All
> I'm use SQL Server 2005 and want to know is any way can retrieve windows
> user account?
> I want to retrieve windows user account and insert into the table.
> I don't want to use any program lanaguage just want to know SQL 2005 has
> any kind of function
> or store procedure can support this.
> Please give me function or store procedure name and reference.
> Thanks for any advice!
> Angi
>|||Thanks for Uri.
But it my fault that didn't describe it clearly.
SYSTEM_USER retrive the windows user account who login the SQL Server.
But what I want is not who login to SQL Server and retrive it.
I want is retrive all of windows user account or user name on local server,
on windows server.
Example:
There are 10 windows user accounts on Local Server, such as John, Mary, May
and so on.
They are window server's user and maybe just John has the right to access
SQL Server.
And I want to use some kinds of SP or Function to get John, Mary, May's user
name
(not just login SQL Server's user, not SYSTEM_USER just show
"LOCALHOST\John"),
or some function like LDAP can get Windows user account or user name through
the T-SQL to retrive all of the windows user account or user name.
Such AS:
SELECT xxFn ... AS Username
EXEC xxSp ... AS Username
Username
----
John
Mary
May <-- user's account on windows server (not who login sql server)
...
uh... hope someone know what is my requirement!
Thanks for help!
Angi
"Uri Dimant" <urid@.iscar.co.il> glsD:%236RU9B1xGHA.480@.TK2MSFTNGP06.phx.gbl...[vbc
ol=seagreen]
> angi
> ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/565984cd-60c6-4df7-83e
a-2349b838ccb2.htm
>
> "angi" <angi@.news.microsoft.com> wrote in message
> news:OgEkdW0xGHA.2400@.TK2MSFTNGP03.phx.gbl...
>[/vbcol]

Retrieve windows user account

Hi, All
I'm use SQL Server 2005 and want to know is any way can retrieve windows
user account?
I want to retrieve windows user account and insert into the table.
I don't want to use any program lanaguage just want to know SQL 2005 has any
kind of function
or store procedure can support this.
Please give me function or store procedure name and reference.
Thanks for any advice!
Angiangi
ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/565984cd-60c6-4df7-83ea-2349b838ccb2.htm
"angi" <angi@.news.microsoft.com> wrote in message
news:OgEkdW0xGHA.2400@.TK2MSFTNGP03.phx.gbl...
> Hi, All
> I'm use SQL Server 2005 and want to know is any way can retrieve windows
> user account?
> I want to retrieve windows user account and insert into the table.
> I don't want to use any program lanaguage just want to know SQL 2005 has
> any kind of function
> or store procedure can support this.
> Please give me function or store procedure name and reference.
> Thanks for any advice!
> Angi
>|||Thanks for Uri.
But it my fault that didn't describe it clearly.
SYSTEM_USER retrive the windows user account who login the SQL Server.
But what I want is not who login to SQL Server and retrive it.
I want is retrive all of windows user account or user name on local server,
on windows server.
Example:
There are 10 windows user accounts on Local Server, such as John, Mary, May
and so on.
They are window server's user and maybe just John has the right to access
SQL Server.
And I want to use some kinds of SP or Function to get John, Mary, May's user
name
(not just login SQL Server's user, not SYSTEM_USER just show
"LOCALHOST\John"),
or some function like LDAP can get Windows user account or user name through
the T-SQL to retrive all of the windows user account or user name.
Such AS:
SELECT xxFn ... AS Username
EXEC xxSp ... AS Username
Username
----
John
Mary
May <-- user's account on windows server (not who login sql server)
...
uh... hope someone know what is my requirement!
Thanks for help!
Angi
"Uri Dimant" <urid@.iscar.co.il> ¼¶¼g©ó¶l¥ó·s»D:%236RU9B1xGHA.480@.TK2MSFTNGP06.phx.gbl...
> angi
> ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/565984cd-60c6-4df7-83ea-2349b838ccb2.htm
>
> "angi" <angi@.news.microsoft.com> wrote in message
> news:OgEkdW0xGHA.2400@.TK2MSFTNGP03.phx.gbl...
>> Hi, All
>> I'm use SQL Server 2005 and want to know is any way can retrieve windows
>> user account?
>> I want to retrieve windows user account and insert into the table.
>> I don't want to use any program lanaguage just want to know SQL 2005 has
>> any kind of function
>> or store procedure can support this.
>> Please give me function or store procedure name and reference.
>> Thanks for any advice!
>> Angi
>