1
1
<!--
2
- $Header: /cvsroot/pgsql/doc/src/sgml/Attic/jdbc.sgml,v 1.39 2002/10/01 04:09:13 barry Exp $
2
+ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/jdbc.sgml,v 1.40 2002/11/11 07:31:28 barry Exp $
3
3
-->
4
4
5
5
<chapter id="jdbc">
@@ -684,7 +684,7 @@ CREATE TABLE imagesLO (imgname text, imgOID OID);
684
684
conn.setAutoCommit(false);
685
685
686
686
// Get the Large Object Manager to perform operations with
687
- LargeObjectManager lobj = ((org.postgresql.Connection )conn).getLargeObjectAPI();
687
+ LargeObjectManager lobj = ((org.postgresql.PGConnection )conn).getLargeObjectAPI();
688
688
689
689
//create a new large object
690
690
int oid = lobj.create(LargeObjectManager.READ | LargeObjectManager.WRITE);
@@ -725,7 +725,7 @@ fis.close();
725
725
conn.setAutoCommit(false);
726
726
727
727
// Get the Large Object Manager to perform operations with
728
- LargeObjectManager lobj = ((org.postgresql.Connection )conn).getLargeObjectAPI();
728
+ LargeObjectManager lobj = ((org.postgresql.PGConnection )conn).getLargeObjectAPI();
729
729
730
730
PreparedStatement ps = con.prepareStatement("SELECT imgOID FROM imagesLO WHERE imgname=?");
731
731
ps.setString(1, "myimage.gif");
@@ -774,33 +774,27 @@ ps.close();
774
774
775
775
<para>
776
776
To access some of the extensions, you need to use some extra
777
- methods in the <classname>org.postgresql.Connection </classname>
777
+ methods in the <classname>org.postgresql.PGConnection </classname>
778
778
class. In this case, you would need to case the return value of
779
779
<function>Driver.getConnection()</function>. For example:
780
780
<programlisting>
781
781
Connection db = Driver.getConnection(url, username, password);
782
782
// ...
783
783
// later on
784
- Fastpath fp = ((org.postgresql.Connection )db).getFastpathAPI();
784
+ Fastpath fp = ((org.postgresql.PGConnection )db).getFastpathAPI();
785
785
</programlisting>
786
786
</para>
787
787
788
788
<sect3>
789
- <title>Class <classname>org.postgresql.Connection </classname></title>
789
+ <title>Class <classname>org.postgresql.PGConnection </classname></title>
790
790
791
791
<synopsis>
792
- public class Connection extends Object implements Connection
793
-
794
- java.lang.Object
795
- |
796
- +----org.postgresql.Connection
792
+ public class PGConnection
797
793
</synopsis>
798
794
799
795
<para>
800
796
These are the extra methods used to gain access to
801
- <productname>PostgreSQL</productname>'s extensions. Methods
802
- defined by <classname>java.sql.Connection</classname> are not
803
- listed.
797
+ <productname>PostgreSQL</productname>'s extensions.
804
798
</para>
805
799
806
800
<sect4>
@@ -822,7 +816,7 @@ public Fastpath getFastpathAPI() throws SQLException
822
816
<programlisting>
823
817
import org.postgresql.fastpath.*;
824
818
...
825
- Fastpath fp = ((org.postgresql.Connection )myconn).getFastpathAPI();
819
+ Fastpath fp = ((org.postgresql.PGConnection )myconn).getFastpathAPI();
826
820
</programlisting>
827
821
where <varname>myconn</> is an open <classname>Connection</> to <productname>PostgreSQL</productname>.
828
822
</para>
@@ -857,7 +851,7 @@ public LargeObjectManager getLargeObjectAPI() throws SQLException
857
851
<programlisting>
858
852
import org.postgresql.largeobject.*;
859
853
...
860
- LargeObjectManager lo = ((org.postgresql.Connection )myconn).getLargeObjectAPI();
854
+ LargeObjectManager lo = ((org.postgresql.PGConnection )myconn).getLargeObjectAPI();
861
855
</programlisting>
862
856
where <varname>myconn</> is an open <classname>Connection</> to
863
857
<productname>PostgreSQL</productname>.
@@ -896,7 +890,7 @@ public void addDataType(String type, String name)
896
890
The best way to use this is as follows:
897
891
<programlisting>
898
892
...
899
- ((org.postgresql.Connection )myconn).addDataType("mytype","my.class.name");
893
+ ((org.postgresql.PGConnection )myconn).addDataType("mytype","my.class.name");
900
894
...
901
895
</programlisting>
902
896
where <varname>myconn</varname> is an open <classname>Connection</> to
@@ -938,12 +932,12 @@ import org.postgresql.fastpath.*;
938
932
Then, in your code, you need to get a
939
933
<classname>FastPath</classname> object:
940
934
<programlisting>
941
- Fastpath fp = ((org.postgresql.Connection )conn).getFastpathAPI();
935
+ Fastpath fp = ((org.postgresql.PGConnection )conn).getFastpathAPI();
942
936
</programlisting>
943
937
This will return an instance associated with the database
944
938
connection that you can use to issue commands. The casing of
945
939
<classname>Connection</classname> to
946
- <classname>org.postgresql.Connection </classname> is required, as
940
+ <classname>org.postgresql.PGConnection </classname> is required, as
947
941
the <function>getFastpathAPI()</function> is an extension method,
948
942
not part of <acronym>JDBC</acronym>. Once you have a
949
943
<classname>Fastpath</classname> instance, you can use the
@@ -2322,14 +2316,14 @@ java.lang.Object
2322
2316
</para>
2323
2317
2324
2318
<para>
2325
- This class can only be created by org.postgresql.Connection . To
2319
+ This class can only be created by org.postgresql.PGConnection . To
2326
2320
get access to this class, use the following segment of code:
2327
2321
<programlisting>
2328
2322
import org.postgresql.largeobject.*;
2329
2323
Connection conn;
2330
2324
LargeObjectManager lobj;
2331
2325
// ... code that opens a connection ...
2332
- lobj = ((org.postgresql.Connection )myconn).getLargeObjectAPI();
2326
+ lobj = ((org.postgresql.PGConnection )myconn).getLargeObjectAPI();
2333
2327
</programlisting>
2334
2328
</para>
2335
2329
0 commit comments