Good day,
i have a Sybase ASE 12.5 database on windows NT server
the database default charachterset is CP850
i'm trying to connect to it using "TOAD for sybase" ,which is on my windows 7 machine
whatever character set i choose for TOAD (utf8,cp1256..), the data are shown in latin letters instead of arabic
i tried disabling the "server character set conversion" ,and disabling the client side conversion,but still no hope
any ideas how to solve this?
CP850 is the character set for Western Europe, so that would explain the latin. If the character set used by the client does not match what is used in the server, then it defaults to English.
You need to change the character set of the server to match what you wish to use for the client, or install the UTF character set in the Server to allow Unicode use.
The Sybase ASE documentation explains the details of charactersets.
the problem were in the server itself, it was corrupted during cloning.
thanks for all the answers
Related
I need to connect a Sybase ASE database with a specific charset. I have data with a charset that cannot be read properly by the default charset of Sybase ASE. I know how to connect with "isqln -J" but what I need is a little more complicated.
I have software that connects itself to an ASE database but it doesn't ask for a charset while establishing the connection, so it connects with the default charset.
What I want to ask is, are any of these options possible;
Can I change the default charset of Sybase ASE (not the database charset - I tried changing it, didn't work)
Can I track the connection so just before login (with login trigger etc.) I intercept the connection and change it to my needs (adding "-J" parameter maybe)
I tried changing the database's charset, system's charset, OEM charset, etc. none of these seem to work. The third-party software still connects the database with the default charset, so it cannot read the values with special characters properly
Please be noted -- Sybase ASE can only work fine when server/client's charset are same or compatible -- eg. when using iso_1 on server and client must be iso_1 too, or Server is cp936 and client is cp936 or the subset of cp936-- gb2312... Otherwise on client, you can only get illegal characters like space or square or XXX...
So here's the answer -- please check your ASE server's charset --
sp_helpsort
I don't know what client software you are using, but most general sybase client will call OS's Language settings to set as client's default charset. Then set it on your client's charset -- on linux/unix you can set it with LC_ALL or LANG, on windows, you can set it in Windows Unicode settings.
HTH
Once again with the charset issues when talking to DB's :)
I have two enviroments running Zend Server. Bot of these communicate to a SQL Server 2000 using the mssql extension. None of them has any value given for the charset in the settings of the extension. For one it works and for the other one it returns data in the wrong encoding.
The problem became noticed when this data was beeing inserted into a MySQL database and it screamed with SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xF6m' for column 'cust_lastname' at row 1.
I tried using SET NAMES utf8 to get the SQL Server connection to return the correct data, but it complains and says that NAMES is not a recognized SET statement. Looking around most people even recommend using this but it doesn't seem to be part of SQL Server 2000 :)
So, what should I do? How do I, WITHOUT fiddling with the SQL Server database/tables, tell it to send me the data in UTF-8 encoded format?
EDIT:
Some more info...
SQL Server uses the Finnish_Swedish_CI_AS collation
MySQL has every table in UTF-8 format and uses utf8_unicode_ci
I didn't find a good solution and ended up converting to and from utf8 in my application. If this is encapsulated within a class it doesn't riddle the code. But a way to actually tell the SQL server which encoding to use during communication would be better.
I am upscaling an access 2003 database to SQL Server Express 2008. The tables appear to be created ok and the data looks ok.
I have an MFC application that connects to this database. It worked fine connecting to access, but when I connect to SQL Server I am getting the following error on a select statement.
DBMS: Microsoft SQL Server
Version: 10.50.1600
ODBC Driver Manager Version: 03.80.0000
Warning: ODBC Success With Info on field 0.
String data, right truncation
State:01004,Native:0,Origin:[Microsoft][ODBC SQL Server Driver]
The data that is returned should be 8 characters but is only 7 with the right most character truncated.
The access front end can read the data from SQL Server correctly.
The field in the SQL Server table is defined as nvarchar with a length of 8.
The code to read the field looks something like
CDatabase Database;
CString sSerialNumber = "00000000";
CString SqlString;
CString sDsn = "Driver={SQL Server};Server=server\\db;Database=Boards;Uid=uid;Pwd=pwd;Trusted_Connection=False";
Database.Open(NULL,false,false,sDsn);
CRecordset recset( &Database );
SqlString.Format("Select SerialNumber from boards where MACAddress = '%s'",mac);
recset.Open(CRecordset::forwardOnly,SqlString,CRecordset::readOnly);
recset.GetFieldValue("SerialNumber",sSerialNumber);
After this, sSerialNumber should be 12345678 but its 1234567
Thanks for the help
I'd agree that this is driver related. The {SQL Server} driver was introduced for use with SQL 2000. {SQL Native Client} came along with 2005. Ideally, for your 2008 database, you should use the newest {SQL Server Native Client 10.0}. The newer drivers are backward compatible with older versions of SQL Server.
Changing my driver from
"Driver={SQL Server};"
to
Driver={SQL Native Client};
has made the problem go away, but I'm not sure what was going on. I'm going to keep looking into it
From a bit of Googling, I've learned that apparently, at times, particularly when "Use Regional Settings" is checked in the MS SQL Server ODBC driver DSN setup dialog, ODBC will treat a string made up of all digits, as a number, and return it like "12345678.00" which doesn't fit into the space you've given it. The solution is to turn that setting off, either in the dialog box, or, more permanently, in the connection string:
CString sDsn = "Driver={SQL Server};Server=server\\db;Database=Boards;"
+"Uid=uid;Pwd=pwd;Trusted_Connection=False;Regional=No;"
If you absolutely have to dig to the bottom of this, make a minimal stored procedure that will "select" local var defined as varchar(17) - any size more than 2x your original size will do. Now call the sproc instead of dynamic SQL and see what comes back. Then you can repeat it with exactly the same size (nvarchar(8)). Your little sproc serves as easy data adapter and to stabilize typing if old driver tends to get confused - much easier than fiddling with table definition.
Also, check if there's any param/property on inreface/connection classes to specify character encoding and make sure that it's unicode (utf-16). I assume that your code gets compiled for unicode. If not, you need to make decision about that first (N in Nvarchar means unicode, otherwise it would be just varchar). You definitely need character encoding matched at both sides or you will have other spurious errors.
I'm working with an SQL Server 2005 Express instance. Any attempt (both programatically or by using a table editor (for example VS Server Explorer --> Edit Table Data)) to enter a unicode string results in a sequence of question marks (????). I guess that either SQL Server 2005 Express doesn't support unicode at all or it requires some extra configuration to enable unicode. Please help.
THe datatype must be nvarchar (note the n at the start) and you must use the N prefix when using strings ..
INSERT INTO <table> (somefield) VALUES (N'string to insert..')
Microsoft technote
nchar and nvarchar
Not all Unicode characters may be rendered correctly by the font you chose in your editor.
What do I need to change in Sql Server to be able to store values like "2,1" in a decimal field? Right now I have to have dots like "2.1".
I have Finnish_Swedish_CI_AS collation on the database but that doesn't seem to be it ... I also fiddled around with the regions settings on the server but with no success. I know I've managed to change this before.
In security, your login properties, set default language to Finnish or Swedish.
Although I'd prefer to format values into english standard and have default language set to english - this way storing data is independent of client regional settings.
Store the data as a regular number - change it only when you display it.