Dear Friends,

I a working on a project where i have to let the user to type in other languages(hindi,tamil,kannada etc..) and i have to store into the database and retrive it back and show it to the client in the same language he has entered..I am using postgres 8.0 for storing the data. When i tried to store the data's its storing in database as "ल�ि�प�िप�" and displaying it in the same manner...Can any one help me how to fix this..Thanks in advance

i use the following code to store


<input type="button" name="but1" value="<%=session.getValue("main.Bok")%>" onClick="callSearch()">

function callSearch()
     var f = document.forms[0];//("myform");
	 var semiCol = ":";
     var Name = document.myForm.Name.value;
     var Company = document.myForm.Company.value;
	 var DOB = document.myForm.DOB.value;
	 var Age = document.myForm.Age.value;

	// 	parent.document.getElementById("Local").src="jdbcConnection.jsp?Name="+Name+"&Company="+Company+"&DOB="+DOB+"&Age="+Age;
        alert("Name = "+Name);


        String szName=request.getParameter("Name");
		System.out.println("Name = "+szName);
		String szCompany=request.getParameter("Company");
    System.out.println("Company = "+szCompany);
		String szDOB=request.getParameter("DOB");
		System.out.println("DOB = "+szDOB);
        String szAge=request.getParameter("Age");
		System.out.println("Age = "+szAge);

			Connection conn;
			String szUrl;
			 System.out.println("Driver created");
			 conn = DriverManager.getConnection(szUrl,"postgres","password");
			 System.out.println("Connection created");
			 Statement sqlString1=conn.createStatement();
			 sqlString1.executeUpdate("INSERT INTO public.user values('"+szName+"','"+szCompany+"','"+szDOB+"','"+szAge+"')");
//sqlString1.executeUpdate("INSERT INTO public.user values('gfgfdg','gffdggf','gdfgdfg','gdfgdfg')");
			 System.out.println("Query executed....");
		}catch(Exception e){



Recommended Answers

All 3 Replies

Make sure your database/table is created with Unicode as the encoding. Refer the Postgresql forums/documentation for more details.

Also try getting the connection with the URL which also specifies the character set explicitly.


Thanks for the reply.. I have solved the Thread by changing the database version.. From 8.0 to 8.3(Supports UTF-8 encoding)

I have removed the function call search and changed the method

<form name="myForm" ID="Local" method="POST" action="jdbcConnection.jsp">

Now it is working fine...

DB connection from JSP is something which you should not do it. For better wait to communicate with DB see this post

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.