Inserting Japanese characters to SQL Server via CFMX

What is necessary in the setup to save non-Latin characters
to SQL Server via CFMX form? The ColdFusion data source has the
Unicode option enabled (Enable Unicode for data sources configured
for non-Latin characters). The target field in the database is an
nvarchar. What else is necessary to properly insert and then later
display the non-Latin characters?
On Microsoft's site they describe the need to convert to and
from UCS-2 when accessing SQL Server via ASP. Is this type of
conversion relevant to CFMX?

jegrubbs wrote:
> What is necessary in the setup to save non-Latin
characters to SQL Server via
> CFMX form? The ColdFusion data source has the Unicode
option enabled (Enable
> Unicode for data sources configured for non-Latin
characters). The target field
> in the database is an nvarchar. What else is necessary
to properly insert and
> then later display the non-Latin characters?
- define db columns as "N" types
- ensure cf pages are utf-8 encoding:
--tag the files w/a BOM
--use
<cfprocessingDirective pageencoding="utf-8">
on each page
--use
<cfset setEncoding("form","utf-8")>
<cfcontent type="text/html; charset=utf-8">
in application.cfm or .cfc
- when doing INSERT/UPDATE make sure to use either unicode
hinting (N'text') or
cfqueryparam (making sure to turn on the unicode option for
that DSN in
cfadmin). cfqueryparam is the best choice.
also see:
http://www.sustainablegis.com/unicode/greekTest.cfm
> On Microsoft's site they describe the need to convert to
and from UCS-2 when
> accessing SQL Server via ASP. Is this type of conversion
relevant to CFMX?
nope the JDBC driver will handle that gruff. make sure you
use the JDBC driver
(name as ms sql server in cfadmin) and NOT the odbc bridge
thnig.

