From: | "Gordon A(dot) Campbell" <gordie(at)columbia(dot)edu> |
---|---|
To: | pgsql-interfaces(at)postgresql(dot)org |
Subject: | No Postgres username specified in packet |
Date: | 2000-07-12 17:54:21 |
Message-ID: | Pine.GSO.4.10.10007121353320.2164-100000@konichiwa.cc.columbia.edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
First crack at using postgres. I'll take whatever suggestions you can
pass on. Running under Linux/Redhat. Has anybody seen this error? Checked
to see if -i was there, checked classpath to point to the .jar files.
Is this a "normal" error? Doesn't seem like it's getting past the driver
call.
$java sample
Exception caught.
Something unusual has occured to cause the driver to fail. Please report
this exception: java.sql.SQLException: No Postgres username specified in
startup packet.
Something unusual has occured to cause the driver to fail. Please report
this exception: java.sql.SQLException: No Postgres username specified in
startup packet.
at org.postgresql.Driver.connect(Driver.java:125)
at java.sql.DriverManager.getConnection(DriverManager.java:453)
at java.sql.DriverManager.getConnection(DriverManager.java:133)
at sample.<init>(sample.java:18)
at sample.main(sample.java:47)
import java.io.*;
import java.sql.*;
public class sample
{
Connection conn;
Statement stmt;
String state_code;
public sample() throws ClassNotFoundException, FileNotFoundException,
IOException, SQLException
{
Class.forName("org.postgresql.Driver");
System.err.println("made it this far");
System.out.println("made it this far");
conn =
DriverManager.getConnection("jdbc:postgresql://127.0.0.1/testdb","testuser","");
stmt = conn.createStatement();
System.out.print("Enter a state code: ");
System.out.flush();
BufferedReader r = new BufferedReader(new
InputStreamReader(System.in));
state_code = r.readLine();
ResultSet res = stmt.executeQuery(
"Select name " +
"From statename " +
"Where code = '" + state_code + "'");
if (res !=null)
while(res.next())
{
String state_name = res.getString(1);
System.out.println(state_name);
}
res.close();
stmt.close();
conn.close();
}
public static void main(String args[])
{
try{
sample testdb = new sample();
}catch(Exception exc)
{
System.err.println("Exception caught. \n" + exc);
exc.printStackTrace();
}
}
}
From | Date | Subject | |
---|---|---|---|
Next Message | Mark Radulovich | 2000-07-12 18:05:56 | Re: Subject: IIS4 ODBC LOGGING TO POSTGRES - CRASH HELP :) |
Previous Message | Jeff Waugh | 2000-07-12 17:35:14 | Re: Re: [INTERFACES] Re: Link to postgesql components |