Thread: JDBC JAVA interface
Hello Does anybody have written a Postgresql interface using jdbc? An applet of a Application use AWT. I work on it, I would make selection and have graphical result... If someone have exemple, Thanks. Cyril. -- ************************************************************************* * Cyril Ferrand : mailto:cyril.ferrand@sophia.inria.fr * * http://www.mygale.org/05/ironmask * *************************************************************************
On Wed, 15 Jul 1998, Cyril Ferrand wrote: > Hello > Does anybody have written a Postgresql interface using jdbc? An applet of a > Application use AWT. I work on it, I would make selection and have graphical > result... > If someone have exemple, Thanks. There are several out there. I'm working on one, and I know (don't have the url) of another general purpose frontend thats being written at the moment. Infact one is in the driver's source distribution. When you make the driver, run: [jdbc]$ make examples [jdbc]$ java example.ImageViewer jdbc:postgresql:dbase user password replace dbase, user and password with your values for an empty database. From the source: This example tests the binary large object api of the driver. Basically, it will allow you to store and view images held in the database. Note: If you are running this for the first time on a particular database, you have to select "Initialise" in the "PostgreSQL" menu. This will create a table used to store image names. -- Peter T Mount peter@retep.org.uk or petermount@earthling.net Main Homepage: http://www.retep.org.uk ************ Someday I may rebuild this signature completely ;-) ************ Work Homepage: http://www.maidstone.gov.uk Work EMail: peter@maidstone.gov.uk
> On Wed, 15 Jul 1998, Cyril Ferrand wrote: > > > Hello > > Does anybody have written a Postgresql interface using jdbc? An applet of a > > Application use AWT. I work on it, I would make selection and have graphical > > result... > > If someone have exemple, Thanks. > > There are several out there. I'm working on one, and I know (don't > have the url) of another general purpose frontend thats being > written at the moment. > > Infact one is in the driver's source distribution. When you make the > driver, run: > > [jdbc]$ make examples > [jdbc]$ java example.ImageViewer jdbc:postgresql:dbase user password > > replace dbase, user and password with your values for an empty database. > > >From the source: > > This example tests the binary large object api of the driver. > Basically, it will allow you to store and view images held in the > database. > > Note: If you are running this for the first time on a particular > database, you have to select "Initialise" in the "PostgreSQL" > menu. This will create a table used to store image names. > Thanks for your answer, i look at Imageviwer. My app Java with AWT work (beta version) but my pb is to plot result in a new frame. I know how to make a new frame with graphs use drawline. But my first idea is to use applet PtPlot, but I must convert it in a awt app not an applet. Cyril. -- ************************************************************************* * Cyril Ferrand : mailto:cyril.ferrand@sophia.inria.fr * * http://www.mygale.org/05/ironmask * *************************************************************************
> On Wed, 15 Jul 1998, Cyril Ferrand wrote: > > > Hello > > Does anybody have written a Postgresql interface using jdbc? An applet of a > > Application use AWT. I work on it, I would make selection and have graphical > > result... > > If someone have exemple, Thanks. > If you are asking for examples of how it would be possible to come up with a graphical display of text queries I might be able to help you. I just came up with a java front end for a postgresql database which includes a graphical display. Basically it is pretty easy to use a canvas to display the results on, and using the result set meta data you can calculate dynamically the spacing for different columns and rows. Using this method you can also implement action listeners to allow highligting and popup menus.... its very flexible. If you have questions send private e-mail to me and i might be able to supply you with example code. --
[email problems within maidstone.gov.uk has delayed this response - peter] On Thu, 16 Jul 1998, Stephen Lombardo wrote: > > On Wed, 15 Jul 1998, Cyril Ferrand wrote: > > > > > Hello > > > Does anybody have written a Postgresql interface using jdbc? An applet of a > > > Application use AWT. I work on it, I would make selection and have graphical > > > result... > > > If someone have exemple, Thanks. > > > > If you are asking for examples of how it would be possible to come up with a graphical > display of text queries I might be able to help you. I just came up with a java front > end for a postgresql database which includes a graphical display. Basically it is > pretty easy to use a canvas to display the results on, and using the result set meta > data you can calculate dynamically the spacing for different columns and rows. Using > this method you can also implement action listeners to allow highligting and popup > menus.... its very flexible. If you have questions send private e-mail to me and i > might be able to supply you with example code. Thinking about it, you could take a look at the Swing component set. It has a Table widget which I think can handle ResultSet's. -- Peter Mount (at work) peter@taer.maidstone.gov.uk or peter@maidstone.gov.uk If you mail me here, please cc my home address peter@retep.org.uk
Peter T Mount wrote: >>Thinking about it, you could take a look at the Swing component set. Ithas a Table >>widget which I think can handle ResultSet's. >>-- >>Peter Mount (at work) peter@taer.maidstone.gov.uk or peter@maidstone.gov.uk >>If you mail me here, please cc my home address peter@retep.org.uk Thats true, but you can add flexibility and a higly reusable interface for database work simply by using a canvas. It is a lighter weight component and you can come up with an editable display with little trouble. By passing the result set to the canvas constructor you can use the metadata to create column headers, and the custom grid for each result set that is passed. this means that your component can be pointed at ANY database and based upon the result set and metadata you will get a custom table on which you can update rows, individual cells, or delete entries on the fly. with this option you can implement a simple refresh function which will update the graphic display when desired to reflect new data in the table. also, by using RMI and passing an AppletContext you can redirect the client browser to custom made html tables that include only the information the client is looking for. A similar effect can be attained using a perl cgi script and the perl postgresql inteface. Using the get method you can pass the query string to the cgi script and generate printable tables of the desired information. The other bonus of this scheme is that because your display is a canvas it is highly relocatable. you can put it in a scroll pane , add it to a panel within an applet that dispays within the frame of your web browser, or do anything else with it that you desire. It might be quicker to use swing or even the packaged classes for ptplot as Cyril was planning on doing, spending the time to create your own diplay pays off in the long run with its customizability, portability, and its flexable interface. === Stephen J. Lombardo Java Programmer/Network Technician Montclair State University Dept. of Systems and Networks http://www.is.montclair.edu/~lombardos lombardos@mail.montclair.edu ===
On Tue, 21 Jul 1998, Stephen Lombardo wrote: > Peter T Mount wrote: > > >>Thinking about it, you could take a look at the Swing component set. Ithas a Table > >>widget which I think can handle ResultSet's. > >>-- > > >>Peter Mount (at work) peter@taer.maidstone.gov.uk or peter@maidstone.gov.uk > >>If you mail me here, please cc my home address peter@retep.org.uk > > > Thats true, but you can add flexibility and a higly reusable interface for database work > simply by using a canvas. It is a lighter weight component and you can come up with an > editable display with little trouble. I actually don't use swing, because I found it's too resource hungry. > By passing the result set to the canvas constructor you can use the > metadata to create column headers, and the custom grid for each result > set that is passed. this means that your component can be pointed at > ANY database and based upon the result set and metadata you will get a > custom table on which you can update rows, individual cells, or delete > entries on the fly. The way I actually handle them, is by having a class that extends Component (in jdk1.1 this is better than Canvas as it doesn't use any native code, and less resources). It then accesses a datasource via a simple Interface. I have several of these classes, one for JDBC, another stores the data in memory using Vector, another can handle simple DBF files, etc. The JDBC one can then be given a query string, and a JDBC connection, and it handles fetching the data. I'm planning another one to actually handle JDBC tables, rather than queries, so the entire table or view is used. [snip] > It might be quicker to use swing or even the packaged classes for ptplot > as Cyril was planning on doing, spending the time to create your own > diplay pays off in the long run with its customizability, portability, > and its flexable interface. I cant agree more here. I've spent a lot of time writing, then rewriting code, just to get the functionality I needed. My mapping classes, which can generate maps from JDBC queries (and soon using postgresql's geometric types), I had to write myself because there was nothing available to do the job. All of the "graphic" classes are cartesian, while I needed something that could handle sperical geometry. Also, I needed to have low level control of the data, because one of the things I wanted to be capable of doing, was generate output, not just on a Printer, but in either Postscript or Portable Document Format (PDF). -- Peter T Mount peter@retep.org.uk or petermount@earthling.net Main Homepage: http://www.retep.org.uk ************ Someday I may rebuild this signature completely ;-) ************ Work Homepage: http://www.maidstone.gov.uk Work EMail: peter@maidstone.gov.uk