cancel
Showing results for 
Search instead for 
Did you mean: 

connecting to sql server

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

ankur_garg5
Active Contributor
0 Kudos

Hi rev pas,

Read the following threads, I am sure you will find some clue:

/thread/677339 [original link is broken]

Bye

Ankur

xxxxxx (please read forum rules)

Edited by: Armin Reichert on Jan 17, 2008 10:19 AM

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Rev Pas,

Refer the following thread

1.

Regards,

P.Manivannan

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi,

Please check following blog:

(Using other Database)