-
Barry Lind authoredBarry Lind authored
Connection.java 33.46 KiB
package org.postgresql;
import java.io.*;
import java.net.*;
import java.sql.*;
import java.util.*;
import org.postgresql.Field;
import org.postgresql.fastpath.*;
import org.postgresql.largeobject.*;
import org.postgresql.util.*;
import org.postgresql.core.*;
/**
* $Id: Connection.java,v 1.34 2001/11/01 01:08:36 barry Exp $
*
* This abstract class is used by org.postgresql.Driver to open either the JDBC1 or
* JDBC2 versions of the Connection class.
*
*/
public abstract class Connection
{
// This is the network stream associated with this connection
public PG_Stream pg_stream;
private String PG_HOST;
private int PG_PORT;
private String PG_USER;
private String PG_PASSWORD;
private String PG_DATABASE;
private boolean PG_STATUS;
private String compatible;
/**
* The encoding to use for this connection.
*/
private Encoding encoding = Encoding.defaultEncoding();
private String dbVersionNumber;
public boolean CONNECTION_OK = true;
public boolean CONNECTION_BAD = false;
public boolean autoCommit = true;
public boolean readOnly = false;
public Driver this_driver;
private String this_url;
private String cursor = null; // The positioned update cursor name
// These are new for v6.3, they determine the current protocol versions
// supported by this version of the driver. They are defined in
// src/include/libpq/pqcomm.h
protected static final int PG_PROTOCOL_LATEST_MAJOR = 2;
protected static final int PG_PROTOCOL_LATEST_MINOR = 0;
private static final int SM_DATABASE = 64;
private static final int SM_USER = 32;
private static final int SM_OPTIONS = 64;
private static final int SM_UNUSED = 64;
private static final int SM_TTY = 64;
private static final int AUTH_REQ_OK = 0;
private static final int AUTH_REQ_KRB4 = 1;
private static final int AUTH_REQ_KRB5 = 2;
private static final int AUTH_REQ_PASSWORD = 3;
private static final int AUTH_REQ_CRYPT = 4;
// New for 6.3, salt value for crypt authorisation
private String salt;
// These are used to cache oids, PGTypes and SQLTypes