on 12-22-2005 10:11 PM
Hello,
I've been going through posts in here to try to find out howto access and retrieve data from a SQLServer database.
We are making a Webdynpro app that is using access to both SAP and SQLServer data and I need to know howto create a connection and retrieving data from SQLServer with a EJB.
Can someone please show me a complete example on howto do this with a EJB? or is there a better/simpler way to do it that with an EJB?.
I'm a beginner at EJB so please bear with me...
I've looked at some examples in here but I can't figure out where (in files) to put the code snippets I've found.
Thank you
Hi,
This is a simple way to make a connection to a DB (in
this case i have used the DB which is used by the WAS).
javax.naming.InitialContext ctx = new javax.naming.InitialContext();
javax.sql.DataSource ds =(javax.sql.DataSource)
ctx.lookup("jdbc/<DATABASE ALIAS NAME>");
java.sql.Connection conn = ds.getConnection();
java.sql.Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("<your query here>");
Read the retrieved values from ResultSet and store it in bean.
Thanks
Senthil
P.S: Reward Points for useful answers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Check out this link as well.
http://help.sap.com/saphelp_nw04/helpdata/en/43/2eafd8d2f30d24e10000000a1553f7/frameset.htm
Thanks
Senthil
P.S: Reward Points for useful answers
Hi Peter,
Refer the below link.It will be helpful surely.
http://help.sap.com/saphelp_nw04/helpdata/en/f8/bdfe80d9a3b048a5fb32a7d149774e/frameset.htm
regards,
Guru
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.