> 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);
}