📜  自动化测试数据库 - 任何代码示例

📅  最后修改于: 2022-03-11 15:00:36.089000             🧑  作者: Mango

代码示例1
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(),