I'm trying to select some urdu characters from Oracle database table on linux shell on red hat server but it is displaying as "??????". Below is the output on shell
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL> select * from urdu_test;
MSISDN
CUSTOMER_NAME
923165106151
???? ???? ??? ???? ?? ?? ??? ?? ???? ???
on DB side below are the characterset parameters.
on red hat server i export the NLS_LANG variable as below
export NLS_LANG=AMERICAN_AMERICA.UTF
But i'm still unable to select the urdu characters from db. On DB side i can insert and select the characters manually.
Any support will be appreciated, what variables need to be check on linux side?
Related
In SSMS I'm connected to an Intersystems Cache database using ODBC driver and linked server When I fetch data using a SQL query like
SELECT Text FROM OPENQUERY([ODBC_CACHE_DB],'SELECT TOP 100 Text FROM cls.Actions')
IN SSMS it gives results but it gives ? for arabic characters like
"18:29:00 [Mohamad] ????? ??? ?? ??? ??? ?????? ????? ? 18:30:30 [Customer] Hi Sirius is jai"
how could get arabic texts ?
note: I can read and write arabic text with using nvarchar data type
Had a similar issue. My setup was a linked server setup between MSSQL 2012 cluster and Intersystems Cache 2009.x using MS OLE ODBC provider.
My observations below:
Convert/Cast on the column with nvarchar datatype did not work -- as in it shows the ???? (This is on SSMS)
When using 3rd Party DB management tools such as Database.net and WinSQL, I was able to see the correct characters.
Playing around with the ODBC driver's Unicode SQL Types function only intermittently helped show the correct characters.
The solution:
Enable Unicode SQL Types function on the ODBC driver
Make changes to the test sql query that is being executed on the Intersystems Cache db. If you keep executing the same query, the output is cached for sometime (not sure how long exactly).
In my case, the sql server cluster was not under my control and took a few days to play around with the different variations.
I have about had it with SQL Server 2012 64 bit!
I am creating a SSIS package with a SQL query to Oracle and trying to put the file into a flat file. I am using the Oracle OLEDB source and a Flat File Destination for the output. Everything works fine locally, but when put on the server and run through SQL Agent I keep getting the Unicode to Non-unicode errors!
The latest drivers are on the server and the 11g client is on my development machine. The types shown in each step show as DT-STR.
I have the exact same source writing to an OLEDB destination just fine. I don't want to have to write these to a table and then pull them back out just to get this to work. Any solutions? And please, no "just add this" responses.
I have tried a data conversion, but get same result. Please supply DETAILED answers as in go here and change this to this. Pictures never hurt. Thanks
Short answer is that you need to convert codepages, not datatypes.
Long answer follows:
Step 0: If you're not already using it, I highly recommend that you switch to using the Attunity Connectors instead of stock Oracle OLEDB connector. You can download it for SQL2012 from Microsoft at: https://www.microsoft.com/en-us/download/details.aspx?id=29283
Step 1: Using the Attunity Oracle Source, you can specify a SQL Command as the data access mode, instead of just pointing at a table.
Step 2: You need to determine the exact code page the Oracle server is using, and the exact code page your SQL server is using. For Oracle servers using the UTF-8 character set, this is most likely AL32UTF8 and for a Windows Server using the default ANSI-1252 char set, the code page is WE8MSWIN1252.
Step 3: Write your plsql query and CONVERT the codepage of all the columns on the Oracle side. Make sure you use double quotes around the Oracle column names. It should look something like this:
SELECT
CONVERT("Data Source Code",'AL32UTF8','WE8MSWIN1252') AS DataSourceCode
,CONVERT("Order#",'AL32UTF8','WE8MSWIN1252') AS OrderNumber
,CONVERT("Invoice#",'AL32UTF8','WE8MSWIN1252') AS InvoiceNumber
,CONVERT("Item#",'AL32UTF8','WE8MSWIN1252') AS ItemNumber
,CONVERT("Order Line Type",'AL32UTF8','WE8MSWIN1252') AS OrderLineType
,CONVERT("Order Status",'AL32UTF8','WE8MSWIN1252') AS OrderStatus
,CONVERT("Order Date",'AL32UTF8','WE8MSWIN1252') AS OrderDate
,CONVERT("Invoice Date",'AL32UTF8','WE8MSWIN1252') AS InvoiceDate
,CONVERT("Ship To Cust#",'AL32UTF8','WE8MSWIN1252') AS ShipToCustNumber
,CONVERT("Billing Account #",'AL32UTF8','WE8MSWIN1252') AS BillingAccountNumber
,CONVERT("Sold Qty",'AL32UTF8','WE8MSWIN1252') AS SoldQty
,CONVERT("Unit Price",'AL32UTF8','WE8MSWIN1252') AS UnitPrice
,CONVERT("Sales Amount",'AL32UTF8','WE8MSWIN1252') AS SalesAmount
,CONVERT("Handling Amount",'AL32UTF8','WE8MSWIN1252') AS HandlingAmount
,CONVERT("Freight Amount",'AL32UTF8','WE8MSWIN1252') AS FreightAmount
FROM MYORACLEDB.DIGITAL_SALES_FEED
WHERE "Invoice Date" >= TO_DATE('2018/08/01', 'yyyy/mm/dd')
Step 4: Use this query text as the SQL command text in the Oracle Source configuration window.
Fun Fact: Oracle will return the column names in ALL CAPS, regardless of your AS ColumnName format.
Step 5 (optional): All columns will be returned as strings. You might want to put a Data Conversion task in your Data Flow, but if you're just dumping your data into a flatfile, you might not care about the data conversion. I have decimal/numeric and dates in my data set, so I do a conversion before inserting into SQL Server.
I am using progress 10.2B with Oracle 9i as back end DB with use of progress data server for oracle. I created one schema holder and started it with parameters:
"-cpinternal UTF-8 -cpstream UTF-8 -cpterm UTF-8 -cpcase Basic -cpcoll basic".
Now I am connecting same schema holder and Oracle DB (residing on same server) from editor. While connecting to Oracle I am not specifying any data service name or port number. Once connected with above configuration, I am able to update data in table in Arabic form. Now when I am using service name and port number (of orabroker residing on same server) to connect to my schema and oracle DB, I am not able to update data in Arabic and some random data like "��������" is coming. Do I need to do any changes for UTF support for Orabroker? Are there any parameters for same?
This statement returns null instead of 64 random bytes:
select DBMS_CRYPTO.RANDOMBYTES(64) from dual;
What is causing it to return null? Database is Oracle 10.1.0.2.0 running on Windows Server 2003 and I want to use the random bytes as salt for password hashing.
Edit: Here's the output from sqlplus:
Connected to:
Oracle Database 10g Release 10.1.0.2.0 - Production
SQL> select DBMS_CRYPTO.RANDOMBYTES(64) from dual;
DBMS_CRYPTO.RANDOMBYTES(64)
--------------------------------------------------------------------------------
SQL>
Edit2: When switching to Oracle 11 the query works. I have no idea why it doesn't work on Oracle 10 but have decided to not use that old database.
It works perfectly. I have tested it on Oracle 12c.
Update
I have checked My Oracle Support(Metalink), however, did not find anything related to this function returning NULL. Certainly, not a bug.
Anyway, looking deeper into the function and it's usage in the documentation, I came across SQLNET.CRYPTO_SEED
SQLNET.CRYPTO_SEED
Purpose
Use the parameter SQLNET.CRYPTO_SEED to specify the characters used
when generating cryptographic keys. The more random the characters
are, the stronger the keys are. The string should be 10-70 random
characters. This optional parameter is required for when encryption or
checksumming are turned on. Encryption is turned on if the
SQLNET.ENCRYPTION_CLIENT parameter is specified for the client and the
SQLNET.ENCRYPTION_SERVER parameter is specified for the database
server; checksumming is turned on if the SQLNET.CRYPTO_CHECKSUM_CLIENT
parameter is specified for the client and the
SQLNET.CRYPTO_CHECKSUM_SERVER parameter is specified for the database
server.
It might be possible that the parameter is not properly set in your environment. I don't have 10g version(obsolete though) to test.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing option
SQL> select DBMS_CRYPTO.RANDOMBYTES(64) from dual;
DBMS_CRYPTO.RANDOMBYTES(64)
--------------------------------------------------------------------------------
427AECD44D27CDF6CDC8F290D9F8079109BAB8AECD7E687E7ADF8E15825BBDF3D746FBC181059443
965B1425B224CC46E8CD07CC2D02B2E023238E8883520A19
SQL>
I have a big deal: I have to connect (I just want to read data, not to write) to my customer's IBM AS/400 (aka iSeries, now IBM i) server...
I think I have all parameters needed (given me by the AS/400 programmer), but I can't figure out which driver I have to use, and if I have all software needed to to this!
I've installed IBM AS/400 ClientAccess 5.8 driver (with a patch for latest OS), and now I'm trying to configure a new Linked Server in my Sql Server 2008 R2 (x64) server.
First problem: Which driver should I use?
I have so many choices (but maybe none of these works!!):
IBM DB2 UDB for iSeries IBMDASQL OLE DB Provider
IBM DB2 UDB for iSeries IBMDA400 OLE DB Provider
IBM DB2 UDB for iSeries IBMDARLA OLE DB Provider
...or maybe other generic OLEDB/ODBC drivers?!
Second problem: Where should I put my parameters (in which fields I mean!)
In any case, in I choose a provider for my Linked Server, obviously I have to set my parameters...but I only have this:
Username of an ADMIN user
Password of the ADMIN user
AS/400 server IP address
The name of "main" archive, in which my data are stored (something like ACG_DATV2)
Third problem: How should I write my queries? How to reference an AS/400 "archive" and tables?
I don't know how to build my reading query: where are tables and views (?!) stored and how can I reference them?
Thank you in advance!
I think there are many ways to achieve what you want, but I'll try to explain what I would do in your case.
With that version of IBM ClientAccess (and also the patch), I should not have troubles in getting connected with a Sql Server 2008 R2 Linked Server if you use the correct data provider.
First of all, try to configure your linked server in this way:
Linked server name: what you want, it's just a custom name (example: MYAS400)
Provider: IBM DB2 UDB for iSeries IBMDASQL OLE DB Provider
Product name: not important, something like iSeries Access OLEDB Driver
Data source: AS/400 server IP address (example: 192.168.0.1)
Either if you configure the Linked Server using the wizard or by SQL code, the first time it will need to access the data of the AS/400 server, you'll be asked for credentials, with a typical iSeries window (look at my example).
Set your username (User ID) and the relative password, without regarding the case of the strings!!
As a general tip (but this is only related to my experience!), try to avoid special characters and upper/lower cases distinctions...
If you arrive here (no problems in the Linked Server creation), the Linked Server should work (so the first and the second problem are solved): let's build the first query!
Once the Linked Server is created, all you need is just to correctly reference the archive, the library and, of course, the correct table and the Linked Server (by name): with this informations, build a query like this (it's the usual T-SQL syntax):
SELECT
(Field1)
, (Field2)
, *
FROM (Linked Server Name).(Catalog Name).(Library).(TableName)
The only information you're probably missing is the "archive": you can easily find it browsing the Catalogs tree inside your new Linked Server, or just use iSeries Access Navigator tool!
So, in your case, I think the query should be (more or less):
SELECT
FILIO
, DTVLD
, DTVLA
, SEQZA
, CFIMP
, PADRE
, TPVLD
, CMVLD
, *
FROM MYAS400.S242DA0A.ACG_DATV2.ANLE200F
Note that S242DA0A is valid only in my case...
Remember also that:
AS/400 will probably ask you for credentials very often: also if you close and reopen SSMS.
Performance?...better to talk of something else :) ... extract the tables in your Sql Server tables and query them from there! Do it with a simple: SELECT (Fields) INTO myTable FROM (AS/400 table)
I've tried this process many times, I didn't have many troubles (once I get skilled about!)...but only for reading data (as you asked)! Never tried to update data!!!
GOOD LUCK!