Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package modelo;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.SQLException;
- import java.sql.Statement;
- /**
- *
- * @author
- */
- public class ComentariosDAO {
- private Connection conexion;
- private void abrirConexion() throws SQLException{
- String dbURI = "jdbc:derby://localhost:1527/Comentarios";
- String username = "fcfm";
- String password = "lsti01";
- conexion = DriverManager.getConnection(dbURI, username, password);
- }
- private void cerrarConexion(){
- conexion.close();
- }
- void insertar() throws SQLException {
- ComentariosPOJO COMENTARIOS;
- String dbURI = "jdbc:derby://localhost:1527/Comentarios";
- insert into COMENTARIOS values ('Ana', 'nunca es tarde')
- Statement stmt = conexion.createStatement();
- stmt.executeUpdate(sql);
- cerrarConexion();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement