JDBC and IDS/UDO; TempTables
Posted in 1998
Hello, i have some troubles with JDBC on an IDS/UDO (formerly IUS) 913UC1 (Using the JDBC-WinNT-Driver). Is it possible that the interface has some problems with temporary tables ? Two things: A) (i have posted this topic A into the idn-newsgroup already) in my DataBlade i extensively use temporary tables that i want to drop after usage. Because the web-Datablade cannot handle DropTable-Statements, i do not drop the tables. Instead i catch the exception that is raised when a temptable is created that already exists. This works fine in the SQL-Editor and the WebDataBlade, but not when accessing the Blade-functions via JDBC. In spite of the exception catch that is done, a requester pops up and tells me about a problem with the create-table-statement. Is there another way to solve this instead of dropping the used temptables manually in the Java-Application that are created in the Blade ? B) On a JDBC-Connection i want to issue multiple statements. The first one creates a temp-table, the second statement does a select on this temp-table and returns the result-set with the values. The temp-table is created within a DataBlade-function (the SQL-Statement executes a function); i am not interested in the resulting value of the function call. So i thought to close the statement after executing the query and create a new statement to work on the temp table. This did not work, because a base table (the temp table) did not exist !?? The solution is that it seems to need at least one ResulSet.next()-call to really invoke the first statement (lazy evaluation ?). In the following example the important line is marked with "(!!)". Is this a normal JDBC-behaviour, or a bug in the informix-api-direct driver ? ResultSet rs = null; Connection con = ....; // open a connection statement = con.createStatement(); // create 1st statement stmtString = "execute function xyc();" // will create the temptable rs = statement.executeQuery(stmtString); // do the query (!!) rs.next(); // the important line statement.close(); // also closes resultset statement = con.createStatement(); // create the 2nd statement stmtString = "select * from temptable;" // use the temptable rs = statement.executeQuery(stmtString); // do the query (here: fetch the data with rs.next()-loop) statement.close(); // also closes resultset -- Gert Brinkmann email: gbrinkmann@dimedis.de Software Development tel: 0221/921260-0 dimedis GmbH fax: -99 Habsburgerring 2-12 http://www.dimedis.de 50674 Koeln http://www.RealTimeImage.de