Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2006

Tip: Looking for answers? Try searching our database.

java.sql and csvjdbc sorting

Thread view: 
MyClue - 02 Aug 2006 16:04 GMT
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
jagonzal@gmail.com - 02 Aug 2006 16:49 GMT
> 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".
MyClue - 02 Aug 2006 21:22 GMT
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.

> > Hey all,
> >     I've gotten my csvjdbc driver working and can select rows.  Is
[quoted text clipped - 3 lines]
> Ummm... those are commands you should include in your SQL, as in
> "SELECT * FROM table ORDER BY last_name".
jagonzal@gmail.com - 03 Aug 2006 19:09 GMT
> 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...
Web-Active - 04 Aug 2006 09:08 GMT
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 :P

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.

> > 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
[quoted text clipped - 5 lines]
> Easiest thing I can think of is insert the data into an Array and then
> using the Arrays sort utility. Quick and dirty...
MyClue - 04 Aug 2006 20:13 GMT
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.

> 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
[quoted text clipped - 31 lines]
> > Easiest thing I can think of is insert the data into an Array and then
> > using the Arrays sort utility. Quick and dirty...
MyClue - 02 Aug 2006 21:23 GMT
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.

> > Hey all,
> >     I've gotten my csvjdbc driver working and can select rows.  Is
[quoted text clipped - 3 lines]
> Ummm... those are commands you should include in your SQL, as in
> "SELECT * FROM table ORDER BY last_name".


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.