Hello all!
I have created a simple database connection application in java2. The app
compiles just fine. When I run it, I just go right back to the prompt, as
if the program completed successfully. The problem is that it should have
failed.
A little background:
I want to connect to a postgres database running (with -i invoked) on Linux
from a Windows XP Workstation.
1. I downloaded the postgres jar file "pg73jdbc3.jar" from the web site. I
placed this file in the C:\java\jre\lib\ext directory.
2. I set CLASSPATH=C:\java\jre\lib\ext\pg73jdbc3.jar;c:\JavaApps
3. I wrote a simple program to test this connection.
import java.sql.*;
public class UsrPwdVer
{
private Connection con;
private UsrPwdVer()
{
try
{
Class.forName("org.postgres.Driver");
}
catch (Exception e)
{
System.out.println(
"Failed to load postgres driver.");
return;
}
try
{
con =
DriverManager.getConnection("jdbc:postgresql://192.168.1.101/pgerp","pg","pg
");
}
catch (Exception e)
{
System.err.println("problems connecting to database");
}
}
public static void main(String args[])
{
}
}
pg is not a user so I should have expected to see "problems connecting to
database".
What did I miss?
Sincerely,
David Langschied
Langschied Consulting Services
25644 Mackinac
Roseville, MI 48066
Phone: (586)777-7542
Cell: (248)789-8493
e-mail: dlangschied@ameritech.net