on 06-20-2007 9:41 AM
please give me some sample examples which r using database connection.
and also give me some useful information regarding the database of the SAP
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi shanto,
if u use oracle database do the following steps and import the class12.jar file.
1) Open the J2EE perspective
2) Create an EJB Module project
3) Right click on ejbModule, create a new EJB (select your EJB type)
4) While creating the ejb itself, you can add business methods by clicking Next in the UI. Another option is after creating the ejb, write the method in the bean, then select the method from ejb-jar.xml -> <bean name> ->method. Right click and select propogate to local & remote.
5) Double click on ejb-j2ee-engine.xml. select your bean and specify a Jndi name for eg: MyJndi.
6) Right click on the EJB project and add classes12.zip file (provided by Oracle) to its build path. (under libraries tab). Also check the same file under Order & Export.
7) Create an Enterprise Application project.
😎 Right click on the EJB module project and select add to EAR project, then select the created EAR project.
9) Right click on the EJB project, select Build EJB Archive
10) Right click on the EAR project, select Build Application Archive
11) Open the WebDynpro perspective, open a new project, right click on the project ->properties. Do the following configurations :-
Java Build path - select the EJB project from projects , check the selected project under Order & Export
Project references select the EAR project
WebDynpro references select sharing references tab, click add & make an entry as : <vendor>/<EAR project name without .ear extension>
You can find the vendor name under application-j2ee-engine.xml file of the EAR project. By default it is sap.com. So if my EAR projects name is ABC, my entry would look like sap.com/ABC
12) Now the configurations are over and the EJB can be invoked by writing the client code inside the webdynpro component. Like:
InitialContext context = new InitialContext();
Object obj = context.lookup("MyJndi");
MyEJBHome home = MyEJBHome)PortableRemoteObject.narrow(obj,MyEJBHome.class);
MyEJB mybean = home.create();
int a = 0;
a= mybean.add(10,15);
wdContext.currentContextElement().setSum(a);
where MyEJB is my EJB name and MyJndi is my JNDI name
To connect to Oracle , you can write the usual Java code (given below) as a business methos of the ejb (similar to add() method in the example). And access it like mybean.<businessMethodName>().
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@Oracle_server_ip:Oracle port:SID of the Database","user_name","password");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("your query");
the above information is useful reward useful points..
Regards,
P.Manivannan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shanto
Access the below Link
Title : Accessing ABAP Functions in Web Dynpro
Link :
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/webcontent/uuid/28113de9-0601-0010-71a3-c8780... [original link is broken]
Rgds
-SS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Check this URL and you may get some idea
General
http://help.sap.com/saphelp_nw04/helpdata/en/a5/55ecf8fc6c11d28e610000e816c2ff/frameset.htm
http://help.sap.com/saphelp_nw70/helpdata/en/44/38d53c3d4b085be10000000a114084/frameset.htm
http://help.sap.com/saphelp_nw70/helpdata/en/76/4a42f4f16d11d1ad15080009b0fb56/frameset.htm
For Oracle
http://help.sap.com/saphelp_nw04/helpdata/en/52/8271403017587ee10000000a155106/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/4c/5f70403590ca01e10000000a155106/frameset.htm
Threads,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.