on 01-08-2008 5:28 AM
Hi Friends
I have desinged a form in NWDS which consists of two input fields and a button...and also created a table in SQLSERVER...
When the user enters the data in the input fields and clicks on the button the data must get inserted into the table which is present in SQLSERVER.
The EP server is installed on the SQLSERVER ie both the servers are on the same machine
Can anyone please provide me the code how to connect to this SQLSERVER( I mean the JDBC coding That I need to write in the implementation of the view)
Do I require any drivers to be installed.Prior to doing this..
And also wht information Do I need to have regarding the SQLSERVER?
Thanks in advance
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,
try{
Context ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("jdbc/<<DataSourceName>>");
Connection con=ds.getConnection();
Statement st=con.createStatement();
PreparedStatement pSt=con.prepareStatement( "insert into TABLENAME values(?, ?)");
pSt.set<YourType>( 1,wdContext.current<Your ContextElement>().get<your Attribute>);
pSt.setString( 2,wdContext.current<Your ContextElement>().get<your Attribute>);
pSt.execute() ;
wdComponentAPI .getMessageManager().reportSuccess("Executed sucesfully");
}
catch(Exception e)
{
wdComponentAPI.getMessageManager() .reportWarning( e.toString() );
}
Regards
Ayyapparaj
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.
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.