Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > java.sql and csvjdbc sorting

Reply
Thread Tools

java.sql and csvjdbc sorting

 
 
MyClue
Guest
Posts: n/a
 
      08-02-2006
Hey all,
I've gotten my csvjdbc driver working and can select rows. Is
there a SORTBY or ORDER BY in java.sql? It'd be nice to be able to
select by say... ID but sort by last name. Thanks!

--Mike

 
Reply With Quote
 
 
 
 
jagonzal@gmail.com
Guest
Posts: n/a
 
      08-02-2006
MyClue wrote:
> Hey all,
> I've gotten my csvjdbc driver working and can select rows. Is
> there a SORTBY or ORDER BY in java.sql? It'd be nice to be able to
> select by say... ID but sort by last name. Thanks!


Ummm... those are commands you should include in your SQL, as in
"SELECT * FROM table ORDER BY last_name".

 
Reply With Quote
 
 
 
 
MyClue
Guest
Posts: n/a
 
      08-02-2006
Too true... except stupid csvjdbc doesn't support ORDER BY or even
WHERE... As far as I can tell, it doesn't even support selecting
anything but SELECT *... i.e. I did "SELECT name FROM table" and it
selected everything. Kinda sucks. Thanks though.


http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> MyClue wrote:
> > Hey all,
> > I've gotten my csvjdbc driver working and can select rows. Is
> > there a SORTBY or ORDER BY in java.sql? It'd be nice to be able to
> > select by say... ID but sort by last name. Thanks!

>
> Ummm... those are commands you should include in your SQL, as in
> "SELECT * FROM table ORDER BY last_name".


 
Reply With Quote
 
MyClue
Guest
Posts: n/a
 
      08-02-2006
Too true... except stupid csvjdbc doesn't support ORDER BY or even
WHERE... As far as I can tell, it doesn't even support selecting
anything but SELECT *... i.e. I did "SELECT name FROM table" and it
selected everything. Kinda sucks. Thanks though.


(E-Mail Removed) wrote:
> MyClue wrote:
> > Hey all,
> > I've gotten my csvjdbc driver working and can select rows. Is
> > there a SORTBY or ORDER BY in java.sql? It'd be nice to be able to
> > select by say... ID but sort by last name. Thanks!

>
> Ummm... those are commands you should include in your SQL, as in
> "SELECT * FROM table ORDER BY last_name".


 
Reply With Quote
 
jagonzal@gmail.com
Guest
Posts: n/a
 
      08-03-2006
MyClue wrote:
> Too true... except stupid csvjdbc doesn't support ORDER BY or even
> WHERE... As far as I can tell, it doesn't even support selecting
> anything but SELECT *... i.e. I did "SELECT name FROM table" and it
> selected everything. Kinda sucks. Thanks though.


Ah, the csvjdbc driver is "a bit" limited

Easiest thing I can think of is insert the data into an Array and then
using the Arrays sort utility. Quick and dirty...

 
Reply With Quote
 
Web-Active
Guest
Posts: n/a
 
      08-04-2006
i found that when working with csv files and java, vectors come in very
handy, i find them much more dynamic than arrays, and the native
methods you can perform on vectors are quite handy. sorting is a
breeze, and comparisons on values are just as simple.

i usually pull any resultsets into vectors, perform any operations i
need to do on the data, and write it all back to a database or csv
file..... whatever suits best.

just build a java class that contains all your methods to translate
from resultset to vector, and from vector back to resultset, or
straight to csv string

i find it simplifies things to have 3 classes, keeping your code neat,
and reusable....

1. one class handles all db connectivity,

2. the other handles the compilations of a prepared sql statements, and
retrieving resultsets to vector or arrays,

3. and the 3rd handles your gui, input methods, and parsing of values
to your methods in your #2 class.

But thats just me... try out vectors.

(E-Mail Removed) wrote:
> MyClue wrote:
> > Too true... except stupid csvjdbc doesn't support ORDER BY or even
> > WHERE... As far as I can tell, it doesn't even support selecting
> > anything but SELECT *... i.e. I did "SELECT name FROM table" and it
> > selected everything. Kinda sucks. Thanks though.

>
> Ah, the csvjdbc driver is "a bit" limited
>
> Easiest thing I can think of is insert the data into an Array and then
> using the Arrays sort utility. Quick and dirty...


 
Reply With Quote
 
MyClue
Guest
Posts: n/a
 
      08-04-2006
Sounds like some great ideas to me. We (my company) are thinking about
switching utilities/drivers to another utility since we're trying to
write as little supporting code as possible. (We need to avoid having
to train people if someone leaves) This whole project has been really
neat though.



Web-Active wrote:
> i found that when working with csv files and java, vectors come in very
> handy, i find them much more dynamic than arrays, and the native
> methods you can perform on vectors are quite handy. sorting is a
> breeze, and comparisons on values are just as simple.
>
> i usually pull any resultsets into vectors, perform any operations i
> need to do on the data, and write it all back to a database or csv
> file..... whatever suits best.
>
> just build a java class that contains all your methods to translate
> from resultset to vector, and from vector back to resultset, or
> straight to csv string
>
> i find it simplifies things to have 3 classes, keeping your code neat,
> and reusable....
>
> 1. one class handles all db connectivity,
>
> 2. the other handles the compilations of a prepared sql statements, and
> retrieving resultsets to vector or arrays,
>
> 3. and the 3rd handles your gui, input methods, and parsing of values
> to your methods in your #2 class.
>
> But thats just me... try out vectors.
>
> (E-Mail Removed) wrote:
> > MyClue wrote:
> > > Too true... except stupid csvjdbc doesn't support ORDER BY or even
> > > WHERE... As far as I can tell, it doesn't even support selecting
> > > anything but SELECT *... i.e. I did "SELECT name FROM table" and it
> > > selected everything. Kinda sucks. Thanks though.

> >
> > Ah, the csvjdbc driver is "a bit" limited
> >
> > Easiest thing I can think of is insert the data into an Array and then
> > using the Arrays sort utility. Quick and dirty...


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting list vs sorting vector boltar2003@boltar.world C++ 2 07-06-2010 09:40 AM
fired event Sorting which wasn't handled - sorting and SelectedIndexChanged Jason ASP .Net Web Controls 0 10-04-2006 02:19 PM
csvjdbc class loading problem MyClue Java 8 07-28-2006 08:15 PM
sorting by multiple criterias (sub-sorting) Tom Kirchner Perl Misc 3 10-11-2003 05:16 PM
sorting and datagrid and underline sunil ASP .Net 1 07-15-2003 09:26 PM



Advertisments