Actual combat Eclipse, Jigloo, POSTGRESQL,JDBC Development database query application system started

Source: Internet
Author: User
Tags gtk postgresql query linux
Data | database
Actual combat Eclipse, Jigloo, POSTGRESQL,JDBC Development database query application system started

1 Installing the Eclipse Author's gnu/linux, after compiling the installation from the download of some GTK + related packages, went to the Eclipse home page to find the Eclipse installation files under Linux GTK

2. Plugin The author installs two Plug-ins one is GUI design tool Jigloo, homepage: http://cloudgarden.com/jigloo/

One is the packaging tool fat jar exporterhttp://fjep.sourceforge.net/

3 postgresqlhttp://www.postgresql.org/I installed is 8.0, in accordance with the guidance of install, compile, install, set up a database, start the service, did not encounter too big problems

4 jdbchttp://jdbc.postgresql.org The author downloads 8.0 of JDBC

5. Eclipse Project Settings, code

Add Postgresql-8.0-310.jdbc3.jar to the project (add external Jar)

After adding the following code, you can see if the JDBC connection is successful and I'm lucky. One successful

String username= username "; String Password=password "; String url= "Jdbc:postgresql://localhost/testdb"; try {class.forname ("Org.postgresql.Driver");} catch ( ClassNotFoundException E1) {//TODO auto-generated catch block E1.printstacktrace ();}  try {Connection db = drivermanager.getconnection (URL, username, password); Statement st = Db.createstatement ();  ResultSet rs = st.executequery ("SELECT * from Pg_user");     while (Rs.next ()) {System.out.print ("Column 1 returned"); System.out.println (rs.getstring (1)); } rs.close (); St.close (); Todo Add your code for menuitem3.widgetselected} catch (SQLException e) {//TODO auto-generated catch block E.printstac Ktrace ();} }








Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.