cancel
Showing results for 
Search instead for 
Did you mean: 

Help to connect Database for CE7.1

Former Member
0 Kudos

Hi Experts,

I am new to webdynpro for java world.can you plese help me.....

I want to get the database connection from my webdynpro for java application. for that

I have installed CE7.1 j2ee Server with MAXDB database.

I have installed SQL Studio also.

Can you please send the details to connect to database from my java program.

If you send detailed steps it will be very very helpful for me.

Thanks in advance.

Regards,

Shashi.

Accepted Solutions (0)

Answers (1)

Answers (1)

Vlado
Advisor
Advisor
0 Kudos

Hi Shashi,

You need to use a datasource. For more information: [Application Resources Management|http://help.sap.com/saphelp_nwce10/helpdata/en/44/e3c34b4c836c2fe10000000a114a6b/frameset.htm].

HTH!

\-- Vladimir

Former Member
0 Kudos

Hi,

Thanks for your quick response.

Can you please give the "CPDS Class Name"

Driver Class Name and Database URL for SQL .

If possible can you please give the links to download Jdbc Driver for SQL Studio. That will be very use full for me.

Thanks and Regards,

Shashikiran.B

Former Member
0 Kudos

Hi Vladimir Pavlov ,

Can you please send the Link to develop Sample application to connect to SQL DB by using Default SQL DataSource.

Thanks and Regards,

Shashikiran.B

Vlado
Advisor
Advisor
0 Kudos

>

> Can you please give the "CPDS Class Name"

> Driver Class Name and Database URL for SQL .

>

The values depend on the particular JDBC driver used.

>

> If possible can you please give the links to download Jdbc Driver for SQL Studio. That will be very use full for me.

>

You don't need a separate driver to connect to the system DB which as far as I understand is MaxDB in your case. You can use the system driver (and probably also the system datasource - so no need for a custom datasource either).

HTH!

\-- Vladimir

Vlado
Advisor
Advisor
0 Kudos

[Developing Persistence Using Open SQL/JDBC|http://help.sap.com/saphelp_nwce10/helpdata/en/57/1177611c11cd418564cdbc1488ce33/frameset.htm]

Former Member
0 Kudos

Hi,

I have DefaultDriver ="SYSTEM_DRIVER"

Default DataSource ="SAPCE1DB"

I am using following code template in wdDoInit() method to connect database

InitialContext ic = new InitialContext();

DataSource ds = (DataSource)ic.lookup("java:comp/env/SAPCE1DB");

Connection con = ds.getConnection();

Statement st = con.createStatement();

st.executeUpdate("insert into sample2 values(11)");

But i am unable to insert into sample2 table.

Can you please help me on this one.

Thanks and Regards,

Shashikiran.B

Vlado
Advisor
Advisor
0 Kudos

The "java:comp/env/" lookup works only for standard Java EE components, e.g. EJBs, JSPs, servlets. And besides, you have to define a reference, e.g. resource-ref, in the corresponding deployment descriptor, in order to use it, or you have to use dependency injection (@Resource).

Anyway, working with the DB directly in the UI layer (Web Dynpro) is not a good idea. You'd better consider the MVC paradigm and move the DB access code to the business layer (EJB) or use JPA instead of pure JDBC. The EJBs would be called by Web Dynpro then. Some helpful links about this:

[Importing Enterprise JavaBean (EJB) Models|http://help.sap.com/saphelp_nwce10/helpdata/en/45/dd45e4bc295595e10000000a1553f7/frameset.htm]

[Developing Business Logic with EJB 3.0|http://help.sap.com/saphelp_nwce10/helpdata/en/44/e9af22b9dc03fde10000000a1553f6/frameset.htm]

[Using JPA in the Persistence Layer|http://help.sap.com/saphelp_nwce10/helpdata/en/44/eba6292f446c30e10000000a114a6b/frameset.htm]

Regards,

\-- Vladimir

Former Member
0 Kudos

HI,

Can you please give the steps to connect to Database by using simple webdyn pro application.

with out using EJBS or -


.

Please give rply as soon as possible........

Regards,

Shashikiran.

Vlado
Advisor
Advisor