Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

web Dynpro application connecting to sql server

Hi,

I want to fetch data from SQL Server using webdynpro. Can anyone suggest me the steps to do this? I need to connect the SQL Server also to portal. I found one using visual admin another using system object in portal. Which is better way and how can use that connected system in coding to retrive data.

Please help me. Points will be awarded for helpful answets.

Thanks,

Raz

replied

Hi,

You place the code where ever you want to establish the connection to the data base which is located remotely in a diffrent IP from NWDS.

The requirement for this we have 3 jar files.Which you have to copy in the lib folder.

those are:-

1.msbase.jar

2.mssqlserver.jar

3.msutil.jar

XX.XX.XX.XX->IP Address

XXXX---->Port no

Code:-

Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");

conn = DriverManager.getConnection( "jdbc:microsoft:sqlserver://XX.XX.XX.XX:XXXX;databaseName=TrackingSystem","sa","sa" ) ;

Statement st = conn.createStatement();

String str = "select * from User Table";

ResultSet rs = st.executeQuery(str);

while(rs.next())

{

String str1 = rs.getString(1);

wdComponentAPI.getMessageManager().reportSuccess(str1);

}

Thanks & Regards,

Lokesh.

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question