automate test database code example
Example: automate test database
First of I have to connect to the database
Connection connection: DriverManager.getConnection(url,
username, password)//throws SQL exception
Statement statement: connection.CreateStatement() //throws
SQL exception:checked exception
ResultSet resultSet: statement.executeQuery("yourQuery")
resultSet.getObject/String/int(index)
ResultSetMetaData rsm=resultSet.getMetaData() columns
I can retrieve the column names and counts with the help of
rsm.getColumnName(i)/getColumnCount(),