Hello everyone, can someone help me with this please?
Create class which will create tables in data base (Microsoft Access). About the tables: number of columns, type of data, lenght of the data.
And mantaining the information (the data) in the tables- add data, delete data and edit data.
So far I have codes which are connected with SQL, and I need them in Access. Here are some codes.
import java.sql.*;
public class CreateTable{
public static void main(String[] args) {
System.out.println("Table Creation Example!");
Connection con = null;
String url = "jdbc:mysql://localhost:3306/";
String dbName = "jdbctutorial";
String driverName = "com.mysql.jdbc.Driver";
String userName = "root";
String password = "root";
try{
Class.forName(driverName).newInstance();
con = DriverManager.getConnection(url+dbName, userName, password);
try{
Statement st = con.createStatement();
String table = "CREATE TABLE Employee11(Emp_code integer, Emp_name varchar(10))";
st.executeUpdate(table);
System.out.println("Table creation process successfully!");
}
catch(SQLException s){
System.out.println("Table all ready exists!");
}
con.close();
}
catch (Exception e){
e.printStackTrace();
}
}
}
I can post more codes but they're all with SQL.
Any help?