Hello:
I want to insert international characters (latin1, iso8859-1, accents, �,
etc). I can do it directly but when I tri to do it with the driver I got
a ? in place of every accented character. For instance, the output of the
attached program is this:
Column 1: prueba3333
Column 2: Ni?os del ca??n
I'm compiling with the javac's flag '-encoding latin1' and it works,
except for the string retrieved from the data base.
What should I do?
Thank you in advice for any help.
Please reply to my address, I am not yet suscribed to this list.
--
Alejandro Aguilar Sierra
[EMAIL PROTECTED]
Import java.sql.*;
public class Test2 {
public static void main(String args[]) {
String url = "jdbc:postgresql://249.1.16.8/giga";
Connection con;
String query = "select version_ver, campania_ver from VERSIONES "+
"where version_ver like 'prueba3333'";
String update = "update VERSIONES set campania_ver = 'Ni�os del ca��n' "+
"where version_ver like 'prueba3333'";
Statement stmt;
System.out.println("Test2, update: "+update+"\n");
try {
Class.forName("org.postgresql.Driver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundExceptionx: ");
System.err.println(e.getMessage());
}
try {
con = DriverManager.getConnection(url,
"store", "xk8yta2");
stmt = con.createStatement();
stmt.executeUpdate(update);
ResultSet rs = stmt.executeQuery(query);
ResultSetMetaData rsmd = rs.getMetaData();
int numberOfColumns = rsmd.getColumnCount();
int rowCount = 1;
System.out.println("Columnas "+ numberOfColumns+ "\n");
while (rs.next()) {
System.out.println("Row " + rowCount + ": ");
for (int i = 1; i <= numberOfColumns; i++) {
System.out.print(" Column " + i + ": ");
System.out.println(rs.getString(i));
}
System.out.println("");
rowCount++;
}
stmt.close();
con.close();
} catch(SQLException ex) {
System.err.print("SQLException: ");
System.err.println(ex.getMessage());
}
}
}
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?
http://www.postgresql.org/search.mpl