on 09-09-2008 6:05 PM
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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.
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.