Home Answers Viewqa Java-Interview-Questions insert arabic chacters in mysql via java

 
 


Fathi
insert arabic chacters in mysql via java
1 Answer(s)      3 years and a month ago
Posted in : Java Interview Questions

Dear,

I have I java rpogram that I want to insert arabic letters in mysql.
Do you have any idea about the configuration of mysql that accepts arabic charcters.

I will send you the code:
package DBFin;

import java.sql.*;
import java.io.*;
import java.lang.Class;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Date;

public class in_concept
{
static public final String driver = "com.mysql.jdbc.Driver";

static public final String connection =
"jdbc:mysql://localhost:3306/test?user=root&password=1qaz0okm";

public static void main(String args[])
{
try
{
Class.forName(driver);
Connection con = DriverManager.getConnection(connection);

System.out.println("Jdbc Mysql Connection Url :");
System.out.println(connection);
System.out.println("Fathi");

ResultSet rs;
Statement stmt=con.createStatement(); //create a Statement object

try
{
String query = "select * from Mydocument";
//Statement s = connection.createStatement();
stmt.executeQuery (query);
rs = stmt.getResultSet();
while (rs.next ())
{
//Add records into data list
System.out.println(rs.getString(1));
}
rs.close ();
stmt.close ();
}
catch(Exception e)
{
System.out.println("Exception is ;"+e);
}

con.close();

if (!con.isClosed())
{ con.close(); }

} catch (Exception e) {
e.printStackTrace();
}

try
{
Class.forName(driver);
Connection con = DriverManager.getConnection(connection);

//Record data in database
int ID = 95;

//this characters are arabic charcters
String DESC = "åäÏÓÉ ÇáÈÑãÌíÇÊ";

String Date_creation = "2010-04-26";

// declare object of Statement interface that uses for executing sql statements.
PreparedStatement ps = null;

int updateQuery = 0;

String query = "INSERT INTO mydocument VALUES (?, ?, ?)";

ps = con.prepareStatement(query);
ps.setInt(1, ID);
ps.setString(2, DESC);
ps.setString(3, Date_creation);

updateQuery = ps.executeUpdate();

if (updateQuery != 0)
System.out.println("Data is inserted successfully in database");

// close all the connections.
ps.close();
con.close();
}
catch (Exception ex)
{
System.out.println("Unable to connect to batabase.");
}

}
}
View Answers

June 23, 2011 at 1:15 AM


here is the solution , it's helpful

it's works with me









