Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package dbutil;
- import java.sql.*;
- public class DBConnect {
- Connection conn = null;
- public DBConnect() throws Exception {
- Class.forName("oracle.jdbc.OracleDriver");
- Connection conn =
- DriverManager.getConnection("jdbc:oracle:thin:
- @localhost:1521:XE","system","9424705385");
- }
- public void queryExecuter(String sql) throws Exception
- {
- //for insert, update and Delete DML
- Statement stat = conn.createStatement();
- stat.execute(sql);
- stat.close();
- conn.close();
- }
- public ResultSet queryReturner(String sql) throws Exception
- { //select statement
- Statement stat = conn.createStatement();
- ResultSet rs = stat.executeQuery(sql);
- return rs;
- }
- }
- package dbutil;
- import java.sql.*;
- public class RegisterUser {
- public void insertUser
- (String email,String pass,String name,String mobile)
- throws Exception
- {
- String sql = "insert into webreg
- value('"+email+"','"+pass+"','"+name+"','"+mobile+"')";
- DBConnect x = new DBConnect();
- x.queryExecuter(sql); //line showing error
- }
- public ResultSet getAllUser() throws Exception
- {
- DBConnect x = new DBConnect();
- ResultSet rs = x.queryReturner("select * from webreg"); //line
- showing error
- return rs;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement