java, javafx, android and spring programing collection
java standard edition
addObject
arraylist
bufferedreader
colors
comparator
createTable
datatypes
date
enum
generateHTML
hashmap
inheritance
insertSQL
interface
JSONfromWEB
jsoup
list
loop
pointMatrix
queue
readCSV
regex
sqlToObject
stack
static
super
treemap
updateTable
writeCSV
java FX
3DCharacterMoving
3DMaterialList
DroneMotor
FlowPane
Hello
KeyCode
KeyMovement
ObservableList
Pane
RotateImage
rotateSphere
android
APIview
listview
ToastTimer
touchMovement
WriteReadFile
spring framework
HelloWorld
RESTful
TomcatServlet
java objects
Apple
starseite
/
lessons
/
se
fx
android
spring
/
star wars api
createTable
2022-06-15 04:08:14
create a sql table in java
tags:
se
sql
view source
insertSQL
2022-06-14 16:44:07
tags:
se
sql
view source
insertSQL
screenshot
description
source code
import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; public class TestApplication { static final String DB_URL = "jdbc:mysql://localhost/thomas"; static final String USER = "root"; static final String PASS = ""; public static void main(String[] args) { try(Connection conn = DriverManager.getConnection(DB_URL, USER, PASS); Statement stmt = conn.createStatement(); ) { String sql = "INSERT INTO personen VALUES (100, 'test', 'test', 18)"; stmt.executeUpdate(sql); sql = "INSERT INTO personen VALUES (1, 'helmut', 'test', 25)"; stmt.executeUpdate(sql); sql = "INSERT INTO personen VALUES (2, 'olaf', 'test', 30)"; stmt.executeUpdate(sql); sql = "INSERT INTO personen VALUES(3, 'mike', 'test', 28)"; stmt.executeUpdate(sql); } catch (SQLException e) { e.printStackTrace(); } } }