Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

execute procedure text blob result read via ResultSet.getString() returns null [JDBC381] #423

Closed
firebird-automations opened this issue Jan 22, 2015 · 12 comments

Comments

@firebird-automations
Copy link

Submitted by: Attila Molnár (e_pluribus_unum)

Is related to JDBC350

Attachments:
TEST.ZIP

Hi!

#⁠1 : run non selectable procedure via CallableStatement which returns a text blob
#⁠2 : read result via ResultSet.getString(1) -> empty string returned instead of the expected string

(PS : Jaybird 2.2.5 works fine)

Thank You!

Commits: bf90fad 6fb7a50 FirebirdSQL/fbt-repository@f0e543a FirebirdSQL/fbt-repository@96196bc

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

Link: This issue is related to JDBC350 [ JDBC350 ]

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

This is probably caused by the changes for JDBC350. Could you add a reproduction example (stored procedure + java code), so I can easily track it down and fix it?

Note that from a strict interpretation of JDBC, for an executable stored procedures you shouldn't use the ResultSet, but the getters on the CallableStatement instead. For Jaybird 2.2.x this should continue to work as it did in 2.2.5 and earlier, but there is no guarantee that this compatibility will be maintained in future Jaybird releases.

@firebird-automations
Copy link
Author

Commented by: Attila Molnár (e_pluribus_unum)

I use CallableStatement.getString(), I reported wrong in the first place. Test DB attached.
Code :

BasicDataSource ds = new BasicDataSource();
ds.setUsername("SYSDBA");
ds.setPassword("masterkey");
ds.setUrl("jdbc:firebirdsql:l3s-4/3051:d:\\\\test.fdb?charSet\\=UTF-8&TRANSACTION_READ_COMMITTED\\=isc_tpb_read_committed,isc_rec_version,isc_tpb_nowait&isc_dpb_sql_dialect=1");
Connection conn = ds.getConnection();
CallableStatement s = conn.prepareCall("EXECUTE PROCEDURE dyn_col_test");
s.execute();
String ret = s.getString(1);//problem!
System.out.print(ret);

@firebird-automations
Copy link
Author

Modified by: Attila Molnár (e_pluribus_unum)

Attachment: TEST.ZIP [ 12667 ]

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

Thanks, I will check and hopefully fix asap (probably this weekend).

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

Fix Version: Jaybird 2.2.7 [ 10660 ]

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

In JDBC350 I created a 'copy' of the result set for use with the getters of the CallableStatement, however creating such a copy will result in cached blobs (where the blob data is already loaded), however in this case the cached data is actually the blob id, and not the blob data.

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

Added option to FBCachedFetcher and FBResultSet to retrieve blobs when populated from an existing list of rows. This solves the problem.

I am considering releasing 2.2.7 with only this fix as it is a rather annoying breaking bug. I will make a final decision tomorrow (Sunday).

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

Component: JDBC driver [ 10053 ]

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

2.2.7 has been released (only this fix): https://sourceforge.net/projects/firebird/files/firebird-jca-jdbc-driver/2.2.7-release/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants