
There is also a message thrown by the server process : # Listening for connection requests on mapi:monetdb://127.0.0.1:50001/ # MonetDB/SQL module v2.26.2 loaded
#logical_exp with scope
Xiaobo.Gu wrote:
Following is the response when I use your data file:
sql>create table t1(a int not null primary key, b varchar(1024) not null); 0 tuples sql>select * from t1; 0 tuples sql>copy into t1 from 'd:\\data.txt' using delimiters ','; Rows affected 2 sql>select * from t1; +---+---------+ | a | b | +===+=========+ | 1 |2 tuples write error sql>
Sjoerd Mullender-2 wrote:
小波 顾 wrote:
Hi Sjoerd, Can you send me your test file and table schema please.
My schema was the same as yours:
create table t1(a int not null primary key, b varchar(1024));
I attach the data file, which should be UTF-8 encoded. Just to be sure, I also put the file into a zip file so that nobody interferes with the encoding.
Date: Tue, 6 Jan 2009 16:11:58 +0100 From: sjoerd@acm.org To: monetdb-users@lists.sourceforge.net Subject: Re: [MonetDB-users] Copy from file which contains Chinese characters failed.
The mclient -E option only affects data that flows through mclient, that is, mclient's standard input and standard output. When you use a copy into from file, the file is read directly by the server and not by mclient, and the server wants UTF-8 encoded data. This means that the data file must be UTF-8 encoded. Nothing else will do.
My Windows system doesn't speak Chinese, so I can't really test it there, but on Linux it works correctly when I make sure the data is indeed correctly encoded.
If you have the data in some other format, you should be able to do something like mclient -Eencoding file where file contains (in the specified encoding): copy 2 records into t1 from stdin using delimiters ',','\r\n'; 1,测试1 2,测试2
But this requires the copy command to be in the file as well.
小波 顾 wrote:
Copy from file which contains Chinese characters failed. My test table is create table t1(a int not null primary key, b varchar(1024)); My test file d:\data.txt contains two lines 1,测试1 2,测试2 I have tried to save the data file using ANSI and UTF8 encoding using Notepad on windows, and tried to start mclient with -Ecp437, -Ecp936 and -Eutf-8 option, neither combination of the file encoding and mclient encoding can load the file correctlly. When both using utf-8 the following error messages appears: sql>copy into t1 from 'd:\\data.txt' using delimiters ',', '\r\n'; !SQLException:importTable:failed to import table !ERROR: value 'ï»?' while parsing 'ï»?,顾å°æ³? !ERROR: 2,覃æ€? from line 0 field 0 not inserted, expecting type int !ERROR: TABLETload_bulk: read error (after loading 0 records) 0 tuples When using other combinations, the following messages appears: sql>copy into t1 from 'd:\\data.txt' using delimiters ',', '\r\n'; 0 tuples write error sql> The following steps works, but the exported data.txt isn't readable by human. mclient XXXXX -Ecp437 delete from t1; insert into t1 values(1,'²âÊÔ1'); insert into t1 values(2,'²âÊÔ2'); copy select * from t1 into 'd:\\data.txt' using delimiters ',' ,'\r\n'; delete from t1; copy into t1 from 'd:\\data.txt' using delimiters ',' ,'\r\n';
------------------------------------------------------------------------
Get news, entertainment and everything you care about at Live.com. Check it out! <http://www.live.com/getstarted.aspx >
------------------------------------------------------------------------
------------------------------------------------------------------------
_______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- Sjoerd Mullender
------------------------------------------------------------------------ Get easy photo sharing with Windows Live™ Photos. Drag n’ drop http://www.microsoft.com/windows/windowslive/photos.aspx
------------------------------------------------------------------------
------------------------------------------------------------------------------ Check out the new SourceForge.net Marketplace. It is the best place to buy or sell services for just about anything Open Source. http://p.sf.net/sfu/Xq1LFB
------------------------------------------------------------------------
_______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- Sjoerd Mullender
1,æµè¯1 2,æµè¯2
------------------------------------------------------------------------------ Check out the new SourceForge.net Marketplace. It is the best place to buy or sell services for just about anything Open Source. http://p.sf.net/sfu/Xq1LFB _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- View this message in context: http://www.nabble.com/Copy-from-file-which-contains-Chinese-characters-faile... Sent from the monetdb-users mailing list archive at Nabble.com.