Similar Messages

  • Problem with Connection to SQL Server via Servlet (in iPlanet 6 App Server)

    Hi ,
    I am using the iPlanet ApplicationServer 6.0 SP2 for development & testing of an internet application.
    I am facing a problem when I am trying to connect to MS SQL SERVER via the native jdbcodbc driver (obdc32.dll). The error is something like this :
    [26/Jul/2001 11:50:35:7] warning: DriverConnect: (28000): [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user '\'.(DB Error: 18456)
    [26/Jul/2001 11:50:35:7] warning: ODBC-027: CreateConn: failed to create connection [new connection]: DSN=fadd,DB=cashbook,USER=test,PASS=xxxxxxxxx
    [26/Jul/2001 11:50:35:7] error: DATA-108: failed to create a data connection wit
    h any of specified drivers
    Error in connecting to the Database for cirrus :java.sql.SQLException: failed to
    create a data connection with any of specified drivers
    java.sql.SQLException: failed to create a data connection with any of specified
    drivers
    at com.netscape.server.jdbc.Driver.afterVerify(Unknown Source)
    at com.netscape.server.jdbc.Driver.connect(Unknown Source)
    at com.netscape.server.jdbc.DataSourceImpl.getConnection(Unknown Source)
    at gefa.util.DBConnection.jdbcConnectionOpen(DBConnection.java:65)
    at gefa.servlet.ServUpload.doPost(ServUpload.java:45)
    at gefa.servlet.ServUpload.doGet(ServUpload.java:29)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
    Source)
    at com.netscape.server.servlet.servletrunner.ServletRunner.execute(Unkno
    wn Source)
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.thread.ThreadBasic.run(Native Method)
    at java.lang.Thread.run(Thread.java:479)
    I have configured a DSN with the name "fadd" on the machine with the application server and it used NT authentication. I have supplied an NT userid and password that has appropriate rights on the database "cashbook".
    When I write a java standalone program, it does connect but via a servlet it does not connect.
    Can some guide me with this problem please ?
    Anything one might have observed in the past ? (may be specific to iPlanet ?)
    Thanks a lot in advance
    ~Sunil

    I'm using iPlanet App server as well and experiencing similar problem. I load my SQL Server driver by Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"), then use DriverManager.getDriver() to obtain the Driver.
    However, the Driver returned is not the SQLServerDriver as expected. The Driver returned is com.netscape.server.jdbc.Driver! And then when I do Driver.getConnection("jdbc:microsoft:sqlserver://MyServer"), it throws an SQLException saying that it doesn't accept a jdbc:microsoft:sqlserver subprotocol. Well, of course it doesn't, it's not a microsoft Driver at all.
    I suspect the problem is that the netscape Driver's acceptsURL() method ALWAYS returns true in iPlanet app server, thus when you getDriver(), the netscape Driver is always returned (and always returned as the first one since it's default?). Thus even though the same piece of code works fine as a standalone application, it just doesn't work on iPlanet app server.
    My work around is:
    Class.forName("my.Driver");
    Enumeration enu = DriverManager.getDrivers();
    Driver useThis = null;
    while (enu.hasMoreElements()) {
    Driver d = (Driver)enu.nextElement();
    if (d.getClass().toString().indexOf("my.Driver") > -1) {
    useThis = d;
    Mind that my above code does not have an performance issue. If you look into the source code of how DriverManager get a Driver for a particular URL, it also loads the whole set of available Drivers, then call acceptsURL() method on each of them to find the first "suitable" one. Thus time complexity is the same.
    I know this is not a very elegant solution and it defeats the purpose of having a DriverManager. Does any one else has a better way to solve this problem, like a way to specify the priority of each Driver so that SQLServerDriver is returned before the netscape Driver?
    Thanks a lot.

  • How to "insert" current datetime in SQL Server

    I am having trouble converting current datetime into proper format that can be used to insert values in the SQL Server database.Among other things, I also tried SimpleDateFormat which does not recognise the month value of Date() object. I have been at this for a long time now and would really appreciate some assistance with this. Thanks in advance!!

    You can try TimeStamp object
    and setting the value like
    pstmt.setTimestamp( 1, timeStamp );

  • Official documents on escaping characters in SQL Server query statements

    Hi,
    Are there any official documents on how to escaping special characters in SQL Server query statements? I find a lot of online resources discussing about this, but there are no definitive conclusions on:
    Which characters should be escaped? (Some only said single-quote needs to be escaped, double-quote does not need. While others said both need to be escaped)
    How to escape characters? (Some said using two single-quote to escape a single-quote. Others said using a backslash, etc.)
    So I just wonder if there is an official document from Microsoft regarding this?
    Thanks
    Alan

    Depends on where you're using them
    If its string values then single quotes(') should be escaped by putting one more single quote before it.
    If its LIKE operator you can use ESCAPE keyword or use [] to escapre special characters 
    see
    http://visakhm.blogspot.in/2013/01/wildcard-character-based-pattern-search.html
    If inside SSIS expression you can escape characters like \ " etc by adding an extra \ before the characters
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Problem inserting date into MS SQL Server

    I am trying insert date into MS SQL Server database. First I used Statement and when I insert the date only date used to be inserted properly and the time used to be always 12:00:00 AM. I tried PreparedStatement and when I insert I get an error message:
    SQL Error: [Microsoft][ODBC SQL Server Driver]Optional feature not implemented
    I have attached the code.
    GregorianCalendar cal = new GregorianCalendar();
    java.util.Date dtm = (java.util.Date)cal.getTime();
    SimpleDateFormat formatOb = new SimpleDateFormat("dd/MM/yy hh:mm:ss");
    String date= (String)formatOb.format(dtm);
    dateCreated = new java.sql.Date(formatOb.parse(date).getTime());
    PreparedStatement psmt = con.prepareStatement("INSERT INTO Resume (ResumeName, Summary, Skills, OtherInformation, Interests, Memberships, Languages, Category, DateCreated, SupervisorName) VALUES(?,?,?,?,?,?,?,?,?,?)");
    psmt.setString(1, name);
    psmt.setString(2, summary);
    psmt.setString(3, skills);
    psmt.setString(4, info);
    psmt.setString(5, interest);
    psmt.setString(6, member);
    psmt.setString(7, language);
    psmt.setString(8, category);
    psmt.setDate(9, dateCreated);
    psmt.setString(10, loginName);
    psmt.executeUpdate();
    Any suggestions will be really helpful.

    Thanks,
    I changed the field in the database of DateCreated to timestamp, but when I insert the some binary data is inserted into the database. something like 0000000000000017D.
    I installed jtds-0.8.1 driver from source forge. but when try to connect to the database I get an error as:
    Connection refused: connect
    Error: Connection refused: connect
    I have attached the code for setting the driver and url also.
    private String driver = "net.sourceforge.jtds.jdbc.Driver";
    private String url = "jdbc:jtds:sqlserver://TEKKATTE:1433/placement;TDS=7.0";

  • Ident_Current('TableName') not giving last inserted identity Value in SQL Server 2012

    Hi ,
    Ident_Current('TableName') is not giving last inserted identity Value in SQL Server 2012. 
    Latest Value of ID and Ident_Current is differing for that particular table.  
    Why its happening? Ident_Current value is greater than last inserted ID.
    Please guide me why its happening?

    Here is one example:
    CREATE DATABASE PMCtest ON (NAME = 'PMCtest', FILENAME = 'B:\ProdDB-Unzipped\PMCtest.mdf', SIZE = 25GB )
    LOG ON (NAME = 'PMCtest_log', FILENAME = 'B:\ProdDB-Unzipped\PMCtest.ldf', SIZE = 2GB)
    CREATE TABLE identity_crisis (a int IDENTITY NOT NULL PRIMARY KEY,
                                  b sysname NOT NULL CHECK (b <> 'sysschobjs'))
    go
    INSERT identity_crisis (b) VALUES ('First name')
    INSERT identity_crisis SELECT name FROM sys.objects
    go
    SELECT MAX(a), ident_current('identity_crisis')
    FROM  identity_crisis
    go
    DROP TABLE identity_crisis
    Because the second INSERT statement fails, the identity values from 2 to 12 are lost. This is a very intentional design to promote high concurrency. If you don't want gaps, you should not use IDENTITY, but roll your own.
    Also, beware that ident_current returns database-wide value, so if you insert one row, and another process inserts another row before you interrogate ident_current, you will get the id for the row of the other process.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Migrating SybaseIQ to SQL Server via SSMA?

    Hi all,
    anyone who tried to migrate from Sybase IQ to SQL Server via SQL Server Migration Assistant (SSMA)? As from the product Website only Sybase
    ASE is officially supported. I'm looking especially for a way to migrate Stored Procs.
    BR Dirk

    Hi Dirk,
    Indeed, SQL Server Migration Assistant (SSMA) is a free supported tool from Microsoft that simplifies database migration process from
    Sybase ASE version 11.9 and higher to all editions of SQL Server 2005, SQL Server 2008, SQL Server 2008 R2, SQL Server 2012, and SQL Azure. If you want to migrate T/SQL Stored Procedures from Sybase IQ to SQL Server, maybe need to use the third-party
    tools, such as SQLWays or other tools.   
    There is a detail about SQLWays Tool, you can review the following article.
    http://www.ispirer.com/products/sybase-to-sql-server-migration
    Note: Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft
    cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and please be cautious and ensure you have completely understood
    the risk before retrieving any software from the Internet.
    Thanks,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • To Restrict SQL account from accessing Sql server via SSMS

    Hi All,
    We are planning to tighten the security of our SQL Server.
    In the initial phase, we want to restrict all the SQL accounts(except sa) from accessing SQL Server via SSMS
    Since the SQL passwords are used in the connection strings(plain text) of our .NET Applications, developers are able to see it and they are accessing SQL server through SSMS with the credentials in the connection string.
    The requirement is, SQL accounts should only be accessing the databases through .NET applications and not through any other applications like SSMS, SQLCMD...etc
    1) We tried "Logon Trigger", but later we came to know that there is security breach in it.
    2) Application Roles - Password is plain text, again back to square one.
    We are looking for an alternate. Please share some ideas.
    Thanks & Regards,
    K.P.Senthil Kumar

    The basic presumption here is that there is on way you can tie a connection to an application as such. There is app_name(), but since this is passed from the application, the application can call itself whatever you want.
    As long as it is only a matter of keeping business users out, you can solve the issue with some three-tiered solution. Either by having a true middle layer, or just having a web server, or the application running on Terminal Server or Citrix.
    But you want to keep the developers out who work with the code. That makes it difficult to lock them out of the middle layer.
    Then again, you say "our SQL Server" is that singular? Don't you have more than one SQL Server? One for developement, one for test and one for production? If you only want to keep the devs out from development, you have different usernames
    and password for different environments, and they are read from config files. The config files for production should be well-protected.
    By the way, only permitting sa from logging in from SSMS is bad idea. Rather, you should disable sa, and everyone should log in with their individual Windows account. And those who should perform system-administration tasks should be member of sysadmin.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Inserting Japanese Characters

    I am running Oracle 9.2 on a WIN2k m/c.
    I need to insert JAPANESE KANJI characters into my tables.
    1) Would like to know what are the setting required for the same.
    I would be pulling the data from remote SQL SERVER using OWB.
    Createad a SQL Server Transparent Gategway(tg4msql) to connect to the remote SQL Server.
    Current NLS Setting
    NLS_LANGUAGE     AMERICAN
    NLS_TERRITORY     AMERICA
    NLS_CURRENCY     $
    NLS_ISO_CURRENCY     AMERICA
    NLS_NUMERIC_CHARACTERS     .,
    NLS_CALENDAR     GREGORIAN
    NLS_DATE_FORMAT     DD-MON-RR
    NLS_DATE_LANGUAGE     AMERICAN
    NLS_CHARACTERSET     AL32UTF8
    NLS_SORT     BINARY
    NLS_TIME_FORMAT     HH.MI.SSXFF AM
    NLS_TIMESTAMP_FORMAT     DD-MON-RR HH.MI.SSXFF AM
    NLS_TIME_TZ_FORMAT     HH.MI.SSXFF AM TZR
    NLS_TIMESTAMP_TZ_FORMAT     DD-MON-RR HH.MI.SSXFF AM TZR
    NLS_DUAL_CURRENCY     $
    NLS_NCHAR_CHARACTERSET     AL16UTF16
    NLS_COMP     BINARY
    NLS_LENGTH_SEMANTICS     BYTE
    NLS_NCHAR_CONV_EXCP     FALSE
    2) How can i see/verify the inserted data using SQL-PLUS.
    Need your help in solving the same.
    TIA
    shankar

    Well I would assume that the first thing that is required is to run the db in utf8, which you are doing.
    So storing should be no problem. To display in SQL Plus I would suspect you need to set your NLS language to something that would "read" the utf8 character sets.
    I have not looked it up but I'm sure the RDBMS documentation will cover most of these topics extensively. Did you take a look at that doc set?
    Jean-Pierre

  • Retrieving Chinese Characters from SQL Server with JDBC

    Im having problems correctly recieving Simplified Chinese from the database (SQL Server 2000).
    Driver: sun.jdbc.odbc.JdbcOdbcDriver
    It seems that I cannot force the Results Set's getString(String s) method to the correct character encoding UTF-16. Java claims to have 16-bit characters but the native windows encoding cp1242 (somehting like that) seems to not be working for me.
    I can read it in from a unicode text file using the InputStreamReader object, and it will display correctly.
    All I ask is this: Has anyone successfully retrieved information from a database and displayed it correctly in a Swing application?
    Any help is welcome

    Thanks for the help.
    I was suspecting there was a problem with the driver. Microsoft's Driver worked perfectly for SQL 2000, but my target database is SQL 7 and the driver is not reverse compatible.
    I am looking for a Free liscenced JDBC driver that will work with SQL 7 (other than the sun.jdbc.odbc.JdbcOdbcDriver)
    Nothing fancy needs to be supported, just scrollable result sets, and basic insert, update, select, exec commands.

  • INSERTING DATA INTO A SQL SERVER 2005 TABLE, WHICH HAS A IDENTITY COLUMN

    Hi All,
    I have to insert the data into a SQL SERVER 2005 Database table.
    I am able to insert the data into a normal SQL Server table.
    When I am trying to insert the data into a SQL Server table, which has a identity column (i.e. auto increment column in Oracle) I am getting error saying that can't insert value explicitly when IDENTITY_INSERT is set to OFF.
    Had anybody tried this??
    There are some SRs on this issue, Oracle agreed that it is a bug. I am wondering if there is any workaround from any one of you (refer Insert in MS-SQL database table with IDENTITY COLUMN
    Thanks
    V Kumar

    Even I had raised a SR on this in October 2008. But didn't get any solution for a long time, finally I had removed the identity column from the table. I can't to that now :).
    I am using 10.1.3.3.0 and MS SQL SERVER 2005, They said it is working for MS SQL SERVER TABLE, if the identity column is not a primary key and asked me to refer to note 744735.1.
    I had followed that note, but still it is not working for me.
    But my requirement is it should work for a MS SQL SERVER 2005 table, which has identity column as primary key.
    Thanks
    V Kumar

  • INSERTing chinese characters in SQL*plus

    Db version: 10gR2
    NLS_NCHAR_CHARACTERSET for my DB is AL16UTF16 by which i can store chinese characters. To INSERT using SQL*Plus, i tried to copy and paste some chinese characters from internet. When the characters get pasted, it becomes '?????' (question marks). What else do i have to set to store Chinese characters?
    SQL>  CREATE TABLE EMP2
      2   (EMPNO NUMBER,
      3   ENAME NVARCHAR2(500));
    Table created.
    SQL> Insert into emp2(empno,ename) values(889,UNISTR('????'));
    1 row created.
    SQL> COMMIT;
    Commit complete.
    SQL> SELECT * FROM EMP2;
         EMPNO ENAME
           889 ????

    Actually, it looks like Forums do something strange to URLs pasted into posts. Sorry!
    The thread URL is Re: store/retrieve data in lang other than eng when CHARACTERSET is not UTF8

  • Japanese characters in SQL Developer  Version 1.5.4

    I am using SQL Developer ver 1.5.4 with Oracle 11g. There are Japanese characters stored in VARCHAR2 field.
    When I execute a SELECT SQL query, SQL Developer does not display Japanese characters in the Result window -- it displays row of small square characters instead.
    (When I execute the same query as a script -- it displays the Japanese characters in Script Output window,
    What should I do to have SQL Developer to display Japanese characters in Result window?
    Thank you!
    Mark.
    Edited by: MarcoPolo on Jul 7, 2009 11:16 AM

    Hi there, Have you fixed this issue?
    I'm having the same issue albeit with SQL Developer VERSION 1.5.5
    The Select stmt displays the the empty square boxes in the result window, I've set the encoding preferences to UTF8 in the menu and font to Arial Unicode (there is no option to set script to Japanese). How can i display japanese characters in the results window??
    When i export these empty square boxes in the result window to notepad (where encoding set to Unicode and Font set to Arial Unicode and Script to Japanese), the japanese value is displayed correctly in the notepad.
    Kindly provide some input
    Many Thanks

  • Insert to XE from sql server 2005 ...

    Hi,
    is it possible to create a trigger on Sql Server 2005 to insert a row to Oracle XE ?
    I want to create a update/insert trigger on sql server 2005 which will insert the data into a Oracle XE table.
    I have a Linked Servers in Sql Server to Oracle XE and this link works with simple sql statement from sql server like :
    INSERT INTO [NEW_OR]..[Adam_user].[DUMMY] (AA) VALUES('Dummy String Data')
    But the same statement does not work when in trigger. the following error occurs in Sql Server 2005...
    Msg 8501, Level 16, State 3, Procedure deneme, Line 5
    MSDTC on server 'Adam_user' is unavailable.
    Any suggestions?
    Thanks in advance.....
    Adam

    Here is the answer...
    May be useful for someone who needs the same solution ...
    The Distributed Transaction Coordinator service must be start on windows to accomplish the transaction ...
    For this:
    (on windows)
    START > SETTINGS > CONTROL PANEL > ADMINISTRATIVE TOOLS > SERVICES. Find the service called 'Distributed Transaction Coordinator' and RIGHT CLICK (on it and select) > Start.

  • How to insert to smalldatetime in sql-server

    hi
    i trying to insert date to smalldatetime in sql-server
    i try something like this:
    DateTime  transfer_date;
    transfer_date = DateTime.Now;
    SQL = "insert into MyTbl (DateT) values (transfer_date)";
    SqlCommand Cmd_SQL = new SqlCommand(SQL, Conn_SQL);
    Cmd_SQL.CommandText = SQL;
    Cmd_SQL.ExecuteNonQuery();
    but i got this error:
    The conversion of a varchar data type to a smalldatetime data type resulted in an out-of-range value. The statement has been terminated.

     I cannot test it right now but what is the value of transfer_date variable?
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

Maybe you are looking for