Menu

#207 setCollection does not work properly for CUBRIDPreparedStatement

open
nobody
None
5
2012-08-22
2012-08-22
Jira Trac
No

Originally reported at http://www.cubrid.org/412708.

If you try the code below, it will display no results, even though the demodb database used for the below example has entries that have the event Handball or Rowing.

{code:java}
import java.sql.*;
import cubrid.jdbc.driver.*;

public class Tester {
public static void main(String args[]) {
try {
Class.forName(cubrid.jdbc.driver.CUBRIDDriver);

CUBRIDConnection cn = (CUBRIDConnection) DriverManager.getConnection(jdbc:cubrid:localhost:30000:demodb:dba::);
cn.setCharset(UTF-8);
CUBRIDPreparedStatement stm = (CUBRIDPreparedStatement)(cn.prepareStatement(Select code, gender, nation_code from athlete where event in ?));

String[] p = {Handball};
stm.setCollection(1, p);

ResultSet rs = stm.executeQuery();
while(rs.next()) {
System.out.println(rs.getInt(code));
}
System.out.println(done);
} catch(Exception err) {
err.printStackTrace();
}
}
}
{code}

Just run this code after you have installed CUBRID with the demodb database. It should display the code for each athlete that participated in the Rowing or Handball event.

Instead it displays no results (just the done message).

Discussion

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.