Practical Eclipse, Jigloo, PostgreSQL, JDBC Development Database Query Application Start (transfer)

xiaoxiao2021-03-06  18

Practical Eclipse, Jigloo, PostgreSQL, JDBC development database query application started Eclipse, Jigloo, PostgreSQL, JDBC Development Database Query Application 1 Installing Eclipse author's GNU / Linux first after downloading some GTK related package bundles installation, To the Eclipse home page, I found the Eclipse installation file of the GTK under Linux. The plugin author installed two plug-ins for a GUI design tool Jigloo, Home: http://cloudgarden.com/jigloo/ One is package tool Fat Jar ExporterHttp: / /FJEP.SourceForge.Net/3 PostgreSqlhttp://www.postgreSQL.org/ The author is installed 8.0, according to the instruction, compile, install, build the database, start the service in Install, did not encounter too much problem 4 jdbchttp: //jdbc.postgresql.org author downloaded 8.0 JDBC 5. Eclipse project settings, the code will see the JDBC connection after adding the postgreSQL-8.0-310.jdbc3.jar Jar Adding the following code. Is it successful, the author is good. Successfully import java.sql. *; 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.printstacktrace ();}}

转载请注明原文地址:https://www.9cbs.com/read-41207.html

New Post(0)