0 Replies Latest reply on Oct 25, 2001 4:47 AM by infosd

    about autocommit

    infosd

      hi:

      I meet a problem when acess data of sqlserver2000,

      I use jdbc driver jar is "JSQLConnect.jar" type 4,It is download from "http://www.j-netdirect.com".

      in jboss.jcml file:
      <!--jdbc-->


      com.jnetdirect.jsql.JSQLDriver




      org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl
      CapPool
      jdbc:JSQLConnect://172.20.54.187:1433/database=serviceanywhere/user=serviceanywhere
      serviceanywhere
      dev




      my problem :

      System.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
      System.setProperty("java.naming.provider.url","localhost:1099");
      InitialContext ctx = new InitialContext();
      Object ref = ctx.lookup("java:/CapPool");
      DataSource ds = (DataSource)ref;
      Connection conn = ds.getConnection() ;
      conn.setAutoCommit(true); //if no this line,then result is not right
      String sql = "insert into sd (b,c) values ('a','b')";
      Statement sm = conn.createStatement();
      sm.execute(sql) ;
      sm.close() ;
      conn.close() ;



      May I not set autocommit=true in program.