بتاريخ: 4 أبريل 201511 سنة comment_261398 السلام عليكم انا كنت محتاج اكتب كود الinsert برمجيا فلقيت كود وحاولت اجربة بس المشكلة اللي بتواجهني في الurl بيقولي انه غير موجود فياريت اصحاب الخبرة يدلوني علي الجواب الصحيح UserInfo user=(UserInfo)FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("userKey"); String username="hr"; String password="hr"; String thisurl="jdbc:oralce:this:@localhost:1521:orcl"; String sql= "INSERT INTO APP_USERS (USER_ID,USER_NAME,PASSWORD,FIRST_NAME,LAST_NAME,USER_TYPE)"+" VALUES('"+getUserId()+"','"+getUserName()+"','"+getPassword()+"','"+getFirstName()+"','"+getLastName()+"','"+getUserType()+"')"; try{ DriverManager.registerDriver((new OracleDriver())); Connection con=DriverManager.getConnection(thisurl, username, password); Statement stat=con.createStatement(); stat.executeUpdate(sql); setInsertMeg("تم إضافة المستخدم بنجاح"); con.close(); stat.close(); } catch (SQLException e) { setInsertMeg("غير قادر على تسجيل المستخدم "+e.getMessage()); } return null; تقديم بلاغ
بتاريخ: 4 أبريل 201511 سنة comment_261400 الخطا بهذا السطر String thisurl="jdbc:oralce:this:@localhost:1521:orcl"; الصحيح هو "jdbc:oracle:thin:@localhost:1521:orcl" ; oracle بدل من oralce thin بدل من this وإن شاء الله تحل المشكلة تقديم بلاغ
بتاريخ: 4 أبريل 201511 سنة كاتب الموضوع comment_261402 استاذة ميسم والله مش عارف اشكر حضرتك اذاي جزاكي الله كل خير الكود اشتغل معايا الحمدلله تقديم بلاغ
انضم إلى المناقشة
يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.