pg.ddx.io pgsql-interfaces@postgresql.org mailing list archivehelp / color / mirror / Atom feed
jdbc windows 3+ messages / 2 participants [nested] [flat]
* jdbc windows @ 2006-06-27 11:47 Matteo Traina <matteo.traina@email.it> 2006-06-28 17:40 ` Re: jdbc windows Robert Wimmer <seppwimmer@hotmail.com> 0 siblings, 1 reply; 3+ messages in thread From: Matteo Traina @ 2006-06-27 11:47 UTC (permalink / raw) To: pgsql-interfaces Hello, I'm a new user of postgresql, version 8.1.4 windows, and i've a little problem: i don't understand about use jdbc driver with windows...how do i do for use it, sorry but i need a little guide/trial because i find it only for linux. excuse me for my bad english and if i send this request not to the jdbc post on the mailing list...but i don't find the right address. thank you. Regards, Matteo -- Email.it, the professional e-mail, gratis per te: http://www.email.it/f Sponsor: Gioca e vinci con Cesar: trova la ciotola ed è subito tuo il prezioso kit per la tavola del tuo cagnolino Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=5331&d=27-6 ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: jdbc windows 2006-06-27 11:47 jdbc windows Matteo Traina <matteo.traina@email.it> @ 2006-06-28 17:40 ` Robert Wimmer <seppwimmer@hotmail.com> 2006-06-29 19:25 ` Re: jdbc windows Matteo Traina <matteo.traina@email.it> 0 siblings, 1 reply; 3+ messages in thread From: Robert Wimmer @ 2006-06-28 17:40 UTC (permalink / raw) To: matteo.traina@email.it; pgsql-interfaces >From: Matteo Traina <matteo.traina@email.it> >i don't understand about use jdbc driver with windows...how do i do for use >it, sorry but i need a little guide/trial because i find it only for linux. the usage of jdbc does not depend on the underlying OS. here is some example code - that also works in windows package at.wiro.sql; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class Postgres { public static void printException(String query,SQLException e) { System.out.println("query : <" + query + ">"); System.out.println("SQL-error : " + e.getErrorCode()); System.out.println("SQL-state : " + e.getSQLState()); System.out.println("SQL-message : " + e.getMessage()); e.printStackTrace(); System.exit(1); } public static Connection connect(String host,String db, String user, String pwd) { String pg_driver = "org.postgresql.Driver"; Connection conn = null; try { Class.forName(pg_driver); } catch (Exception e) { System.out.println("can't load postgres driver '" + pg_driver + "' ..."); System.exit(1); } try { conn = DriverManager.getConnection("jdbc:postgresql://" + host + "/" + db,user,pwd); } catch (SQLException e) { System.out.println("can't connect to db '"+db+"' as user '" + user + "' ..."); printException("Connection Error : ",e); System.out.println("system halted ..."); System.exit(1); } return conn; } public static ResultSet query(Connection conn,String query) { ResultSet rs = null; try { Statement st = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE); rs = st.executeQuery(query); } catch (SQLException e) { printException(query,e);} return rs; } .... regards sepp ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: jdbc windows 2006-06-27 11:47 jdbc windows Matteo Traina <matteo.traina@email.it> 2006-06-28 17:40 ` Re: jdbc windows Robert Wimmer <seppwimmer@hotmail.com> @ 2006-06-29 19:25 ` Matteo Traina <matteo.traina@email.it> 0 siblings, 0 replies; 3+ messages in thread From: Matteo Traina @ 2006-06-29 19:25 UTC (permalink / raw) To: Robert Wimmer <seppwimmer@hotmail.com>; pgsql-interfaces Hi Robert, thank you, i've understand...and thank you for your code too, i tried it and it works fine. Regards, Matteo -- Email.it, the professional e-mail, gratis per te: http://www.email.it/f Sponsor: Cassine di Pietra: vini veneti di qualità subito a casa Sua * da unazienda famigliare al servizio di clienti selezionati * Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=3919&d=29-6 ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2006-06-29 19:25 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2006-06-27 11:47 jdbc windows Matteo Traina <matteo.traina@email.it> 2006-06-28 17:40 ` Robert Wimmer <seppwimmer@hotmail.com> 2006-06-29 19:25 ` Matteo Traina <matteo.traina@email.it>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox