Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: JDBC doesn't recognize records from SQLPLUS

Re: JDBC doesn't recognize records from SQLPLUS

From: Jim Kennedy <kennedy-down_with_spammers_at_attbi.com>
Date: Sat, 08 Feb 2003 03:11:57 GMT
Message-ID: <1A_0a.31123$Ec4.21995@rwcrnsc52.ops.asp.att.net>


My guess is that the JDBC is doing a commit after every insert of a record. (default is - ugh - autocommit) Whereas SQLPlus does not, it would only issue a commit if you issued one. So try:

     CREATE TABLE testtable1( field1    VARCHAR2(200) );
     INSERT into testtable1 VALUES ('rec1-sql');
     INSERT into testtable1 VALUES ('rec2-sql');
commit;
then see if you see the results in the JDBC driver, bet you do. Jim
--
Replace part of the email address: kennedy-down_with_spammers_at_attbi.com
with family.  Remove the negative part, keep the minus sign.  You can figure
it out.
"Peter Chatterton" <peter_at_chatterton.name> wrote in message
news:VYZ0a.5519$Pg6.1169387_at_news20.bellglobal.com...

> JDBC doesn't recognize records from SQLPLUS
> I'm using 9iAS under win2000.
> The JDBC is run in a servlet with java 1.2 under Textpad 4.5.0 32 bit.
>
> In sql*plus:
> CREATE TABLE testtable1( field1 VARCHAR2(200) );
> INSERT into testtable1 VALUES ('rec1-sql');
> INSERT into testtable1 VALUES ('rec2-sql');
>
> In the servlet/jdbc:
> " INSERT INTO testtable1 VALUES( 'rec3 from jdbc' ) "
>
> From sql*plus:
> SQL> SELECT * from testtable1;
> FIELD1
> -------------------
> rec1-sql
> rec2-sql
> rec3 from jdbc
>
> In the servlet/jdbc:
> PreparedStatement ps = conn.prepareStatement( "SELECT * FROM
> testtable1" );
> ResultSet rs = ps.executeQuery();
> while( rs.next() )
> {
> PrintWriter out.println( rs.getString( 1 ) );
> }
>
> The PrintWriter output is:
> "rec3 from jdbc "
>
> Hope you can help,
> and thanks,
> Peter.
>
>
>
Received on Fri Feb 07 2003 - 21:11:57 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US