You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
at org.firebirdsql.jdbc.FBStatementFactory.createPreparedStatement(FBStatementFactory.java:101)
at org.firebirdsql.jdbc.AbstractConnection.prepareStatement(AbstractConnection.java:1187)
at org.firebirdsql.jdbc.AbstractConnection.prepareStatement(AbstractConnection.java:942)
at org.firebirdsql.jdbc.AbstractConnection.prepareStatement(AbstractConnection.java:896)
at Main.main(Main.java:16)
Caused by: java.lang.RuntimeException: Cannot get the value for this argument type as a string
at org.firebirdsql.gds.impl.wire.ParameterBufferBase$Argument.getValueAsString(ParameterBufferBase.java:185)
at org.firebirdsql.gds.impl.wire.ParameterBufferBase.getArgumentAsString(ParameterBufferBase.java:64)
at org.firebirdsql.gds.impl.GDSHelper.prepareStatement(GDSHelper.java:177)
at org.firebirdsql.jdbc.AbstractStatement.prepareFixedStatement(AbstractStatement.java:1441)
at org.firebirdsql.jdbc.AbstractPreparedStatement.prepareFixedStatement(AbstractPreparedStatement.java:1282)
at org.firebirdsql.jdbc.AbstractPreparedStatement.<init>(AbstractPreparedStatement.java:138)
at org.firebirdsql.jdbc.FBPreparedStatement.<init>(FBPreparedStatement.java:45)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at org.firebirdsql.jdbc.FBStatementFactory.createPreparedStatement(FBStatementFactory.java:89)
... 4 more
Sample code:
public class Main {
public static void main(String [] args) throws SQLException {
FBSimpleDataSource ds = new FBSimpleDataSource();
ds.setDatabase("localhost:w:/progs/firebird/2.5.2.26539/examples/empbuild/EMPLOYEE.FDB");
ds.setUserName("SYSDBA");
ds.setPassword("masterkey");
ds.setCharSet("cp1251");
Connection con = ds.getConnection();
PreparedStatement sql = con.prepareStatement("select EMP_NO From Employee", 0, ResultSet.TYPE_SCROLL_INSENSITIVE);
}
java -Dfile.encoding=cp1251 -cp jaybird-full-2.2.3.jar;. Main
EncodingFactory.getJavaEncodingForAlias(charSet) can return null.
When null are in connection properties org.firebirdsql.gds.impl.wire.ParameterBufferBase$Argument.getValueAsString raise appropriate exception
Thanks for the report. I will use a slightly different solution than your patch, as we actually need the original (or any) charSet name for the second part of the setter.
Scheduled for 2.2.4 and 2.3. Solution for 2.3 will initially be committed to the wire protocol improvements branch as I am currently overhauling the character set / encoding implementation for Jaybird 2.3
Submitted by: Orlov Sergey (wasp)
Attachments:
setCharSet.patch
Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
at org.firebirdsql.jdbc.FBStatementFactory.createPreparedStatement(FBStatementFactory.java:101)
at org.firebirdsql.jdbc.AbstractConnection.prepareStatement(AbstractConnection.java:1187)
at org.firebirdsql.jdbc.AbstractConnection.prepareStatement(AbstractConnection.java:942)
at org.firebirdsql.jdbc.AbstractConnection.prepareStatement(AbstractConnection.java:896)
at Main.main(Main.java:16)
Caused by: java.lang.RuntimeException: Cannot get the value for this argument type as a string
at org.firebirdsql.gds.impl.wire.ParameterBufferBase$Argument.getValueAsString(ParameterBufferBase.java:185)
at org.firebirdsql.gds.impl.wire.ParameterBufferBase.getArgumentAsString(ParameterBufferBase.java:64)
at org.firebirdsql.gds.impl.GDSHelper.prepareStatement(GDSHelper.java:177)
at org.firebirdsql.jdbc.AbstractStatement.prepareFixedStatement(AbstractStatement.java:1441)
at org.firebirdsql.jdbc.AbstractPreparedStatement.prepareFixedStatement(AbstractPreparedStatement.java:1282)
at org.firebirdsql.jdbc.AbstractPreparedStatement.<init>(AbstractPreparedStatement.java:138)
at org.firebirdsql.jdbc.FBPreparedStatement.<init>(FBPreparedStatement.java:45)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at org.firebirdsql.jdbc.FBStatementFactory.createPreparedStatement(FBStatementFactory.java:89)
... 4 more
Sample code:
public class Main {
public static void main(String [] args) throws SQLException {
FBSimpleDataSource ds = new FBSimpleDataSource();
ds.setDatabase("localhost:w:/progs/firebird/2.5.2.26539/examples/empbuild/EMPLOYEE.FDB");
ds.setUserName("SYSDBA");
ds.setPassword("masterkey");
ds.setCharSet("cp1251");
Connection con = ds.getConnection();
PreparedStatement sql = con.prepareStatement("select EMP_NO From Employee", 0, ResultSet.TYPE_SCROLL_INSENSITIVE);
}
java -Dfile.encoding=cp1251 -cp jaybird-full-2.2.3.jar;. Main
Commits: a3c3ef1 FirebirdSQL/fbt-repository@22d2722 FirebirdSQL/fbt-repository@a691022
The text was updated successfully, but these errors were encountered: