@@ -163,7 +163,7 @@ In the first method, your code implicitly loads the driver using the
163
163
Class.forName() method. For <application>Postgres</application>, you would use:
164
164
165
165
<programlisting>
166
- Class.forName(<literal> postgresql.Driver</literal> );
166
+ Class.forName(" postgresql.Driver" );
167
167
</programlisting>
168
168
169
169
This will load the driver, and while loading, the driver will automatically
@@ -380,9 +380,9 @@ An example is as follows:
380
380
381
381
<programlisting>
382
382
Statement st = db.createStatement();
383
- ResultSet rs = st.executeQuery(<literal> select * from mytable</literal> );
383
+ ResultSet rs = st.executeQuery(" select * from mytable" );
384
384
while(rs.next()) {
385
- System.out.print(<literal> Column 1 returned </literal> );
385
+ System.out.print(" Column 1 returned " );
386
386
System.out.println(rs.getString(1));
387
387
}
388
388
rs.close();
@@ -400,7 +400,7 @@ To perform an update (or any other SQL statement that does not return a
400
400
result), you simply use the executeUpdate() method:
401
401
402
402
<programlisting>
403
- st.executeUpdate(<literal> create table basic (a int2, b int2)</literal> );
403
+ st.executeUpdate(" create table basic (a int2, b int2)" );
404
404
</programlisting>
405
405
</para>
406
406
</sect1>
@@ -455,9 +455,9 @@ create table images (imgname name,imgoid oid);
455
455
To insert an image, you would use:
456
456
457
457
<programlisting>
458
- File file = new File(<literal> myimage.gif</literal> );
458
+ File file = new File(" myimage.gif" );
459
459
FileInputStream fis = new FileInputStream(file);
460
- PreparedStatement ps = conn.prepareStatement(<literal> insert into images values (?,?)</literal> );
460
+ PreparedStatement ps = conn.prepareStatement(" insert into images values (?,?)" );
461
461
ps.setString(1,file.getName());
462
462
ps.setBinaryStream(2,fis,file.length());
463
463
ps.executeUpdate();
@@ -477,8 +477,8 @@ Retrieving an image is even easier (I'm using PreparedStatement here, but
477
477
Statement can equally be used):
478
478
479
479
<programlisting>
480
- PreparedStatement ps = con.prepareStatement(<literal> select oid from images where name=?</literal> );
481
- ps.setString(1,<literal> myimage.gif</literal> );
480
+ PreparedStatement ps = con.prepareStatement(" select oid from images where name=?" );
481
+ ps.setString(1," myimage.gif" );
482
482
ResultSet rs = ps.executeQuery();
483
483
if(rs!=null) {
484
484
while(rs.next()) {
0 commit comments