Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What are the errors in the following code? In addition, are there any security vulnerabilities present in this code? Example DAO for a shipping tracking

What are the errors in the following code? In addition, are there any security vulnerabilities present in this code? image text in transcribed
image text in transcribed
Example DAO for a shipping tracking system import java.sql.ResultSet import java.sql.ResultSetMetaData: mport java.sqlSQLExceptiorn import java.sql Statement: import java.util.Vector import com.mysql.jdbc.MySQLConnection Is used as the database access object to retum a result set of a given query public class DAO ( public MySQLConnection mConnection private ResultSetMetaData mMetaData; private VectorsString mColumns public DAO(MySQLConnection Connection) this.mConnectionConnection Runs the query and retums a Vector of Vectors as a result @param mQuery @retum Vectors Veclors Stringe> @hrows SQlException public VectorsVectorsStrings runQuery(String mQuery) throws SQLException VectorsVector String> mResults new Vector VectorsString 0 Statement mStatement (Statement) this.mConnection.createStatement); Resultset m ResultSet = mStatement.executeQuery(mQuery); mMetaData = mResultSet.getMetaData(); int mNumColumns mMetaData.getColumnCounto setColumns(mNumColumns mMetaData) whilefmResuiltset.nexto)X Vector(); for(int 1; cz mNumColumns; i++){ mRow.add(mResultSet.getString() mResults.add(mRow) return mResults

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions

Question

How do Data Types perform data validation?

Answered: 1 week ago

Question

How does Referential Integrity work?

Answered: 1 week ago