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 basedados;
- import java.sql.*;
- /**
- *
- * @author Henrique
- */
- public class BaseDados {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- Connection conn = null;
- try{
- conn=DriverManager.getConnection("root","root","jdbc:mysql://localhost:8889/youTube");
- Statement stnt= (Statement) conn.createStatement();
- String Fname = "Jane";
- String Lname = "Brown";
- String insert = "INSERT INTO 'youtube'.'user'('Fname','Lname') VALUES ('"+Fname+"','"+Lname+"')";
- stnt.executeUpdate(insert);
- }catch (SQLException e){
- System.err.println(e);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement