resultset

Is it possible to store and retrieve a boolean value in a varchar field using Java JDBC?

Hi, quick question: my customer has a situation where he has his database with a varchar field and the corresponding jdbc code is storing/retrieving a boolean. I guess that the boolean values false and true are going to be translated to "0" and "1" but I would like to have a confirmation of this (I can't find the precise behavior speci...

How do I get the row count in JDBC?

I've executed a JDBC query to obtain a resultset. Before iterating over it, I'd like to quickly find out how many rows were returned. How can I do this with high performance? I'm using Java 6, Oracle 11g, and the latest Oracle JDBC drivers. ...

Writing resultset to file with sorted output

I want to put "random" output from my result set (about 1.5 mil rows) in a file in a sorted manner. I know i can use sort by command in my query but that command is "expensive". Can you tell me is there any algorithm for writing result set rows in a file so the content would be sorted in the end and can i gain in performance with this? ...

Java: How do I get the size of a java.sql.ResultSet?

Shouldn't this be a pretty straightforward operation? However, I there is no size() or length() method. ...

How to handle huge result sets from database

I'm designing a multi-tiered database driven web application – SQL relational database, Java for the middle service tier, web for the UI. The language doesn't really matter. The middle service tier performs the actual querying of the database. The UI simply asks for certain data and has no concept that it's backed by a database. The qu...

How do you implement pagination in PHP?

How are paged results commonly implemented in PHP? I'd like to have a results page with 10 results. Paging forward in the navigation would give me the next and previous sets. Is there a way this is commonly done? Does anyone have simple advice on getting started? ...

Java NullPointerException when traversing a non-null recordset

Hello again - I am running a query on Sybase ASE that produces a ResultSet that I then traverse and write the contents out to a file. Sometimes, this will throw a NullPointerException, stating that the ResultSet is null. However, it will do this after printing out one or two records. Other times, with the same exact input, I will receiv...

How do I limit the result set being pulled back by NHibernate's GetByCriteria?

I have an NHibernate Dao..lets call it MyClassDao for want of a better name. I am writing the following code. MyClassDao myDao = new MyClassDao(); var values = myDao.GetByCriteria(Restrictions.Eq("Status", someStatusValue)); I am using this in a Unit Test to pull back values from the database. However, it is taking over 30 seconds t...

combine 2 resultset

is there a way to add the results of 2 different queries to a resultset? something like that: ResultSet rs ; i=0; while(i<=l) ResultSet rs1 = select * from tablei; rs = rs + rs1; i++; } I know that I can do it with union, but I have a lot queries and if I use UNION the query is too slow. Any idea? ...

assigning a specific record in a ResultSet to a variable

Hi I want to retrieve a set of records from a database, do a rs.next() and then assign the result of this to a variable to pass to a method that will use this record, in the same way that I would without assigning it to a variable and passing it to a method is there any way to do this? I'm using JAVA (1.5) ...

Building resultset using collection object

Hi, I had an issue in building the resultset using java. Here it goes... I am storing a collection object which is organized as row wise taken from a resultset object and putting the collection object(which is stored as vector/array list) in cache and trying to retrieve the same collection object. Here i need to build back the resultse...

T-SQL 2005: Suppress the output of the results set.

Hi guys. I have some stored procedures which are used for generating Reports. I am trying to build a report dashboard that will show how many records are on each report. The SPs are detailed in a table which details in which order they should be run. I have a dashboard SP in which I am using Cursor to go through the database table, e...

When listing information from a database using php and mysql how would you make the first row look different to the rest?

Basically I have articles in my database and I want to alter the way the first record displays. I want the lastest (Posted) article to be the focus and the older article just to list, (see F1.com). I need to know how to get the first of my values in the array and get it to display differently but I am not sure how to do this, I can do it...

Getting the size (in bytes) of the ResultSet using java code

How to get the size(in bytes) of the given ResultSet within the java code. Is there any direct way to find out? ...

ExecuteXmlReader and null Resultset Throws TargetInvocationException

I'm calling a stored procedure on a SQL Server 2005 database which returns an XML resultset. Sometimes it will return an null resultset becuase there are not rows to return. When this happens athe ExecuteXmlReader method throws a TargetInvocationException. This seems to be a known issue (see: http://social.msdn.microsoft.com/Forums/en-US...

Egrep acts strange with -f option

Hi all, I've got a strangely acting egrep -f. Example: $ egrep -f ~/tmp/tmpgrep2 orig_20_L_A_20090228.txt | wc -l 3 $ for lines in `cat ~/tmp/tmpgrep2` ; do egrep $lines orig_20_L_A_20090228.txt ; done | wc -l 12 Could someone give me a hint what could be the problem? No, the files did not changed between executions. The expected ...

How can I retrieve a JDBC ResultSet as an ArrayList?

I'm doing a query to retrieve a large amount of IDs (integers). Instead of iterating millions of times through the ResultSet and copying everything one-by-one to an ArrayList, is there some way to simply retrieve everything as an ArrayList? I understand that ResultSet is supposed to be iterated because the underlying implementation may ...

Fastest way to format SQL results in PHP

What's the fastest (best performing) way in PHP to transform a (My)SQL result like: array( array('user_name' => 'john', 'tag_id' => 1, 'tag_name' => 'foo'), array('user_name' => 'john', 'tag_id' => 2, 'tag_name' => 'bar'), array('user_name' => 'rick', 'tag_id' => 3, 'tag_name' => 'foobar'), array('user_name' => 'rick', 'tag_id' => 2...

Is there an Oracle SQL tool that builds insert statements from a result set?

Is there an Oracle SQL tool that builds insert statements from a result set? We are currently only allowed to use a tool called SQL Station. I'd like to either suggest a tool, like Rapid SQL or CrazySQuirrell, or build my own re-usable chunk of sql. ...

javascript - accessing a field of datatype varchar(max) in resultset

Within a javascript app, we're calling a sproc on SQL Server 2005 that's returning a resultset with 3 columns of type: bigint, varchar(20), and varchar(MAX). When calling the sproc and reading the results, there's no exception being thrown. When enumerating the resultset: var dbConn = DatabaseConnectionFactory.createDatabaseConnection(...