on 02-01-2008 10:20 AM
Ive seen same title subjects but apparently these topics have been deleted. Anyway,
I have a data base named "TestDB", under url www.mysql.com/TestDB. I did in it 2 fields, "ProjectNr", "ProjectName".
Now, I have Webdyn Pro app with two InputFields binded to Contexts "ProjectNr", "ProjectName" and a button "Save"
What code do I need to write in onActionSave() part to make data written into those two fields be saved in sql database after pressing Save button.
Hi,
Following is the code, pl aligh that to your requirement
try {
Class.forName("com.sap.dbtech.jdbc.DriverSapDB");
String url="jdbc:sapdb://<HostID>/J2E?sqlmode=ORACLE";
Connection con=DriverManager.getConnection(url,"UserID","password");
String projectID = wdContext.current<Yournode>Element().get<yourAttribute>();
String projectName = wdContext.current<YourNode>Element().get<your Attribute>();
String sql = "insert into Project values (?,?)";
PreparedStatement stmt = con.prepareStatement(sql);
stmt.setString(1, projectID);
stmt.setString(1, projectName);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try to make use of JNDI for database connections. That s one of the best practises.
http://java.sun.com/javase/technologies/database/
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.