Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



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

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Fathi
insert arabic chacters in mysql via java
1 Answer(s)      4 years and 8 months 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.");
}

}
}

Advertisement
View Answers

June 23, 2011 at 1:15 AM


here is the solution , it's helpful

it's works with me



Related Tutorials/Questions & Answers:
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
Unable to Insert Arabic words in mysql table
Unable to Insert Arabic words in mysql table  I have I java program that I want to insert arabic letters in mysql. Do you have any idea about the configuration of mysql that accepts arabic charcters.   in jsp use
Advertisements
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
xml to html via java
xml to html via java  how to read xml into html using java code
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
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
insert images into a Mysql database
insert images into a Mysql database  How can I insert images into a Mysql database
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
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
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
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
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
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
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
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
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 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
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
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
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
send sms from pc to mobile via gsm modem connected to pc in java
send sms from pc to mobile via gsm modem connected to pc in java  pls send me the code to send sms from pc to mobile via GSM modem programmed in JAVA
language conversion from english to arabic in a struts project
language conversion from english to arabic in a struts project  how to convert struts project to arabic language from english language without using... also into english language from arabic language   Please visit
what is the charset value to supprot arabic language ?
what is the charset value to supprot arabic language ?  Hi, In my project i have a XLS dowload option to store content in Excel file Here the problem is i have to diplay combination of English and Arabic language, the Arabic
insert multiple selection - Java
insert multiple selection - Java  how to insert multiple selection values from html into database using servlets
Uploading Excel sheet record in JSP to insert data in MySql
Uploading Excel sheet record in JSP to insert data in MySql  Need Help how to upload Excel (.xls) file and insert data in Mysql using JSP it wil be wonder for me if any help me
Query to insert values in the empty fields in the last row of a table in Mysql database?
Query to insert values in the empty fields in the last row of a table in Mysql database?  I have some fields filled and some fields empty in the last row of my MYSQL database. Now I want to fill up those empty fields in the last
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
insert name city image in database using mysql and jsp
insert name city image in database using mysql and jsp  how to insert name ,city and image in database in mysql and jsp   Here is an example in jsp that insert name, city and image to database. <%@ page import
Advertisements
 

 

 

DMCA.com