i am developing json web-service using Codeigniter, when user POST Arabic character using web-service, in database it store like ????, but when i insert Arabic character using phpMyAdmin it working fine and also display well in web-service result, only issue with insert data.
in application/config/database.php
i used 'char_set' => 'utf8' and 'dbcollat' => 'utf8_general_ci'
but still issue is there.
If any one arrise issue in particular table field in PhpMyadmin, so can you please go to phpMyadmin than change Collation (table related accroding field) like
My Table Name : User ,
My field name : user_name
change it Collation latin1_swedish_ci to utf8_general_ci
Related
How would I go about hiding columns with a specific names? I have tables in my database with a few audit fields always named the same thing in each table:
created_at
updated_at
created_by
updated_by
This is an annoyance to the application developers who only wish to see the fields relevent to them. Is there a setting I can change to not show this on every table in the database sidebar?
Unfortunately, now it's impossible in DataGrip :(
Please, comment and follow: https://youtrack.jetbrains.com/issue/DBE-1387
We are using Oracle and we have a requirement to allow greek characters to be stored in the DB. Currently, our DB instance doesn't let us insert greek characters such as 'ϕ'. On googling, I found that it is to do with the character set. My oracle uses NLS_CHARACTERSET - WE8MSWIN1252 that doesn't support greek characters. I will have to change the character set to one of AL32UTF8, UTF8, AL16UTF16 or WE8ISO8859P7 if it has to work. Now that we have so much of data in the DB already, it would be a risk to change the character set now.
The other option I have is to change the column type (used to insert greek) from CLOB or VARCHAR2 to NVARCHAR2 and it works fine.
Before changing the column type, I want to know what are the risks involved in changing column type from CLOB to NVARCHAR2 and what are the things I need to keep in mind before changing.
Also, I would like to know the pros and cons of changing my existing character set to AL32UTF8.
EDIT:
There is also an option of changing CLOB to NCLOB and this seems to be less risky as both are closely related (almost same) types. Please do let me know the pros and cons of changing CLOB to NCLOB.
Ok. I was googling and posting Qs in other forums and got a much needed answer in here.
https://www.toolbox.com/tech/oracle/question/migrating-clob-to-nclob-010917/
So I just encountered this myself and I had issues with the above solution as it didn't copy across the foreign keys and constraints of my other columns. To get round this I did the following
created a new column for my NCLOB data,
ALTER TABLE table_name
ADD new_table_column NCLOB;
I then copied my CLOB data into my new NCLOB data column using the TO_NCLOB() function
UPDATE table_name
SET new_table_column = TO_NCLOB(old_table_column);
3)Finally I dropped the old column and then renamed my new column to my old column name
ALTER TABLE table_name
DROP COLUMN old_table_column;
ALTER TABLE table_name
RENAME COLUMN new_table_column TO old_table_column;
Please make sure you backup your data if you do this though as dropping the column will get rid of it and commit any transactions you've got
I also did this in Oracle so the syntax may differ slightly in other versions of SQL.
I am just trying to build a simple crud application using cakephp and oracle. But when i am trying to add a new data from my add.ctp its return with this error. can anyone help. Errors are below.
ORA-01400: cannot insert NULL into ("HR"."EMP"."EMP_ID")
CakeDC\OracleDriver\Database\OCI8\OCI8Exception
BTW here 'EMP_ID' is primary key of 'EMP' table and i have also created sequence.
You should try to create all tables strctures using cakephp migrations.
The reason of that - datasource when create table dditionally create not only sequence, but also a triger, to fill id field. Also driver written in way to follow cakephp table field naming conventions. So you can just take EMP schema and get everything work.
Options are: create all tables using migrations from cakephp side, or write trigger that will fill id fields manual on oracle side.
I have a table called names with database entries Rm, RM, Rnash, Rmash. In addition I am using PostgreSQL 9.1 and Oracle 11.
In Oracle the following query
select *
from names
where name > 'Rm'
returns Rnash, Rmash. However in PostgreSQL the same query returns RM. The ASCII value of M in RM is less than m in Rm.
Question 1: Why does PostgreSQL query return RM? Both Oracle and PostgreSQL are case-sensitive database.
My guess is that it might be due to COLLATE mismatch in PostgreSQL.
Question 2: How do I find COLLATE information related to PostgreSQL and Oracle?
Question 3: What do I have to do to make the output from the PostgreSQL query the same as Oracle's?
Thanks for your help in Advance.
It's because your locale's collation rules specify case-insensitive sorting.
Check the LC_COLLATE setting on your database. Look at \l+ mydatabase in psql or SHOW lc_collate;.
If you want to sort on the character ordinal alone, without national language collation rules being applied, use COLLATE "C", e.g.
select *
from names
where name > 'Rm' COLLATE "C"
If you want to use "dumb" character-ordinal sorting by default for all operations you'll need to re-create the database with the option LC_COLLATE "C" to CREATE DATABASE. This will involve a dump and reload.
You can instead ALTER TABLE ... ALTER COLUMN mycolumn TYPE thesametype COLLATE "C" to change the default collation for a particular column. Leave the type the same as it was before, and just append COLLATE "C".
I have Oracle database with following settings
NLS_CHARACTERSET EE8MSWIN1250
NLS_NCHAR_CHARACTERSET AL16UTF16
NLS_LANGUAGE AMERICAN
I've created test table with one column of type NVARCHAR2, where I'm going to store cyrillic.
I use SQL Developer to connect DB.
The problem is when I put a cyrillic chain into DB using SQL Developer cell, the data is stored correctly. But when I use INSERT query with the same data using N'' or not the data is stored as question marks.
Interesting thing is that query generated by SQL Developer, and written by me is identical.
I solved this problem by changing NLS_CHARACTERSET to UTF8, but on production server I can't do such a thing.
IMO it must be some way to store cyrillic into that DB in proper way using query if SQL Developer can do that.
Regards
Depending on the ODBC/JDBC in use, localization settings on your computer may override any config values in the database. Try using ALTER SESSION and set the proper NLS parameters before executing your query, and see if that helps. SQL developer might do this behind the scenes when you edit the data cell.