Problem wyglada tak:
W bazie gdy wyświetle sobie selectem wszystko gra, są polskie znaki.
Odczyt z bazy w programie:
public static Collection<Zlecenie> readList() throws SQLException
{
System.out.println("Start procedury laczenia do bazy ;)");
String DB_USER = "apw_user";
String DB_PASSWORD = "apw_user";
String DB_CONNECTION_STRING = "jdbc:firebirdsql://localhost:3050/C:\\CRM\\CRM.FDB";
String STEROWNIK ="org.firebirdsql.jdbc.FBDriver";
try {
Class.forName("org.firebirdsql.jdbc.FBDriver");
}
catch (ClassNotFoundException ex) {
Logger.getLogger(EmployeeListDecorator.class.getName()).log(Level.SEVERE, null, ex);
}
Connection polaczenie = DriverManager.getConnection(DB_CONNECTION_STRING,DB_USER,DB_PASSWORD);
Statement stat = polaczenie.createStatement();
System.out.println("Polaczno, wykonywanie zapytania");
ResultSet result = stat.executeQuery("select * from Zlecenie");
ArrayList<Zlecenie> list = new ArrayList<Zlecenie>();
int rowCount = 0;
ResultSetMetaData rsmd = result.getMetaData();
int columnCount = rsmd.getColumnCount();
while (result.next())
{
rowCount++;
list.add(new Zlecenie(result.getString(0 + 1),result.getString(0 + 2),result.getString(0 + 3),result.getString(0 + 4)
,result.getString(0 + 5),result.getString(0 + 6),result.getString(0 + 7),result.getString(0 + 8)
,result.getString(0 + 9)));
}
polaczenie.close();
return list;
Interpretacja danych do tabelki:
Wywołanie odczytu:
zlecenia = new ArrayList<Zlecenie>(EmployeeListDecorator4.readList());
Interpretacja danych w tabeli:
TableModel model = new ModelTabelki(dane, nag)
{
public Class getColumnClass(int column)
{
Class returnValue;
if ((column >= 0) && (column < getColumnCount()))
{returnValue = getValueAt(0, column).getClass();}
else {returnValue = Object.class; }
return returnValue;
}
};
table = new JTable(model);
final TableRowSorter<TableModel> sorter =new TableRowSorter<TableModel>(model);
table.setRowSorter(sorter);
js = new JScrollPane(table);
setVisible(true);
Gdy tabelka sie wyswietli, w miejscu polskich znaków mam kwadraty ;/ Wczesniej program czytał z plików tekstowych odczyt był formatowany UTF-8 i nie było problemu. Nie wiem co z tym zrobić Prosze o pomoc.