Skip to Content
0
Former Member
Oct 23, 2007 at 07:12 AM

Problem in connecting sql server database*urgent*

14 Views

Good afternoon,

I need to do an application that allow user to search for his employees ID and when the server found his employees ID , it will show NAME and his particular from the SQL database at the adobe interactive form.

I recently found this thread regarding how to connect Connect to sql server database from webdynpro with jdbc 2.0 driver ()Connect to sql server database from webdynpro with jdbc 2.0 driver

I tired and these is what i put in VA:

In the screen that appears, under the “main” tab:

1) DataSource Name =MyDataSource

2) Add Alias = MyAlias.

3) Driver Name=SQL Server

4) JDBC Version= select “2.0 (with XA support)”

5) Object Factor = “com.microsoft.jdbcx.sqlserver.SQLServerDataSourceFactory”.

Please omit the quotes.

6) DataSource Type =“ConnectionPoolDataSource”

7) CPDS classname = “com.microsoft.jdbcx.sqlserver.SQLServerDataSource”.

Under Additional tab. Under the additional properties section, type in:

1) Key: serverName, Value: Localhost

2) Key: databaseName, Value: “CSIT”

3) Key: portNumber, value: “ 1433”

4) Key: user, value: admin

5) Key: password, value: ********

6) For SQL Engine, Select Vendor SQL

As for back code at web dynpro (implementation part)

<u><b>I insert these code at my onActionSearch buttom</b></u>

public void onActionSearch(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin onActionSearch(ServerEvent)
    IPrivateInvoiceSummary.IInvoiceDetailElement element =wdContext.createInvoiceDetailElement();
    	
			try{
			   Context ctx = new InitialContext();
			   DataSource ds = (DataSource)ctx.lookup("jdbc/MyAlias");	
	
			   Connection con=ds.getConnection();
			   Statement  st=con.createStatement();
		   
			   ResultSet rs = st.executeQuery("SELECT * FROM InvoiceDetailForm WHERE PVNo= '"+wdContext.currentContextElement().getSearchNo()+"';");
			   while(rs.next()){
			   	
				element.setPVNo(rs.getString("PVNo"));
				element.setPVDate(rs.getString("PVDate"));
				element.setRefNo(rs.getString("RefNo"));
				element.setSection(rs.getString("Section"));
			   }
		   
			   wdContext.nodeInvoiceDetail().bind(element);
		   
			} catch (Exception e)
			{
				wdComponentAPI.getMessageManager().reportWarning(e.toString());
			}
    //@@end
  }

I tired to deploy and run the application, it show everything (My textfield, search button and adobe form).

When i key in employees ID and click search , it prom me that the IE has encountered a problem and needs to close.

May i know the reason behind it?