Decrypt unicode text from DB
<p>i have a problem when i try to save encrypted "password-text" to SQL server 2008r2 Database. When i save from java-Netbeans, sql receives "?????" on text field, i found that is because or unicode... i'm using BLOWFISH Encryption (The class works perfect) but i can't decrypt it because i'm getting from DB "????" text instead of original text(password)</p>

<p>Do you know how can i fix this issue?, a friend told to use "varbinary" on DB instead of "varchar", but no idea how to do :S</p>

<p>Thanks</p>

<pre><code>public boolean SavetoDB() {
    DATABASE_CONNECTION con = new DATABASE_CONNECTION();
    cn = con.conectar();

    boolean resp = false;
    try {
        String sql = "INSERT INTO cliente(usuario, pass, Nombre, Apellido, Edad,"
                + "genero, Direccion, Telefono, Celular, img_name,tipo_cuenta, ipaddress, puerto,segundos,minutos,horas)"
                + " VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?,?,?,?)";
        PreparedStatement cmd = cn.prepareStatement(sql);
        cmd.setString(1, usuario);
        cmd.setString(2, pass);
        cmd.setString(3, Nombre);
        cmd.setString(4, Apellido);
        cmd.setInt(5, Edad);
        cmd.setString(6, genero);
        cmd.setString(7, Direccion);
        cmd.setInt(8, Telefono);
        cmd.setInt(9, Celular);
        cmd.setString(10, nombrearch);
        cmd.setString(11, tipo_cuenta);
        cmd.setString(12, ip);
        cmd.setString(13, puerto);
        cmd.setInt(14, 1);
        cmd.setInt(15, 0);
        cmd.setInt(16, 0);
        ////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////


        if (!cmd.execute()) {
            resp = true;
        }
        cmd.close();
        cn.close();
    } catch (Exception ex) {
        System.out.println("Error: " + ex.getMessage());
    }
    return resp;
}
</code></pre>

<p>SQL TABLE:</p>

<p>create table cliente(</p>

<p>usuario varchar(15) not null primary key,</p>

<p>pass varchar(90) not null,</p>

<p>Nombre varchar(32) not null,</p>

<p>Apellido varchar(32) not null,</p>

<p>Edad int not null,</p>

<p>genero varchar(15) not null,</p>

<p>Direccion varchar(32),</p>

<p>Telefono int,</p>

<p>Celular int,</p>

<p>img_name  varchar(32) not null,</p>

<p>tipo_cuenta varchar(15) not null,</p>

<p>fecha_creacion date,</p>

<p>ipaddress varchar(20) not null,</p>

<p>puerto varchar (30) not null,</p>

<p>segundos int not null,</p>

<p>minutos int  not  null,</p>

<p>horas int not null,</p>

<p>)</p>
