0% found this document useful (0 votes)
37 views2 pages

Pracs 1

A Java program uses JDBC API to create a student_details table in a Microsoft Access database with columns for student name as a character string of length 25, age as an integer, and phone number as an integer. The program imports the JDBC driver, connects to the database, creates a statement to execute the SQL that creates the table, prints a message confirming the table was created, and closes the connection. The program was created by Ankita Surati for a Java practical on July 2nd, 2011.

Uploaded by

Pratik Trivedi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views2 pages

Pracs 1

A Java program uses JDBC API to create a student_details table in a Microsoft Access database with columns for student name as a character string of length 25, age as an integer, and phone number as an integer. The program imports the JDBC driver, connects to the database, creates a statement to execute the SQL that creates the table, prints a message confirming the table was created, and closes the connection. The program was created by Ankita Surati for a Java practical on July 2nd, 2011.

Uploaded by

Pratik Trivedi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

JAVA 2nd July,2011 PRACTICAL NO:- 1

AIM:-Write a program using JDBC API to create the following student_details in Microsoft Access.Create a table with details as stud_name char(25),Age integer,Phone_no integer. CODE:import java.sql.*; public class JDBC { public static void main(String arg[]) { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("Jdbc:Odbc:dsn1"); System.out.println("Drivers are loaded"); Statement stmt=con.createStatement(); stmt.execute("create table student_details(stud_name varchar(25),age integer,phone_no integer)"); System.out.println("*********Table created*********"); con.close(); } catch(Exception e) { e.printStackTrace(); } } }

Created By :- Ankita Surati.

JAVA 2nd July,2011 PRACTICAL NO:- 1

Created By :- Ankita Surati.

You might also like