Ola,

Friday, January 31, 2003, 12:37:00 PM, you wrote:
C> Paradoxalmente, o JSP obteve um p�ssimo desempenho no acesso a Banco de
C> Dados e o PHP mostrou-se excepcional nesse aspecto."

  Se vc olhar o codigo do cidadao para fazer os testes vc ira ver
imediatamente alguns problemas claros :

  - Usa ODBC para acessar os dados. Uma solucao JDBC nativa nao tende
  a ter melhor performace ?

  - existem varios loops onde o teste do BD e executado. dentro de
  cada loop a conexao e efetuada e fechada. pq nao e efetuada uma
  unica conexao no inicio do teste e esta nao e fechada apenas no
  final ?

                                startTime[4] = now.getTime();
                                String SQL;
            
                     String server = "jdbc:odbc:localhost";
                String user   = "";
                        String pass   = ""; 
                        Connection con;
                        String createString;
                        
                        Statement stmt;
                                
                                for (int i = 1; i <= 100; i++){
                                        SQL = "INSERT INTO alunos (matricula,nomeal) 
VALUES (" + i + ",'Aluno " + i + "')";
                                        
                                try {
                                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                                } 
                                catch(java.lang.ClassNotFoundException e) {
                                System.err.print("ClassNotFoundException: ");
                                System.err.println(e.getMessage());
                                }
                                try {
                                    con = DriverManager.getConnection(server, user, 
pass);
                                stmt = con.createStatement();
                                //ResultSet resultset = 
                                stmt.executeQuery(SQL);
                                stmt.close();
                                con.close();
                            } 
                            catch(SQLException ex) {
                                System.err.println("SQLException: " + ex.getMessage());
                                }
                        }
                        
                                for (int i = 1; i <= 100; i++){
                                        SQL = "SELECT matricula, nomeal FROM alunos 
WHERE matricula = " + i;
                                try {
                                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                                } 
                                catch(java.lang.ClassNotFoundException e) {
                                System.err.print("ClassNotFoundException: ");
                                System.err.println(e.getMessage());
                                }
                                try {
                                    con = DriverManager.getConnection(server, user, 
pass);
                                stmt = con.createStatement();
                                ResultSet resultset = stmt.executeQuery(SQL);
                                                while (resultset.next()){
                                                        %>
                                                        <b>Matricula:</b> 
<%=resultset.getString(1)%><BR>
                                                        
<b>Nome:</b><%=resultset.getString(2)%><P>
                                                        <%
                                                }
                                stmt.close();
                                con.close();
                            } 
                            catch(SQLException ex) {
                                System.err.println("SQLException: " + ex.getMessage());
                                }
                                }
                                for (int i = 1; i <= 100; i++){
                                        SQL = "UPDATE alunos SET nomeal = 'Aluno 
atualizado " + i + "' WHERE matricula = " + i;
                                try {
                                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                                } 
                                catch(java.lang.ClassNotFoundException e) {
                                System.err.print("ClassNotFoundException: ");
                                System.err.println(e.getMessage());
                                }
                                try {
                                    con = DriverManager.getConnection(server, user, 
pass);
                                stmt = con.createStatement();
                                //ResultSet resultset = 
                                stmt.executeQuery(SQL);
                                stmt.close();
                                con.close();
                            } 
                            catch(SQLException ex) {
                                System.err.println("SQLException: " + ex.getMessage());
                                }
                                }
                                for (int i = 1; i <= 100; i++){
                                        SQL = "DELETE FROM alunos WHERE matricula = " 
+ i;
                                try {
                                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                                } 
                                catch(java.lang.ClassNotFoundException e) {
                                System.err.print("ClassNotFoundException: ");
                                System.err.println(e.getMessage());
                                }
                                try {
                                    con = DriverManager.getConnection(server, user, 
pass);
                                stmt = con.createStatement();
                                //ResultSet resultset = 
                                stmt.executeQuery(SQL);
                                stmt.close();
                                con.close();
                            } 
                            catch(SQLException ex) {
                                System.err.println("SQLException: " + ex.getMessage());
                                }
                                }
                        
                                now = new java.util.Date();
                                finishTime[4] = now.getTime();


-- 
 Danilo                            mailto:[EMAIL PROTECTED]



---------------------------------------------------------------------
Para cancelar a subscri��o, envie mensagem para: 
[EMAIL PROTECTED]
Para comandos adicionais, envie mensagem para: [EMAIL PROTECTED]

Responder a