Connection String
От | Rajeev Menon |
---|---|
Тема | Connection String |
Дата | |
Msg-id | fc1bd8470603080024w4de5c61fi2234c2d36e063e6e@mail.gmail.com обсуждение исходный текст |
Список | pgsql-jdbc |
/*
// One Point Connection to the database.
//
*/
package beans;
import java.io.*;
import java.sql.*;
public final class ConnectionHandler
{
static String url;
static Connection con;
static boolean isConnected;
public static Connection getConnection ()
{
url="jdbc:postgresql://<ipaddress>:5432/<databasebname>";
try
{
Class.forName("org.postgresql.Driver");
}
catch (ClassNotFoundException e)
{
System.out.println("Printing The Exception :");
System.out.println (e);
System.out.println("Printing The Stack Trace :");
e.printStackTrace ();
}
try
{
System.out.println("****************B4 GETCONNECTION*********************************");
con = DriverManager.getConnection (url,"root","");
isConnected = true;
System.out.println("****************AFTER GETCONNECTION*********************************");
catch (SQLException e)
{
System.out.println (e);
e.printStackTrace ();
}
return con;
}
--
RegardsRajeev Menon
EXCELLENCE IS MORE FUN THAN MEDIOCRITY!
В списке pgsql-jdbc по дате отправления: