Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 6D93A635ADA for ; Mon, 17 Aug 2009 13:42:16 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 81779-06 for ; Mon, 17 Aug 2009 16:42:04 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from outbound.vnet-inc.com (outbound.vnet-inc.com [216.146.104.103]) by mail.postgresql.org (Postfix) with ESMTP id 63CD863438D for ; Mon, 17 Aug 2009 13:42:04 -0300 (ADT) Received: from [192.168.157.32] (unknown [216.129.226.19]) by outbound.vnet-inc.com (Postfix) with ESMTP id 8A0605987 for ; Mon, 17 Aug 2009 10:42:03 -0600 (MDT) Message-ID: <4A8985F7.5090604@ttc-cmc.net> Date: Mon, 17 Aug 2009 10:31:51 -0600 From: dmp User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.13) Gecko/20060417 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Re: JDBC connection query.. References: <3f5b685a0908170149o6c28402fm7953ac29d33c7a71@mail.gmail.com> In-Reply-To: <3f5b685a0908170149o6c28402fm7953ac29d33c7a71@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200908/25 X-Sequence-Number: 19874 > Hi, > > I am working with Jdeveloper 11, Java 1.6 and Postgresql 8.3 on Windows. > > I got the jdbc driver postgresql-8.3-604.jdbc2, > postgresql-8.3-604.jdbc2ee, postgresql-8.3-604.jdbc3 and > postgresql-8.3-604.jdbc4. > > Please help to me to establish database connection in Jdeveloper. > Please give me step-by-step complete details of how to establish > connection between Jdeverloper and postgresql8.3. > > Thanks & Regards > Monu Zacharia Hello, The standard piece of Java code for establishing a connection to a PostgreSQL database is listed below. Perhaps a posting to a JDeveloper community or referencing its documentation might be more helpful. danap try{ Class.forName("org.postgresql.Driver").newInstance(); } catch (Exception e){ System.err.println("Unable to find and load driver" + e); } try{ Connection dbConnection; String connectionProperties; String host, port, db, user, passwordString; host = "localhost"; port = "5432"; db = "mydatabase"; user = "danap"; passwordString = "mypassword"; connectionProperties = "jdbc:postgresql://" + host + ":" + port + "/" + db + "?user=" + user + "&password=" + passwordString; // System.out.println(connectionProperties); dbConnection = DriverManager.getConnection(connectionProperties); } catch (SQLException e) { System.err.println(e); }