Subject | Re: jdbc driver and unicode |
---|---|
Author | rrokytskyy |
Post date | 2002-07-23T07:04:19Z |
> right up to the point the form data is handed off to the driver. iit seems to me that i know where your problem is. you're constructiong
> can see the sql statements generated & the utf-8 text is all ok at
> that point.
SQL statements by concatenating strings of the statement with
parameters and then executing using java.sql.Statement, aren't you?
this might work for MS SQL, but seems not to work with Firebird. the
only possibility to pass correct data is to use
java.sql.PreparedStatement. parameters are specified with '?', so SQL
to prepare looks like this:
PreparedStatement stmt = connection.prepareStatement("INSERT INTO
my_table(col1, col2) VALUES(?, ?)");
stmt.setString(1, value1);
stmt.setString(2, value2);
int insertedRows = stmt.executeUpdate();
if (insertedRows != 1)
throw new BigProblemException("Could not insert data");
> > You can subclass org.firebirdsql.jdbc.FBDriver class, override aok, if you're using the technique i described above this will not help
> > method where connection is opened and enforce lc_ctype=UNICODE_FSS
>
> to easy for you to say ;-) i don't suppose i could prevail upon you
> for an example? my knowledge of java is trivial (i'm a cf guy).
you anyway. if not, i will post an example here.
> well there is an optional "connection string" which i can pass inok, that was the right place.
> "lc_ctype=UNICODE_FSS" ok but it doesn't seem to have any effect.
> the cf page is encoded as utf-8. i'm inserting text like this:i doubt that server can parse this string, you should get SQLException
> INSERT INTO uTest(uText)
> VALUES(_UNICODE_FSS'#form.uText#')
here.
ok, i do not know yet where the problem you described is. it might be
in our driver, however, it might be in database server itself. try to
work with prepared statement. i do not know cfmx, so i hardly know
what access to JDBC API you have. i will also make some tests to check
if bug is related to our driver or database.
best regards,
roman rokytskyy