-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMysql1.java
More file actions
23 lines (22 loc) · 664 Bytes
/
Mysql1.java
File metadata and controls
23 lines (22 loc) · 664 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import java.sql.*;
import java.sql.*;
import java.sql.DriverManager;
import java.sql.Connection;
class Mysql1
{
public static void main(String aa[])throws ClassNotFoundException
{
try
{
// Register JDBC driver
//Class.forName("org.mariadb.jdbc.Driver");
//Open a connection
Connection con=DriverManager.getConnection("jdbc:mariadb://localhost:3306/test2","root","amalshibu");
//Create a statement object
Statement st=con.createStatement();
st.executeUpdate("CREATE TABLE table4 (rollno int, name varchar(15))");
//System.out.println("Table created");
con.close(); //Close the connection
}catch(SQLException e) { System.out.println("Error is " +e); }
}
}