

<%@ page pageEncoding="ISO-8859-7"
contentType="text/html; charset=ISO-8859-7"
language="java"
import="java.sql.*"
import="java.util.*"
import="java.net.*"
errorPage=""
import="javax.sql.*"
%>
<%
String paramEncoding = application.getInitParameter("PARAMETER_ENCODING");
request.setCharacterEncoding(paramEncoding);
out.println("
paramEncoding = "+paramEncoding+"
");
%>
<%! String greekIsoStringConvertToByte(String gIsoString) throws java.io.UnsupportedEncodingException {
byte [] bytes = new byte[gIsoString.length()];
for (int i = 0; i < gIsoString.length(); i++) { bytes[i] = (byte) gIsoString.charAt(i); }
return new String(bytes, "ISO-8859-7");
}
byte [] getByteesFromParam(String gIsoString) throws java.io.UnsupportedEncodingException
{
byte [] b = gIsoString.getBytes("ISO-8859-7");
return b;
}
%>
<%
String name = request.getParameter("n"); String sName = request.getParameter("e"); response.setCharacterEncoding("ISO-8859-7");
try {
String connectionURL="jdbc:mysql://localhost:3306/xx?requireSSL=false&useUnicode=false&characterEncoding=greek&characterSetResults=greek&connectionCollation=greekgeneralci";
//mysqlEncoding=greek&
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection connection = DriverManager.getConnection(connectionURL,"x","y");
Statement stmt = null ;
ResultSet result = null ;
if ( ( name != null ) && ( name !="undefined") && ( name != "" ) && ( sName != null ) && ( sName !="undefined") && ( sName != "" )) { String insertQuery="INSERT INTO dokimi (sid, names ) VALUES (?,?)";
//PreparedStatement pstmt = con.prepareStatement("UPDATE EMPLOYEES SET SALARY = ? WHERE ID = ?");
PreparedStatement ps = connection.prepareStatement(insertQuery);
try {
//String onoma = greekIsoStringConvertToByte(name);//.toUpperCase()
// out.println("onoma = "+onoma+"<br>");
ps.setInt( 1 ,0 ) ;
ps.setString( 2 ,greekIsoStringConvertToByte(name) );
int count = ps.executeUpdate();
out.println(count + "row(s) affected");
ps.close();
}catch (SQLException s)
{
out.println("<HR>prepareStatement(insertQuery) SQL statement is not executed!\n"+s);
out.println("<HR>SQLException: " + s.getMessage());
out.println(" <HR>SQLState: " + s.getSQLState());
}
//-----------------------------END ENTRIES @ SENDER ---------------------------------------------------
try {
String query = "SELECT * FROM dokimi ORDER BY sid";
//out.println("selectSender = "+selectSender);
stmt = connection.createStatement();
result = stmt.executeQuery(query );
out.println("<table>");
while(result.next()){ out.println("<tr><td>"+result.getInt(1)+"</td><td>" + result.getString(2) + "</td></tr>");}
out.println("</table>");
result.close();
stmt.close();
}
catch (SQLException s)
{
out.println("<HR> SELECT sid FROM dokimi ORDER BY sid SQL statement is not executed!\n"+s);
out.println("<HR>SQLException: " + s.getMessage());
out.println(" <HR>SQLState: " + s.getSQLState());
}
} }catch (SQLException s) { out.println("Unable to connect to database."+s); out.println("<HR>SQLException: " + s.getMessage()); out.println(" <HR>SQLState: " + s.getSQLState());
}
%>

Blockquote
<%@ page pageEncoding="ISO-8859-7"
contentType="text/html; charset=ISO-8859-7"
language="java"
import="java.sql.*"
import="java.util.*"
import="java.net.*"
errorPage=""
import="javax.sql.*"
%>
<%
String paramEncoding = application.getInitParameter("PARAMETER_ENCODING");
request.setCharacterEncoding(paramEncoding);
out.println("
paramEncoding = "+paramEncoding+"
");
%>
<%! String greekIsoStringConvertToByte(String gIsoString) throws java.io.UnsupportedEncodingException {
byte [] bytes = new byte[gIsoString.length()];
for (int i = 0; i < gIsoString.length(); i++) { bytes[i] = (byte) gIsoString.charAt(i); }
return new String(bytes, "ISO-8859-7");
}
byte [] getByteesFromParam(String gIsoString) throws java.io.UnsupportedEncodingException
{
byte [] b = gIsoString.getBytes("ISO-8859-7");
return b;
}
%>
<%
String name = request.getParameter("n"); String sName = request.getParameter("e"); response.setCharacterEncoding("ISO-8859-7");
try {
String connectionURL="jdbc:mysql://localhost:3306/xx?requireSSL=false&useUnicode=false&characterEncoding=greek&characterSetResults=greek&connectionCollation=greekgeneralci";
//mysqlEncoding=greek&
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection connection = DriverManager.getConnection(connectionURL,"x","y");
Statement stmt = null ;
ResultSet result = null ;
if ( ( name != null ) && ( name !="undefined") && ( name != "" ) && ( sName != null ) && ( sName !="undefined") && ( sName != "" )) { String insertQuery="INSERT INTO dokimi (sid, names ) VALUES (?,?)";
//PreparedStatement pstmt = con.prepareStatement("UPDATE EMPLOYEES SET SALARY = ? WHERE ID = ?");
PreparedStatement ps = connection.prepareStatement(insertQuery);
try {
//String onoma = greekIsoStringConvertToByte(name);//.toUpperCase()
// out.println("onoma = "+onoma+"<br>");
ps.setInt( 1 ,0 ) ;
ps.setString( 2 ,greekIsoStringConvertToByte(name) );
int count = ps.executeUpdate();
out.println(count + "row(s) affected");
ps.close();
}catch (SQLException s)
{
out.println("<HR>prepareStatement(insertQuery) SQL statement is not executed!\n"+s);
out.println("<HR>SQLException: " + s.getMessage());
out.println(" <HR>SQLState: " + s.getSQLState());
}
//-----------------------------END ENTRIES @ SENDER ---------------------------------------------------
try {
String query = "SELECT * FROM dokimi ORDER BY sid";
//out.println("selectSender = "+selectSender);
stmt = connection.createStatement();
result = stmt.executeQuery(query );
out.println("<table>");
while(result.next()){ out.println("<tr><td>"+result.getInt(1)+"</td><td>" + result.getString(2) + "</td></tr>");}
out.println("</table>");
result.close();
stmt.close();
}
catch (SQLException s)
{
out.println("<HR> SELECT sid FROM dokimi ORDER BY sid SQL statement is not executed!\n"+s);
out.println("<HR>SQLException: " + s.getMessage());
out.println(" <HR>SQLState: " + s.getSQLState());
}
} }catch (SQLException s) { out.println("Unable to connect to database."+s); out.println("<HR>SQLException: " + s.getMessage()); out.println(" <HR>SQLState: " + s.getSQLState());
}
%>
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.