cancel
Showing results for 
Search instead for 
Did you mean: 

web Dynpro application connecting to sql server

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

lokesh_kamana
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

Thanks to all. I can able to access the SQL Database.

Regards,

Raz

Answers (2)

Answers (2)

Former Member
0 Kudos

This documents might help you:

Refer this blog, how to connect Backend using Wb Dynpro:

Thanks

Krishna

vmadhuvarshi_
Contributor
0 Kudos

Raz,

It is possible to fetch data from any database in a WD Java application.

Follow [this thread|; for simple steps to get the data.

Hope this helps.

Vishwas.

Former Member
0 Kudos

Hi Vishwas,

Thanks for reply, that is for Oracle and can you please give me sample code for SQL Server? Mainly for these statements?

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");

In the above it mentioned code, it is for Oracle, please let me know for SQL Server also.

Thanks,

Raz

vmadhuvarshi_
Contributor
0 Kudos

Raz,

This should help.

MS SQL Server 2000

Driver files msbase.jar, msutil.jar, mssqlserver.jar

Connection URL jdbc:sqlserver://<host_name>:<port>;DatabaseName=<db_name>

Driver name com.microsoft.jdbc.sqlserver.SQLServerDriver

MS SQL Server 2005

Driver file sqljdbc.jar

Connection URL jdbc:sqlserver://<host_name>:<port>;database=<db_name>

Driver name com.microsoft.sqlserver.jdbc.SQLServerDriver

I got this information from [Here|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/vc/jdbc%2bconnection%2bsetup].

Vishwas.

Former Member
0 Kudos

Hi Vishwas,

Are these jar files need to add to the project?

Thanks,

Raz

vmadhuvarshi_
Contributor
0 Kudos

See the Wiki article pointed to in earlier post. That should answer your question.