on 03-29-2005 3:13 PM
Dear all,
Can any one provide me an example project that is accessing (not SAPDB)database ?.
Help me in,
I have the general concepts regarding JDBC , that includes creation of Data Source Name.(Oracle & Aceess).
(using JDBC - ODBC Bridge.)
As like DSN , what is the equivalent in WAS(through Visual Administrator).
And how can i use that "equivalent in WAS " programmatically for data access. Exactly i dont have much concepts about that.
So kindly help me with suitable examples , or links regarding that..
with regards
Kishor .G
Hi Kishor,
You can follow the simple steps below:
1) Create a DataSource in the Visual Admin tool
http://help.sap.com/saphelp_nw04/helpdata/en/b0/6e62f30cbe9e44977c78dbdc7a6b27/frameset.htm
2) Create an EJB project, write a simple session bean and declare a resource reference to the DataSource
http://help.sap.com/saphelp_nw04/helpdata/en/b5/3f533e5ff4d064e10000000a114084/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/64/8590109a86f145958fb22dab86d58d/frameset.htm
3) Create a simple JSP that accesses the session bean
http://help.sap.com/saphelp_nw04/helpdata/en/7d/cf0c8abcc34594ba9d3bbd5dd22155/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/85/496adae9bf40b09653239e9c58f9b0/frameset.htm
4) Build the archives, deploy and run the application
http://help.sap.com/saphelp_nw04/helpdata/en/7f/5c93acbd1343d4be7d79dc298faa7b/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/5c/a3400ed0c6411bbaa5506cce1dbfc9/frameset.htm
The code in the session bean that accesses the DB should look like:
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("java:comp/env/<res-ref-name>");
Connection conn = null;
try {
conn = ds.getConnection();
//do some work thru conn
} finally {
conn.close();
}
If you have a more complex scenario with DB access, you may consider developing CMP entity beans, O/R mapping, relationships, using EJB QL queries, and so on... You can find exhaustive help starting from <a href="http://help.sap.com/saphelp_nw04/helpdata/en/f6/6a9266482d114f9b3e312768578c94/frameset.htm">here</a>.
Hope that helps,
Vladimir
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
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.