Related Pages:
insert arabic chacters in mysql via java - Java Interview Questions
insert arabic chacters in mysql via java  Dear, I have I java rpogram that I want to insert arabic letters in mysql. Do you have any idea about the configuration of mysql that accepts arabic charcters. I will send you
How to load Arabic csv to MYSQL
How to load Arabic csv to MYSQL  I tried the following set session collation_database=utf8_general_ci; set session character_set_database=utf8... BY ',' LINES TERMINATED BY '\r\n' ; but the arabic columns still appears
Accessing database with JDBC via Java
Accessing database with JDBC via Java  How to access a database with JDBC via Java application?   Accessing database with JDBC through Java JDBC Example to access Database import java.sql.*; public class JdbcConnect
Export data in excel sheet via Browse and upload button into mysql database
Export data in excel sheet via Browse and upload button into mysql... the information from it in mysql database's Table Am using struts2,hibernate for making the Java web-application
xml to html via java
xml to html via java  how to read xml into html using java code
jdbc insert
jdbc insert  Hi , i want to insert a declared integer variable into a mysql table through jdbc. how to insert that. help me with query... thanks in advance   Here is a java code that connects to database and create
Mysql Insert
Mysql Insert       Mysql Insert is used to insert the records or rows to the table. Understand with Example The Tutorial illustrate an example from 'Mysql Insert'.To grasp
insert images into a Mysql database
insert images into a Mysql database  How can I insert images into a Mysql database
how to insert and retrieve an image from mysql using java - Java Beginners
how to insert and retrieve an image from mysql using java  how to insert and retrieve an image from mysql using java?  Hi friend, Code to insert image using java : import java.sql.*; import java.io.*; class
insert query in mysql
insert query in mysql  insert query in mysql not working   [INSERT INTO Birthdays(firstname, lastname, birthday, group) VALUES('Sam','Smith','June','Junior
Insert Mysql Blob data
Insert Mysql Blob data   In this section, we will discuss about how to insert a blob data into a database table. A Blob stores a binary large... value. Blob was added to java in jdk1.2 . The Method defined in "
Insert a row in 'Mysql' table using JSP Code
Insert a row in 'Mysql' table using JSP Code In this section, we will discuss about how to insert data in Mysql database using JSP code. Query...; Mysql database Table. Code to insert row in Mysql table : databaseinsertion.jsp
mysql-java
mysql-java   i try to execute this code stmt1.executeUpdate("insert... the manual that corresponds to your MySQL server version for the right syntax to use...) at Mydb.main(Mydb.java:111) Java Result: 1 please help me to find the error  
A Java Program That Prints Out Result Via Printer
A Java Program That Prints Out Result Via Printer  A Java Program That Prints Out Result Through Printer Depending upon paper size , and print the calculated result on printer and save result as text file
How to insert clob data??
How to insert clob data??  Can any one tell me in details how... to insert more than 4000 characters.I have heard that clob fields can hold 4 gb... pl/sql blocks and statements.I want to insert value of a textarea into clob
insert excel sheet into mysql as a table
insert excel sheet into mysql as a table  sir, i want to import an excel sheet into mysql5.0 database as in the table format using tomcat 6.0 by jsp
java with mysql
java with mysql  Hi, Here is my code: import java.awt.*; import...=DriverManager.getConnection("jdbc:mysql://localhost:3306/student","root","root...` VARCHAR(20) NOT NULL)"; con=DriverManager.getConnection("jdbc:mysql
Mysql Multiple Date Insert
Mysql Multiple Date Insert       Mysql Multiple Column Insert is used to add or insert... illustrate an example from 'Mysql Multiple Column Insert'.To understand
Insert into table using Java Swing
INSERTION IN TABLE USING SWING In this section, We will insert rows into "Mysql" database using "Swing". What is Swing? Swing...:mysql://192.168.10.13:3306/ankdb","root","root");  
Image in mysql
Image in mysql  Hi. How to insert and retrieve images in mysql db using JSP or JAVA Servlet? Thanks in advance
Mysql Multiple Date Insert
Mysql Multiple Date Insert       Mysql Multiple Column Insert is used to add or insert... illustrate an example from 'Mysql Multiple Column Insert'. To understand an example
how insert multiple images in mysql database with use of struts 1.3.8 or java method, with single bean,or using array
how insert multiple images in mysql database with use of struts 1.3.8 or java method, with single bean,or using array  i am using netbeans 7.0 ,with struts 1.3.8 and i want to insert multiple images in mysql database ,with use
EJB Insert data
.style1 { color: #FFFFFF; } EJB Insert data... describes you the way  to insert data into the database using EJB. The steps... a java source file which contain the bean implementation logic. String 
MySQL PHP Insert
MySQL PHP Insert       Mysql PHP Insert is used to execute the Mysql function ( ) insert.... Understand with Example The Tutorial illustrate an example on MySQL PHP Insert
Insert and Retrieve Image - JSP-Servlet
Insert and Retrieve Image  Hello, I need source code using java servlet or jsp and html form and brief explanations on how to insert and retrieve image from Microsoft sql database 2000 not Mysql please as sent to me earlier
mysql jsp - Java Beginners
mysql jsp  how to insert values to mysql? i want to insert values from a combo box to mysql... how to perform that. pls help me in urgent.  Hi friend, Plz give full source code where you having the problem
Remember me on this computer (via cookies) in jsp servlet
Remember me on this computer (via cookies) in jsp servlet  Remember me on this computer (via cookies) in jsp servlet   Hi, Here... of setting the cookies: <%@ page language="java" import="java.util.*"%> <
Mysql Trigger After Insert
Mysql Trigger After Insert       Mysql Trigger After Insert fired the trigger after you... The Tutorial illustrate an example from Mysql Trigger After Insert. To understand
jsp, mysql - Java Beginners
jsp, mysql  i want to store / insert the selected value in the combo box (jsp), into the mysql. how to do it?... pls help me in urgent
MySQL random
MySQL random       In MySQL we can get the random records by using the method RAND() of MySQL...` */ insert into `mca`(`id`,`name`,`subject`) values (1,'Amit
mysql
you need to download the mysql-connector jar file for connecting java program from mysql database.......   Hi friend, MySQL is open source database... is the link for the page from where you can understand how to Download and Install MySQL
insert and retrive data and time - SQL
insert and retrive data and time  hello everybody . Is there any method in java so that we can insert current system time and then it can... default NULL, PRIMARY KEY (`id`) ) To insert current date and time
JDBC: Insert Records Example
connection with specific databases like: MySQL, Ms-Access, Oracle etc and java files...JDBC: Insert Records Example In this section, you will learn how to insert records to the table using JDBC API. Insert Records : After creating table you
mysql with jsp - Java Beginners
mysql with jsp  i wanted to insert a combo box value to mysql table usgin jsp. how to perform that. can anybody help me in urgent.  Hi friend, Code to help in solving the problem : Select
java code to insert select at run time....????
java code to insert select at run time....????  java database code to retrieve data at runtime and please give codes for insert delete too.... using...;/th></tr> <% Connection con = null; String url = "jdbc:mysql
mysql query
mysql query  how do transfer into the excel data to my sql  ... the mysql connection in your php and store the list values inside the mysql database using the loops. For more illustration, we are providing you java example
how to insert the selected item of combobox in mysql - XML
how to insert the selected item of combobox in mysql  hi, i have to insert the selected item from combobox into MYSQL database.pls provide... of combobox in mxml.how to insert selecteditem in database. pls suggest me i have
jsp and mysql
the user to select from drowndown list and insert that value into database. 1...;option value="C#">C#</option> <option value="Java">Java<...").newInstance(); Connection con = DriverManager.getConnection("jdbc:mysql
JSP Radio Button MySQL insert - JSP-Servlet
JSP Radio Button MySQL insert  Hi, I have an HTML form which has... with select lists. I have created a servlet to connect to MySQL database... with the code to store radio button data and checkbox data to MySQL table. For example
Creating an Encyclopedia using Java & mySQL 5 - Java Beginners
Creating an Encyclopedia using Java & mySQL 5  Dear Editor, I'm very impressed of your Java tutorial website. I'm take up advance JAva... as i need to applied the Java skill to my company. I got a problem of doing
About MYSQL
About MYSQL  is it possible to upload the video on mysql database   1)page.jsp: <%@ page language="java" %> <HTML> <... connectionURL = "jdbc:mysql://localhost:3306/test"; ResultSet rs = null
image stored in mysql
image stored in mysql   how does an image store in mysql using java. gime an exam. code. thanks..   Insert Image in MySQL
Unwanted characters instead of arabic characters
Unwanted characters instead of arabic characters  I am using... and using it to display. the problem is: I need to display some arabic characters here... صÙ?Ù?دÙ?Ù?Ø© سÙ?Ù?د Ù?Ù?Ù?Ù?Ù?أرب like characters instead of arabic
Hibernate insert Query
Hibernate insert Query In this tutorial you will learn about how to use HQL insert query. INSERT query in HQL is used to insert the records into the database table. INSERT query of HQL is just like the INSERT query used in SQL
send sms from pc to mobile via gsm modem in java
send sms from pc to mobile via gsm modem in java  pls send me the code to send sms from pc to mobile via GSM modem programmed in JAVA........ can u pls help me to retrieve message from mobile to java program... import
insert multiple selection - Java
insert multiple selection - Java  how to insert multiple selection values from html into database using servlets
insert data
insert data  i've got a problem to insert my data to database.i can... =DriverManager.getConnection("jdbc:mysql://localhost:3306/test","...("insert into images values(?,?,?,?,?)"); st.setString(2
insert data into mysql databse using swing
insert data into mysql databse using swing   Blockquote hi, here is my code, i want code for store data into mysql database when click on submit button from access data from this form, please provide code, import java.awt.
insert name city and upload image in database using mysql and jsp
insert name city and upload image in database using mysql and jsp   insert name city and upload image in database using mysql and jsp
Insert data in mysql database through jsp using prepared statement
Insert data in mysql database through jsp using prepared statement... this java code you need to paste a .jar file named mysql connector.jar...; This is detailed jsp code that how to insert data into database by using prepared statement

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.