Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
"jdbc:mysql:///" + dbname +
"?requireSSL=false&useUnicode=true&characterEncoding=UTF-8",
"root", "");
String sqlStatement = "CREATE TABLE p_" + string_packageName + " (id INT(7), source_language VARCHAR(50) character set utf8 NOT NULL, destination_language VARCHAR(50) character set utf8 NOT NULL, index(id), unique(id)) DEFAULT CHARSET=latin1";
int int_words = server_getWordsCount(string_databaseName, string_packageName);
String[][] string_entries = new String[int_words][3];
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/" + string_databaseName + "?requireSSL=false&useUnicode=true&characterEncoding=UTF-8", "root", "txtaux");
Statement statement = connection.createStatement();
String sqlStatement = "SELECT id, source_language, destination_language FROM " + string_packageName;
ResultSet resultset = statement.executeQuery(sqlStatement);
for(int i = 0; i < int_words; i++) {
resultset.next();
int int_id = resultset.getInt("id");
String source_language = resultset.getString("source_language");
String destination_language = resultset.getString("destination_language");
string_entries[i][0] = int_id+"";
string_entries[i][1] = source_language;
string_entries[i][2] = destination_language;
}
return string_entries;
mysql> create table unicodetest(id int, name varchar(32)) DEFAULT CHARSET=utf8;
Query OK, 0 rows affected (0.16 sec)
/**
* created on 26.02.2005@17:14:01
*/
package de.tutorials;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;
/**
* @author Administrator
*
*/
public class MySQLUnicodeTest {
/**
* @param args
*/
public static void main(String[] args) throws Exception {
Class.forName("com.mysql.jdbc.Driver").newInstance();
MysqlDataSource ds = new MysqlDataSource();
ds.setServerName("localhost");
ds.setPort(3306);
ds.setUser("root");
ds.setPassword("");
ds.setDatabaseName("test");
ds.setCharacterEncoding("UTF-8");
ds.setUseUnicode(true);
Connection con = ds.getConnection();
con.createStatement().execute("DELETE FROM unicodetest");
PreparedStatement stmt = con
.prepareStatement("INSERT INTO unicodetest values(?,?)");
stmt.setInt(1, 1);
stmt.setString(2, "ÄÖÜß...");
stmt.execute();
stmt.close();
ResultSet rs = con.createStatement().executeQuery(
"SELECT id, name from unicodetest");
while (rs.next()) {
System.out.println(rs.getInt("id"));
System.out.println(rs.getString("name"));
}
rs.close();
con.close();
}
}
1
ÄÖÜß...
mysql> select * from unicodetest;
+------+---------+
| id | name |
+------+---------+
| 1 | ?Í??... |
+------+---------+
1 row in set (0.00 sec)