Hibernate MSSQL nvarchar Equivalent datatype in oracle [duplicate] - sql

This question already exists:
nvarchar in sql ,oracle and mysql in Hibernate annotation mapping
Closed 8 years ago.
We are developed project using hibernate with sql server. Now we are migrating sql server to oracle.
We have user Nvarchar datatype in mssql server for more than 80 tables. While we are trying to create tables in oracle through hibernate table containing Nvarchar datatype are not getting generated other table are creating successfully.
While we change the column to varchar than also table are getting generated.
How to create UTF-8 datatype in oracle and mssql as a common datatype in hibernate.
Please Help !!!!!!

What is your database character set? Assuming that you create the database setting the database character set to AL32UTF8, VARCHAR2 columns in Oracle would store data in the UTF-8 character set.
If you cannot use a Unicode character set for your database character set, you'd need to use nvarchar2 columns. An nvarchar2 column stores data using the national character set. Unless you've upgraded from an old version of Oracle, your database character set would use the UTF-16 character set, not UTF-8.

Related

Why do some string fields only have a single character when using Oracle heterogeneous services to pull view from SQL Server?

I have confirmed that the view returns the correct data when on the SQL Server. But when pulling the raw view through Oracle some of the string columns only contain 1 character for each record, while other columns are fully populated.
Does anyone know what could cause this issue?
The fields that had cutoff characters were NVARCHAR(50). Apparently, Oracle does not pull NVARCHARs correctly from SQL Server. Casting them as VARCHAR(50) in the SQL Server view solved the problem.

Moving Oracle SQL CLOB values(>4000 chars) to SQL Server without trimming

I'm building ETL in SSIS, and have to move data from Oracle DB to data warehouse on MS SQL Server.
I am facing a problem with migrating contents of columns of datatype CLOB.
So far I was casting CLOB values to VARCHAR using:
dbms_lob.substr(*columnName*, 4000, 1)
I could then easily write such contents as nvarchar in SQL Sevrer.
However I would not like to force-trim everything- how can I move entire content of CLOB (when exceeds 4000chars) in a format that's going be recognized by SSIS/SQL Server?
Can I cast CLOB as any other datatype without trimming it?

Error in collate SQL_Latin1_General_CP850_BIN2 with UTF-8 SQL Server

I'm trying to select a column from my database that has SAP's informations.
But when I execute my select all my special characters as 'À Ê' are broken, for example:
TELECOMUNICAÃiES (INCLUI ASSIST-NCIA T+CNICA)
should be
TELECOMUNICAÇÕES (INCLUI ASSISTÊNCIA TÉCNICA)
Is there some way to resolve this using a cast or a convert functions?
OBS: All my tables are configured with SQL_Latin1_General_CP850_BIN2 as required of SAP, but the columns are varchar instead of nvarchar
Probably the data is corrupted because this collation is default in any Windows

which data type can save bangla Language in sql server?

I want to save bangla Language in sql server. Using which data type I can Do it in sql server 2005 or sql server 2008.
I tried varchar and varbinary type but it cannot save bangla Language.
How is it possible?
You're using SQL_Latin1_General_CP1_CI_AS for your collation, which is suited for the Latin character set (ISO-8859-1). To store characters fromother character sets, you can use the NVARCHAR() which can store the full Unicode range, irrespective of collation - this does mean it will need to be treated as NVARCHAR() all the way, as quoted constants (e.g. N'বাংলা Bangla'), as the data types for parameters to stored procedures, etc.

Read SQL Server field text value in Delphi XE with simultaneously character conversion

I have a SQL Server 2005 database with COLLATION SQL_Latin_General_CP1_CI_AS and I want to run a query from Delphi XE via ADO. Data in SQL Server is Greek and Latin characters. But in Delphi I get unreadable character strings. How can I manage this problem with Delphi XE ?
Since you say that you have both Greek and Latin characters in the db I guess that you are already using nvarchar in the db.
In Delphi you should then use TWideStringField for nvarchar fields. TStringField is for varchar (ansistring).
Field1 contains "γειά σου"
StringField := ADODataSet1.FieldByName('Field1') as TStringField;
ShowMessage(StringField.Value);
ShowMessage shows "?e??s??"
This works fine
WideStringField := ADODataSet1.FieldByName('Field1') as TWideStringField;
ShowMessage(WideStringField.Value);
Edit 1
If you have varchar fields in db you should use TStringField and you need to make sure that the "Language for non-Unicode programs" is Greek(Greece).
"Control Panel - Region and Language - Administrative - Change system locale..."
I have found that sometimes UTF-8 is stored in databases in VarChar fields, usually from Java programs.
If you see things like â€", there's a good chance that's what is going on.
You could try
// Delphi 2009+
UTF8ToUnicodeString(RawByteString( db_value ))
// Delphi 2007 and older
UTF8Decode( db_value )
If this is the case, you can also use a sql function to convert the VarChar fields to NVarChar