• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to make query first,last next,previous on table to rtetriveb data.

 
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Can anyone help me how to retrieve data from table in the following manner.
In my application I have five button namely First,last,next,previous,and Query.
When I will press the query button, it should show me last data that I had feed to the table. When I press first button it should show first entry that I had entered to the table .likewise for the last button. Now after pressing query button, when I press the previous button it should show me data that I had entered through the table before the last entry. Like wise.
Here I am retrieving data from two tables where we have entry no as a common field between them.
Also each table have unique serial no as break no. field.


And my second query is about the connection pooling.
How the connection pooling is achieved throughout the application.
In my current application, I have nearly 150 servlet where I have to make separate connection for each servlet to work with database.
Is it possible to make connection with database in only login servlet and such connection object can I use in remaining servlet so my application becomes more reliable and speedy.
Please help me on this issue as I am looking the same from long time.
Kindly help me on above issue.
Any suggestion is highly appreciated.
Thanks
Harshal
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Harshal,
1) SQL has a "union" keyword that you can use to include two tables in your query. This lets it look like one table from the point of view of paging.

2) Creating a connection in the servlet and leaving it open for a long time is not a good practice. It would be better to use an actual connection pool. Many databases come with a pooling driver you can use on your app server. Otherwise, you can use the Apache DBCP library.
 
Harshal Gurav
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jeanne Boyarsky ,
thanks for your reply.
my query is how to retrive first,last row data from table.
in my form, once i click on first data it should show data that i had entered before. so once i get last or first entered the data i can use other button like orevious,next buttton.
is there any query to retrieve first or last data from table?
any suggestion is highly appreciated.
thansk and regards
harshal
 
Ranch Hand
Posts: 1143
1
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Harshal,
I believe you are asking how to implement paging in JDBC.
I suggest doing an Internet search for the words "jdbc paging".

Good Luck,
Avi.
 
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I find the display tag very handy for pagination, assuming that you need to display the data in tabular format. It will allow you to navigate to first, next, previous and last record very easily.
 
Honk if you love justice! And honk twice for tiny ads!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic