CST-363 Week 6
This week I learned how to connect to a database using Java via JDBC. A connection must be created using the database's url, username, and password. SQL statements can be executed in Java using Statements or PreparedStatements. Running executeStatement will return a ResultSet which can be used to read from the returned rows. Statements should always be sanitized to prevent SQL Injection and values should never be concatenated into the SQL string. Transactions are committed automatically but can be turned off using setAutoCommit(false)
Comments
Post a Comment