i wish to add another column using code in JDBC.I have one column columnname i wish to add a text type(data type in access) column in the access file
my code is
import java.sql.*;
public class Test3
{
public static void main(String[] args)
{
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
/* the next 3 lines are Step 2 method 2 from above - you could use the direct
access method (Step 2 method 1) istead if you wanted */
String dataSourceName = "mdbTest";
String dbURL = "jdbc:odbc:" + dataSourceName;
Connection con = DriverManager.getConnection(dbURL, "","");
// try and create a java.sql.Statement so we can run queries
Statement s = con.createStatement();
s.execute("create table TEST12345 ( column_name integer)"); // create a table
s.close(); // close the Statement to let the database know we're done with it
con.close(); // close the Connection to let the database know we're done with it
}
catch (Exception err) {
System.out.println("ERROR: " + err);
}
}
}
i have set the drivers using the following code
class Test3
{
public static void main(String args[])
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(Exception e)
{
System.out.println("error:" +e);
}
}
}
i have also created a blank database through ODBC with datasource name as mdbTest.
I wish to create another column. And then insert values into them. I have a rough idea about inserting. But i wish to add another column of different data type in the first place.How do i modify the code?