Insert chinese big5 characters into database

database: mysql
default charset of web page: utf-8 (specified in apache, all
pages are in utf-8)
if I enter english, database insert is ok but if I enter
chinese, error = "You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near '?, ?)' at line 1"
display inputted fields are OK.
*** form.cfm ***
<form action="insert.cfm" method="post">
name: <input type="text" name="name"
value=""><BR>
Password: <input type="text" name="password"
value=""><BR>
<input type="submit" name="login_user"
value="insert"><BR>
</form>
*** insert.cfm ***
<cfoutput>
#Form.name#<Br>
#form.password#<br>
</cfoutput>
<cfquery name="insert" datasource="test">
insert into test (name,password) values ('#Form.name#',
'#Form.password#')
</cfquery>

dynason wrote:
> database: mysql
> default charset of web page: utf-8 (specified in apache,
all pages are in
> utf-8)
what version of cf5? what version of mysql? has to be at
least 4.1. is the db,
etc. setup to handle that encoding? do you really want to use
BIG5 instead of
unicode? what db driver? it can't be ODBC.

Similar Messages

  • Entry of non-English characters into database

    Hi
    We are facing a problem in inserting non-English characters into the database.For example, we have a company name field which can accept German characters. This field has been defined as of varchar2 type of size 50 in the db. When we enter 49 English characters and then one German character, the database is throwing the error that the inserted value is too large for the column.Is it that the German character is taken as equivalent to two English characters ? Or is there any database level setting that can be done for this ? For the time being we have identified certain critical fields and have doubled the size of their fields in the db. But I guess there has to be another solution to this....
    Please help.
    TIA
    Vinoj

    Indeed, your German character is using two bytes to store itself. Consult the Oracle JDBC Developer's Guide.
    null

  • ORA-01461 when trying to insert text 4000 characters into a CLOB column

    I work on a Windows application that connects to databases using ODBC. I'm currently working on adding Oracle support to the application, but I'm running into a lot of problems inserting strings of more than 4000 characters into CLOB columns. First, I tried to do that directly using code similar to the following (setup, cleanup, and error checking snipped for clarity).
    SQLHDBC hDbc;
    SQLHSTMT hStmt;
    unsigned char query[200];
    SQLAllocStmt(hDbc, &hStmt);
    strcpy(query,"INSERT INTO test_table (col_clob, col_int) ('long string', 1)");
    SQLExecDirect(hStmt,query,strlen(query));
    Of course, "long string" was really a string of more than 4000 characters. When I did that, I got an error indicating that I needed to use bind parameters for strings that long. However, bind parameters don't seem to work either. I changed my code to something like the following:
    SQLHDBC hDbc;
    SQLHSTMT hStmt;
    unsigned char query[200];
    +unsigned char *str=NULL;+
    int str_size;
    SQLAllocStmt(hDbc, &hStmt);
    strcpy(query,"INSERT INTO test_table (col_clob, col_int) (:strvar, 1)");
    SQLPrepare(hStmt,query,SQL_NTS);
    str = (unsigned char*)malloc(6000 * sizeof(unsigned char));
    SQLBindParameter(hStmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARBINARY, 0, 0, str, sizeof(str), &str_size);
    strcpy(str,'long_string');
    str_size = SQL_NTS;
    SQLExecute(hStmt);
    This code works fine when 'long_string' is less than 4000 characters. When it's greater than that, I get the following error:
    +[Oracle][ODBC][Ora]ORA-01461: can bind a LONG value only for insert into a LONG column+
    I'm using Visual Studio.NET 2003 on Windows XP, and Oracle client 11.1.0.6.0. My server version is as follows:
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for Linux: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    I thought I read somewhere that this is a known bug with Oracle 10.2.0.1.0, but I can't seem to find the reference now. Can anyone confirm this or provide some assistance with this problem? Frankly, it seems kind of ridiculous that I can't do something as simple as inserting a reasonably sized amount of text into a CLOB column. I'm considering using BFILEs instead, but that would be kind of a pain to fit into our application, so I'd prefer not to do this if at all possible.
    Thanks in advance for any help.

    I found this link referring to a similar problem that was apparently fixed in version 10.2.0.4 of the server: ORA-01461: can bind a LONG value only for insert into a LONG column Should I try to upgrade the server and see if that fixes things?

  • Inserting data from Textarea into database

    I am collecting data from a html form which has textarea and processing it through servlet.
    If I enter text in textarea without breaks(without pressing enter tab) it is being collected and correctly put into database.
    If I enter text with breaks (with pressing enter tabs for entering in separate lines) it is being collected correctly but only one line goes into database.
    How to insert entire text from textarea into database.
    bye
    Kaushik

    problem is not yet solved.
    i am able to print in the sql query and is displayomg all the chars. but missing while executing the statement.
    mysql - 3.23, driver is org.mm..mysql driver
    Can u please look at this another problem:
    I have a keyword and need to search against a table containing 100 fileds.
    select * from table where keyword like '%"+keyword+"%'
    searches only in one field. If I want the search to be performed against all the fields in the table, Is there any solution.
    What I am doing at present is putting all the fields data in a new field and performing like operation on that field.
    but this is very slow.
    thanks and regards
    Kaushik

  • Trouble in writing Chinese Characters into database

    I'm developing a JSP web site using ACCESS2002, Tomcat4.0.4 and J2EE 1.4.1. I found my data(chinese chatacters) in mess when I wrote it in to database through sun's own JDBC-ODBC driver though it is displayed correctly in web-browser. I tried in JSP, Servlet and JavaBean, and the situation seems no better.
    Is it the problem of sun's JDBC-ODBC driver or is there a solution to this problem?
    Eager to hear a reply, thank millions!!

    Have you tried something like the following?
    first, set this page quality:
    <%@ page contentType="text/html;charset=Big5"%>
    then, change the Chinese string to this:
    String zhtounicode=new String(yourzhstring.getBytes("8859_1"));
    then, do with the converted string.

  • Inserting all manner of characters into database

    Hello friends,
    Consider this code snippet of mine:
    String sentence = "My name is nameless aka 'anonymous' or \"anonymous\" ('did I hear that? Maybe!! now where were we?') -\"yawn! Am bored..."; PreparedStatement statement = connection.prepareStatement("insert into tenonly(name) values('" + sentence + "')"); statement.executeUpdate();  // THIS IS LINE 38{code} And consider the stack trace: {code}init: deps-jar: Compiling 1 source file to /home/arthur/portal/MaintainTenEntries/build/classes compile: run: java.sql.SQLException: No value specified for parameter 1         at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910) DONE         at com.mysql.jdbc.PreparedStatement.fillSendPacket(PreparedStatement.java:1534)         at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1375)         at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1318)         at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1303)         at maintaintenentries.Main.main(Main.java:38) BUILD SUCCESSFUL (total time: 13 seconds){code} Could anyone please inform me of my  wrong turn? Thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Jamwa wrote:
    Hello friends,
    Consider this code snippet of mine:
    String sentence = "My name is nameless aka 'anonymous' or \"anonymous\" ('did I hear that? Maybe!! now where were we?') -\"yawn! Am bored...";
    PreparedStatement statement = connection.prepareStatement("insert into tenonly(name) values('" + sentence + "')");
    statement.executeUpdate();  // THIS IS LINE 38{code}Consider how you're misusing PreparedStatement. It escapes Strings properly for you, yet you aren't using it to do so.
    The right way is:
    {code}
    String sentence = "My name is nameless aka 'anonymous' or \"anonymous\" ('did I hear that? Maybe!! now where were we?') -\"yawn! Am bored...";
    PreparedStatement statement = connection.prepareStatement("insert into tenonly(name) values(?)");
    statement.setString(1, sentence);
    statement.executeUpdate(); // THIS IS LINE 38

  • Inserting special french characters into UTF8 database

    Hello ,
    we have a database of release 10.2.0.5.0 with the following NLS settings:
    PARAMETER
    VALUE
    NLS_CALENDAR
    GREGORIAN
    NLS_CHARACTERSET
    UTF8
    NLS_COMP
    BINARY
    NLS_CURRENCY

    NLS_DATE_FORMAT
    DD.MM.RR
    NLS_DATE_LANGUAGE
    GERMAN
    NLS_DUAL_CURRENCY

    NLS_ISO_CURRENCY
    GERMANY
    NLS_LANGUAGE
    GERMAN
    NLS_LENGTH_SEMANTICS
    BYTE
    NLS_NCHAR_CHARACTERSET
    AL16UTF16
    NLS_NCHAR_CONV_EXCP
    FALSE
    NLS_NUMERIC_CHARACTERS
    NLS_SORT
    GERMAN
    NLS_TERRITORY
    GERMANY
    NLS_TIME_FORMAT
    HH24:MI:SSXFF
    NLS_TIMESTAMP_FORMA
    DD.MM.RR HH24:MI:SSXFF
    NLS_TIMESTAMP_TZ_FORMAT
    DD.MM.RR HH24:MI:SSXFF TZR
    NLS_TIME_TZ_FORMAT
    HH24:MI:SSXFF TZR
    When executing a script including special french characters with SQL*Plus (or with a job of Cloud Control) the result in the database shows up wrong:
    e.g. FR R�au instead of  FR Réseau
    When checking the HEX-code of the special french characters in the script these are correct:
    é => E9
    Setting the environment variable NLS_LANG to FRENCH_FRANCE.UTF8 before executing the script does not make any difference at all.
    When checking the sign � in the string FR R�au with the dump function of SQL*Plus I get this result:
    Typ=1 Len=3 CharacterSet=UTF8: e9,73,65
    Seems to be OK - but why does it get displayed wrong? Is the client - in our case a application - responsible for the "how to display"?
    Any help will be appreciated!
    Rgds
    Jan

    Hi,
    If you have My Oracle support access I suggest to check one of following two documents:
    Oracle Metalink: The correct NLS_LANG in a Windows Environment Doc ID: 179133.1 
    Oracle Metalink: The correct NLS_LANG setting in Unix Environments Doc ID: 264157.1
    depending your env.
    Check your data using SQL Developer and see if it displays well. If yes your data is ok in db.

  • Problem inserting special Hungarian characters into db

    Hi,
    I've posted this question in the database connection forum
    but put it here too because I don't know where to fit better.
    I read that it would be the most straightforward way to do
    everything in UTF-8 because it handles well special characters so
    I've tried to set up a simple testing environment. Besides I use CF
    MX7 and my hosting provider creates the dsn for me so I think the
    db driver is JDBC but not sure.
    1.) In Dreamweaver I created a page with UTF-8 encoding set
    the Unicode Normalization Form to "C" and checked the include
    unicode signature (BOM) checkbox. This created a page with the meta
    tag: <meta http-equiv="Content-Type" content="text/html;
    charset=utf-8" />. I've checked the HTTP header with an online
    utility at delorie.com and it gave me the following info:
    HTTP/1.1, Content-Type: text/html; charset=utf-8, Server:
    Microsoft-IIS/6.0
    2.) Then I put the following codes into the top of my page
    before everything:
    <cfprocessingdirective pageEncoding = "utf-8">
    <cfset setEncoding("URL", "utf-8")>
    <cfset setEncoding("FORM", "utf-8")>
    <cfcontent type="text/html; charset=utf-8">
    3.) I wrote some special Hungarian chars
    (<p>őű</p>) into the page and they displayed
    well all the time.
    4.) I've created a simple MySQL db (MySQL Community Edition
    5.0.27-community-nt) on my shared hosting server with phpMyAdmin
    with default charset of UTF-8 and choosing utf8_hungarian_ci as
    default collation. Then I creted a MyISAM table and the collation
    was automatically applied to my varchar field into wich I stored
    data with special chars. I've checked the properties of the MySQL
    server in MySQL-Front prog and found the following settings under
    the Variables tab: character_set_client: utf8,
    character_set_connection: utf8, character_set_database: latin1,
    character_set_results: utf8, character_set_server: latin1,
    character_set_system: utf8, collation_connection: utf8_general_ci,
    collation_database: latin1_swedish_ci, collation_server:
    latin1_swedish_ci.
    5.) I wrote a simple insert form into my page and tried it
    using both the content of the form field and a hardcoded string
    value and even tried to read back the value of the
    #FORM.special_char# variable. In each cases the special Hungarian
    chars changed to "q" or "p" letters.
    Can anybody see something wrong in the above mentioned or
    have an idea to test something else?
    I am thinking about to try this same page against a db on my
    other hosting providers MySQL server.
    Here is the to the form:
    http://209.85.117.174/pages/proba/chartest/utf8_1/form.cfm
    Thanks, Aron

    Some new info about the advancements in my project:
    I've tried to make the insertion at a third hosting
    provider's MySQL server with my 'everything is UTF-8' test case and
    IT'S DONE! There are my lovely spec chars :-)
    Then I've checked the char encoding according -Per's tip in
    all of my so far used test MySQL dbs and it reported that
    'CHARSET=utf8 COLLATE=utf8_hungarian_ci' so this part seems to me
    OK.
    I asked my hosting provider where my production app should
    run about the db driver and they told it's JDBC (what version of
    Jconnect still donno') and they are ready to append
    &characterSetResults=UTF-8 to the JDBC url connection string
    (somebody told this tip also as a possible soultion) but they asked
    me to provide the complete connection string to be used for my
    datasource. I've tried to compose it in my localhost development
    environment in ColdFusion Admin but it gave me a Connection
    verification failed error. So I think I did something wrong and
    need help to write the correct connection string that can be passed
    to the hosting provider. So the connection string structure I tried
    to use in the JDBC URL field of the datasource area of CFAdmin is
    something like this:
    jdbc:mysql://someipaddresshere/mydbname&characterSetResults=UTF-8
    How can it be corrected?
    Thanks, Aron

  • Inserting new table data into database

    Hi, im trying to find out if i can insert a row of data into a mdb table. basically i have a List of Client objects for an application, and im iterating through this list. Now i take out an object and my aim is to place the details of that Client into the relevant cells in the database. But, it is giving me a "General error" exception. Here is my code...
    Iterator i = listOfClients.iterator();
    while(i.hasNext()){
    Client c = (Client)i.next();//get the client object
    if(c!=null){
    st.executeUpdate("INSERT INTO CLIENTS("+
    "CLIENT_NO,"+
    "CLIENT_NAME,"+
    "CLIENT_DESC,"+
    "CLIENT_ADDRESS,"+
    "CLIENT_PHONE,"+
    "CLIENT_EMAIL,CLIENT_NOTES) "+
    "VALUES('"+c.getClientNumber()+
    "','"+c.getClientName()+
    "','"+c.getClientDescription()+
    "','"+c.getClientAddress()+
    "','"+c.getClientTelephone()+
    "','"+c.getClientEmail()+
    "','"+c.additionalNotes+"')");
    Can someone please tell me where the error is in this sql statement, im really gettin agitated.
    thanx

    dw i fixed it using that PreparedStatement class.

  • How to insert large xml data into database tables.

    Hi all,
    iam new to xml. i want to insert data in xml file to my database tables.but the xml file size is very large. performance is also one of the issue. can anybody please tell me the procedure to take xml file from the server and insert into my database tables.
    Thanks in advance

    Unfortunately posting very generic questions like this in the forum tends not to be very productive for you, me or the other people who read the forum. It really helps everyone if you take a little time to review existing posts and their answers before starting new threads which replicate subjects that have already been discussed extensively in previous threads. This allows you to ask more sensible questions (eg, I'm using this approach and encountering this problem) rather than extremely generic questions that you can answer yourself by spending a little time reviewing existings posts or using the forum's search feature.
    Also in future your might want to try being a little more specific before posting questions
    Eg Define "very large". I know of customers who thing very large is 100K, and customers who think 4G is medium. I cannot tell from your post what size your files are.
    What is the content of the file. Is it going to be loaded into a single record, or a a single table, or will it need to be loaded into multiple records in a single table or multiple records in multiple tables ?
    Do you really need to load the data into exsiting relational tables or could your application work with relational views of the XML Content.
    Finally which release of the database are you working with.
    Define performance. Is it reasonable to expect to process this kind of document on this machine (Make, memory, #number of CPUs, CPU Speed, number of discs) in this period of time.
    WRT to your original question. If you take a few minutes to search this forum you will find a very large number of threads with very similar titles to yours. These theads document a number of different approaches that can be used to solve this problem.
    I suggest you start by looking for threads that cover topics like DBMS_XMLSTORE, XMLTable(), Relational Views of XML content, loading XML content in relational tables.

  • Exception when inserting a XML document into database

    Hello.
    I'm trying to insert the content of a XML document into a database. The problem consists on the exception that is raised when a FK in the XML is not in the database as a PK
    How can i catch these exceptions and continuing inserting the rest of the data
    Thanks in advance ...

    I really hope for you this wasn't a production database, as mentioned in the URL, it has been some years ago for me fiddling around this which was btw a supported metalink workaround ONCE (during my Oracle 7 days), but now, I wouldn't be surprised if you now have mixed NLS content in your tables/database and more or less "corrupted" your content.
    The initial issue was probably a client one.
    BTW
    I actually hope it was a production database, maybe then you would learn that way, that you SHOULD NEVER EVER UPDATE DATABASE BASE TABLES directly...
    ...unless (the only exception) you want to learn something about the internals and don't care that your TEST database gets corrupted....

  • Insert large Image object into Database

    Hello
    I have a large (!MB) image which needs to be stored in a database BLOB column, and I'm running out of memory with my naive code..
    Nothing other than the code is within my control. I cannot change my heap size; I have no file-system, so cannot write the image.
    The awt.Image is created and drawn elsewhere in the application. My thought was to create a byte stream and have that inserted chunk-by-chunk, but I just can't find out how to do this in a limited time.
    Any help would be much appreciated.
    Lee

    leegee23 wrote:
    Thanks for your help. Have tried this:
    ImageInputStream is = ImageIO.createImageInputStream(gif);But got null. The docs read:
    Returns an ImageInputStream that will take its input from the given Object. The set of ImageInputStreamSpis registered with the IIORegistry class is queried and the first one that is able to take input from the supplied object is used to create the returned ImageInputStream. If no suitable ImageInputStreamSpi exists, null is returned.
    Am I barking up the wrong tree?I think you're on the right track. A quick browse found that an ImageWriter (GIFImageWriter) can be used to write an image to an output stream (use ImageIO.createImageOutputStream()), and then you can probably use PipedInputStream/PipedOutputStream to obtain an inputStream that you can pass to your JDBC driver to store the blob.
    That's just from reading Javadocs though, I'm not sure how to connect the dots.
    And also, make sure you post a reference to this thread on the new one you created. You wouldn't want people to waste time answering that thread if there's an answer here already, or vice versa.
    Edit: I was thinking specifically of using a GifImageWriter constructed with a OutputStreamImageOutputStreamSpi that was passed in a PipedOutputStream which you would in turn connect to a PipedInputStream which you would pass in to the JDBC method.
    But I'm not sure, it looks like even then it either uses a memory cache or a file cache. When you have compression, the writer will typically need to have access to all the bytes of the image before starting to write. It would be a two-pass algorithm, most likely. Which basically means you might have memory issues anyway.
    Edited by: endasil on 22-Sep-2009 1:12 PM

  • How to Insert check box value into database column

    Hi All,
    I had checkbox group in a region which is using an LOV......and having 18 items in that lov.
    i.e. Total 18 checkboxes in Total. User has to select only 2 checkboxes from that 18.
    I created two columns for storing two values of checkboxes. How to insert two selectives in two columns.........Moreover, How to give the query i.e. how to know which values are selected.
    Please Help me in achieving this. apart from the two columns (Focus1,Focus2) .......One more column(l_spo_val) is there which is a foreign key.
    My Insert Statement is like this:
    INSERT INTO SPO_RESEARCH_FOCUS VALUES(l_spo_val
    ,:P4_RESEARCH_LIST_1
                        ,:P4_RESEARCH_LIST_2);
    Please narrate the code if possible.
    Thanks,
    Sekhar.

    Hi Denes,
    I saw the example in your workspace and it is the same what exactly i want and instead of storing in one column i want to store the two selected values into two different columns. Also i need to restrict the selection of checkboxes upto 2 only. So If the user tries to select the third check box it doesnt have to accept.
    Even I am ready to change my table as according to your example i.e. creating only one column. Store the values of selection into that column.
    I was unable to see how u wrote the logic (Code) for your example in your workspace. It helps alot if you provide me the code for that example(Multi Checkbox One Column).
    I was facinated after watching your examples in your workspace and am very much interested to know more about Apex.
    Please help me insolving this as it is long pending issue for my requirement.
    Thanks a lot again,
    Sekhar.
    Edited by: Sekhar Nooney on Mar 26, 2009 4:35 AM

  • Store big5 characters in database using JDBC

    The key point is the character set of database.
    Try character set 'WE8ISO8859P1'
    Good Luck.
    null

    Thanks for ur help:
    another Q:
    in my GUI i have a button called Insert. but can't update my database table unless i create textField(e.g Firstname, Surname..ect..), so that when I click Insert button in actionEvent it will bring up popup which have field name in which i am going to insert new records.
    so what iam trying to say is, how iam going to tell the actionEvent to trigger this.
    the following is my code
    public void actionPerformed(ActionEvent event)
    ExamResults exam= new ExamResults ();      
    String studentId = studentTextField.getText();
    if (event.getSource() == insert) //if insert is clicked
    Thanks

  • Need help on inserting multiple selection values into database

    Hello every body,
    we are developing one small web application in that we have requirement like department is an combobox, services in multiple selection list box, suppose when i select IT as department & some services in multiple listbox on clicking map button selected services should be map with that department .Could u plz help me how i have to do..?
    Thanks & Regards,
    Anil.

    anilmekala.reddy wrote:
    Hello every body,
    we are developing one small web application in that we have requirement like department is an combobox, services in multiple selection list box, suppose when i select IT as department & some services in multiple listbox on clicking map button selected services should be map with that department .Could u plz help me how i have to do..?
    Thanks & Regards,
    Anil.if you give more details .... do you know how to use jdbc ??? prepared statement ???
    any way if I have understood your question
    I will suppose that you have 3 tables Department ,service and Has_service
    and I supose that you have already the entry in table department and service
    Here is what I would do ...
    while(I have something to insert )
       insert into Has_service values (department,service )
    }

Maybe you are looking for