Skip to content

Commit

Permalink
Added database schema and connectivity
Browse files Browse the repository at this point in the history
  • Loading branch information
shivhek25 committed Dec 14, 2017
1 parent fc67310 commit f696b14
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 1 deletion.
Binary file added .DS_Store
Binary file not shown.
Binary file added DBCon.class
Binary file not shown.
28 changes: 28 additions & 0 deletions DBCon.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import java.sql.*;
class DBCon
{
public static void main(String args[])
{
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql:///qa","root","shivhek25@mysql");
Statement stmt = con.createStatement();
stmt.executeUpdate("insert into qao values(1,'sdvdv','sdvd','sdfh','fsbf','rgrgg')");
stmt.executeUpdate("insert into qao values(2,'sdvdv','sdvd','sdfh','fsbf','rgrgg')");
stmt.executeUpdate("insert into qao values(3,'sdvdv','sdvd','sdfh','fsbf','rgrgg')");
stmt.executeUpdate("insert into qao values(4,'sdvdv','sdvd','sdfh','fsbf','rgrgg')");
stmt.executeUpdate("insert into qao values(5,'sdvdv','sdvd','sdfh','fsbf','rgrgg')");
stmt.executeUpdate("insert into qao values(6,'sdvdv','sdvd','sdfh','fsbf','rgrgg')");
stmt.executeUpdate("insert into qao values(7,'sdvdv','sdvd','sdfh','fsbf','rgrgg')");
stmt.executeUpdate("insert into qao values(8,'sdvdv','sdvd','sdfh','fsbf','rgrgg')");
stmt.executeUpdate("insert into qao values(9,'sdvdv','sdvd','sdfh','fsbf','rgrgg')");
stmt.executeUpdate("insert into qao values(10,'sdvdv','sdvd','sdfh','fsbf','rgrgg')");
con.close();
}
catch(Exception e)
{
System.out.println(e);
}
}
}
2 changes: 1 addition & 1 deletion OnlineTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

class OnlineTest extends JFrame implements ActionListener
{
JLabel l;
Expand Down
Binary file added mysql-connector-java-5.1.45-bin.jar
Binary file not shown.
11 changes: 11 additions & 0 deletions qao.schema
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CREATE DATABASE qa;
USE qa;
create table qao
(
qno int primary key,
question varchar(250),
option1 varchar(20),
option2 varchar(20),
option3 varchar(20),
option4 varchar(20)
);
7 changes: 7 additions & 0 deletions ua.schema
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
USE qa;
create table ua
(
qno int primary key,
ans varchar(20),
foreign key (qno) references qao(qno)
);

0 comments on commit f696b14

Please sign in to comment.