Hi Andrius, there is nothing weird with the code ... it should work. However, if this hangs this possibly means that the network connection hangs.
Try 'pinging' the machine 'andriusxp' from your client, and look whether this takes long, or hangs. If yes, look into your network configuration whether this is the case. Perhaps you may be also a victim of a problem described before: http://listserv.sap.com/pipermail/sapdb.general/2001-January/006388.html Regards Alexander Schr�der SAP Labs Berlin > -----Original Message----- > From: Andrius Vilciauskas [mailto:[EMAIL PROTECTED]] > Sent: Monday, December 02, 2002 1:29 PM > To: [EMAIL PROTECTED] > Subject: JDBC. Why this code hangs pc. > > > Hello, > > I'm not very experienced in sapdb and java. I need > explainaition why my code > hangs pc. Thanks in advance . > Three classes: > > public class Database { > Connection connection; > public Database() { > try { > Class.forName("com.sap.dbtech.jdbc.DriverSapDB");// > } catch (ClassNotFoundException e) {}; > try{ > connection = java.sql.DriverManager.getConnection ("jdbc:sapdb://" + > "andriusxp" + "/" + "erp_dev", > "dba", "dba"); > } catch (SQLException e){ > System.out.println(e.getMessage()); > }; > } > public Connection getConnection() { > return connection; > } > > } > > public class TableA { > Connection con; > > public void setConnection(Connection conn) { > con = conn; > } > > public void update() { > try { > Statement stmt = > con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, > > ResultSet.CONCUR_UPDATABLE); > ResultSet rs = stmt.executeQuery("select * from erp_partners"); > rs.next(); > String hello = rs.getString(2); > > rs.updateString(2, "AA"); // PROBLEM IS HERE > rs.updateRow(); > System.out.println(hello); > }catch (SQLException e) { > System.out.println(e.getMessage()); > } > > } > > } > > > public class Main { > > public Main() { > Database db = new Database(); > Connection conn = db.getConnection(); > TableA a = new TableA(); > a.setConnection(conn); > a.update(); > System.out.println("End"); > } > > public static void main(String[] args) { > Main main = new Main(); > } > } > > > > > > _______________________________________________ > sapdb.general mailing list > [EMAIL PROTECTED] > http://listserv.sap.com/mailman/listinfo/sapdb.general > _______________________________________________ sapdb.general mailing list [EMAIL PROTECTED] http://listserv.sap.com/mailman/listinfo/sapdb.general
