Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: JDBC doesn't recognize records from SQLPLUS
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;
-- 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...Received on Fri Feb 07 2003 - 21:11:57 CST
> 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.
>
>
>
![]() |
![]() |