cancel
Showing results for 
Search instead for 
Did you mean: 

Storing database in array string at runtime

Former Member
0 Kudos

Hi all, as mention in the given code I have taken the database in the respected String arrays, but instead to take in single array for each attribute ,I want to take in single String[] array for all database attribute.

Basically whenever I am inserting or selecting database the application of webdynpro is taking nearly 20 secs which I have to reduce it to nearly 4-5 secs... So I am thinking to take the entire database in a single array [] for insert or selection on it and update in the database only onceu2026

So plz guide me, how to resolve this database issue through single string [] array or is their in any other way to resolve, the reduction of time complexity of the runtime applications.

Try

{

String driver name="com.microsoft.jdbc.sqlserver.SQLServerDriver";

Class.forName (driver name);

String URL="jdbc:microsoft:sqlserver://**.*..**:1433;

Database Name=*****";

Conn=DriverManager.getConnection (URL,"sa","super");

Statement stmt=conn.createStatement ();

String insertion="Select * from Project ";

Prepared Statement pstmt=conn.prepareStatement (insertion);

Result Set rs=null;

Rs=pstmt.executeQuery ();

String Pname [] = new String [1];

String Tdesc [] = new String [1];

Date Sdate [] = new Date [1];

Date Edate [] = new Date [1];

String NOD [] = new String [1];

While (rs.next ())

{

For (int i=0; i<Pname.length; i++)

{

Pname<i> = rs.getString ("TASKNAME");

Tdesc<i> = rs.getString ("TASKDESC");

Sdate<i> = rs.getDate ("Sdate");

Edate<i> = rs.getDate ("Edate");

NOD<i> = rs.getString ("NOD");

PrivateArrayView.ITableElement element=wdContext.createTableElement ();

element.setTaskname (Pname<i>);

element.setTaskdesc (Tdesc<i>);

element.setStartdate (Sdate<i>);

element.setEnddate (Edate<i>);

element.setNOD (NOD<i>);

wdContext.nodeTable ().add Element (element);

}

Regards:

SK

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

answered

Former Member
0 Kudos

Please see the below thread

Storing database in array string at runtime

Former Member
0 Kudos

Hi sameer ,u forget to the mention the url of the thread in the message.........

former_member185086
Active Contributor
0 Kudos

Hi

Have you done all coding related to database in same component if yes put it in different component which will serve whole back end stuff to your application. It will improve application performance .

Regards

Satish Kumar

Former Member
0 Kudos

Hi satish thanx for the reply..well u mean in other i.e storing in database from other view controller not from the current controller..plz clear if i am wrong...

Regards:

SK

former_member185086
Active Contributor
0 Kudos

Hi

What I mean is Put your complete Database related code in separate Component .which will like a faceless component and only purpose of this component is serving other component if they require anything related to database (either EJB, WebServices etc)

1. Create One Comp ,Write all the method of insertion and deletion into this component controller and expose these method into Interface controller so that other component can use it (It fulfill the criteria of Reuse of the Component ).

2.Define the uses relationship of this component with other ,then starting calling those method.

3. Now the View-Controller role is only to call those method which is required in for example

addData(name,class,age);it could be one of the method which u have defined in Step1

4.So what we will achieve through this is

a) Proper componentization it mean distribution of the task through component.

b) Let View handle only presentation logic of the application(Which is opposite in your case ).

c)Performance of the application it means it reduce the request-response cycle time.

Hope I am clear now,but again u r welcome

Best Regards

Satish Kumar

Former Member
0 Kudos

well satush do u have any doc/pdf related to this so that it willbe easy for me to cover up these..as i dont know how to achieve this...