Connect to SQL server 2005 in web dynpro java

10-11  Source: Network gathering  Views:2 

Advertisement
Hi,
I am new to web dynpro. I want to coonect to SQL server 2005 server from my simple application.
For that what and all the prerequisetion and what and all the steps to follow.
I have created a database and the table too. I have created the application too. But i am not able to connect to sql. what might be the problem. I tried to create the data source in visual administration. and written code in the view like this.
try {
                                               String userName = "jktuser";
               String password = "jkt12345";
               String url ="jdbc:microsoft:sqlserver://jktr3:50000;database=student";
               Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver ").newInstance();
               Connection con =DriverManager.getConnection(url, userName, password);
               System.out.println("Database connection established");
               Statement st = con.createStatement();
               String str = "select * from studentdata";
               ResultSet rs = st.executeQuery(str);
               while (rs.next()) {
               String str1 = rs.getString(1);
               wdComponentAPI.getMessageManager().reportSuccess(str1);
                                                String str2 = rs.getString(2);
               wdComponentAPI.getMessageManager().reportSuccess(str2);     
               wdComponentAPI.getMessageManager().reportSuccess("sukces");
          } catch (Exception e) {
               wdComponentAPI.getMessageManager().reportWarning(e.toString());
And i am getting this error
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]End of stream was detected on a read.
Plz any one help me in this.
Regards,
H.V.Swathi
Edited by: H.V Swathi on Nov 21, 2008 6:46 AM
Edited by: H.V Swathi on Nov 21, 2008 7:16 AM
Edited by: H.V Swathi on Nov 21, 2008 7:17 AM
Hi,
I have tried all the steps to configure the remote connection but it is giving an error that says,
"Computer localhost does not exist on the network, or the computer cannot be configured remotely. Verify that the remote computer has the required Windows Management Instrumentation components and then try again. (SQLSAC)
ADDITIONAL INFORMATION:
An exception occurred in SMO while trying to manage a service. (Microsoft.SqlServer.Smo)
For help, click: http://go.microsoft.com/fwlink?ProdName=MicrosoftSQLServer&ProdVer=9.00.1399.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.InnerWmiException&LinkId=20476
Failed to retrieve data for this request. (Microsoft.SqlServer.SmoEnum)
For help, click: http://go.microsoft.com/fwlink?ProdName=MicrosoftSQLServer&LinkId=20476
The operation could not be completed. (WinMgmt)
BUTTONS:
OK
Please i welcome your valuable inputs.
Thanks & Regards
Swathi
Related articles