Hi guys, Ok i got this little java application connecting to a dbf table in a network drive, it’s a swing app and works, but when I migrate it to vaadin, it’s not working, I know that the problem is when the app is trying to get the table from the network drive because I test the vaadin app with a local dbf on C drive, any solution to my problem? thanks…-_-
private static final String CAPTION = "Enviar";
private static final String NOTIFICATION = "Pedido enviado";
Window mainWindow;
TextField numero_pedido = new TextField();
TextField nombre_domiciliario = new TextField();
static boolean error = false;
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
String formatoHora;
final String url = "jdbc:odbc:Driver={Microsoft dBASE Driver (*.dbf)};DBQ=R:/rex";
String sql;
Connection connection = null;
Statement statement = null;
ResultSet resultSet = null;
@Override
public void init() {
mainWindow = new Window("Despachos");
setMainWindow(mainWindow);
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
connection = DriverManager.getConnection(url);
statement = connection.createStatement();
} catch (ClassNotFoundException e) {
mainWindow.showNotification("Error de driver de SQL",
Notification.TYPE_ERROR_MESSAGE);
error = true;
} catch (SQLException ex) {
mainWindow.showNotification("Error en SQL" + ex.toString(),
Notification.TYPE_ERROR_MESSAGE); //ERROR HERE
error = true;
}
Label label = new Label("Digite el Numero del despacho");
mainWindow.addComponent(label);
mainWindow.addComponent(numero_pedido);
Label label2 = new Label("Digite las iniciales del domiciliario");
mainWindow.addComponent(label2);
mainWindow.addComponent(nombre_domiciliario);
Button b = new Button(CAPTION);
b.addListener(this);
mainWindow.addComponent(b);
}
@Override
public void buttonClick(ClickEvent event) {
String pedido;
String num_pedido;
try {
num_pedido = (String) numero_pedido.getValue();
formatoHora = sdf.format(Calendar.getInstance().getTime());
sql = "UPDATE vta SET Vtamensaj = '" + nombre_domiciliario.getValue().toString() + "',Vtahorent = '" + formatoHora + "',Vtaentreg = 1 WHERE Vtacodigo = " + ((String) numero_pedido.getValue()).concat(".0") + " AND Vtaentreg = 0 ";
pedido = ((String) numero_pedido.getValue()) + " - " + ((String) nombre_domiciliario.getValue()).substring(0, 2) + " - " + formatoHora;
int rs = statement.executeUpdate(sql);
if (rs == 0) {
mainWindow.showNotification("Ya fue enviado");
} else if (rs == 1) {
mainWindow.showNotification(NOTIFICATION);
//numero_pedido.setValue("");
}
} catch (SQLException e) {
}
}