<%@ page import="java.sql.*" %>
Creating a Table
Creating a Table
<%
Connection connection = null;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
connection = DriverManager.getConnection("jdbc:odbc:data", "userName", "password");
Statement statement = connection.createStatement();
String command = "CREATE TABLE Employees (ID INTEGER, Name CHAR(50));";
statement.executeUpdate(command);
} catch (Exception e) {
out.println("An error occurred.");
}
%>
The Employees table was created.