How to create table in MyEclipse Derby
where i can 开发者_如何学编程make the table when making sample program of Hibernate with MyEclipse Derby
From the MyEclipse Derby Database Server Tutorial (and I warmly recommend reading it entirely):
Connecting to Derby with the Database Explorer
Switch to the MyEclipse Database Explorer perspective. Please make sure Derby, is started and running before you attempt to connect to it. In the DB Browser view, right click the MyEclipse Derby driver and then select Open connection... to connect.
Note: If you do not see the MyEclipse Derby driver, see Restore MyEclipse Derby Driver in the following section.
You may use the embedded Derby database just like you would any other database in MyEclipse. For further details, refer to the Database Explorer tutorial.
MyEclipse Derby ships with a sample database named myeclipse. This database includes two sample schemas, CLASSICCARS and MYBLOG. Other schemas visible are Derby's system schemas.
Figure 6. Connecting to Derby using the MyEclipse Derby driver
Follow the steps below:
1.For creating table in MyEclipse Derby
first of all select open perspective in MyEclipse IDE
at top right corner, image shown below:
- Right click on
MyEclipse Derby
and clickOpen connection
- Right
click on Connected to MyEclipse Derby [classiccars]
and click onNew SQL Editor
, image shown below:
- In Editor window write the code shown below:
CREATE TABLE APP.EMPINFO
(EMP_ID INT NOT NULL, FIRSTNAME VARCHAR(20), MIDDLENAME VARCHAR(20), LASTNAME VARCHAR(20),
DATEOFBIRTH DATE NOT NULL, EMAIL VARCHAR(50), ATTACHMENT VARCHAR(5000), PHONENO integer,
ADDRESS VARCHAR(256), PINCODE integer, CONSTRAINT EMPID_PK PRIMARY KEY (EMP_ID));
Here APP
is schema name and EMPINFO
is table name.
How to create table in MyEclipse Derby is shown in New SQL Editor:
精彩评论