devxlogo

Insert Multi-Lingual Characters in JDBC

Insert Multi-Lingual Characters in JDBC

This method allows you to insert multi-lingual characters into an Oracle database. In this tip, the column type is varchar2. The multi-lingual string is converted to its unicode value and a special character is inserted between the characters. The following code demonstrates:

 import java.sql.*;import java.util.*;public class MultiLang{ String value=""; Connection con; Statement sat; public MultiLang() {   try     {       Class.forName("oracle.jdbc.driver.OracleDriver");con=DriverManager.getConnection("jdbc:oracle:thin:@ip:port:servername","uid","pass");       sat=con.createStatement();       String s="some multi-lingual string";       for(int i=0;i

devx-admin

Share the Post: