170 likes | 335 Views
Database Project: MySQL. TA: Jansen Cohoon Office: 208 Butler Email: jec9@msstate.edu. XWin 8.0. XWin allows a user to run commands remotely on a Unix, Solaris or Linux server. A fancier telnet. It is available for free from the ITS website.
E N D
Database Project: MySQL TA: Jansen Cohoon Office: 208 Butler Email: jec9@msstate.edu
XWin 8.0 • XWin allows a user to run commands remotely on a Unix, Solaris or Linux server. • A fancier telnet. • It is available for free from the ITS website. • It is a great tool to have and I recommend it to everyone.
MySQL Accounts • Everyone has a MySQL account available from Pluto. • To login use mysql –u <userid> -p • You will then be prompted for a password. • Your default password is ab1234. • To change password use: set password=password("newpassword");
MySQL Account • Everyone starts with their own database named for their <userid>. • This should be sufficient for the class and project. • You will create numerous tables though. • To start working in your database use: USE <userid>;
MySQL Account • Some useful commands: • SHOW DATABASES; • SHOW TABLES; • DESCRIBE <table>; • CREATE TABLE <table>; • DROP TABLE <table>; • QUIT;
PHP • PHP – Hypertext Preprocessor • No need to run a server. • Already installed. • C and Perl “ish” language syntax • PHP has built in MySQL support just like Java. • It is a little tricky with Oracle.
PHP • PHP is a scripting language. • To incorporate PHP into a website you use the tags <?php and ?>. • With these tags you can mix PHP with HTML and get dynamic web content.
PHP Example • <html> <head> <title>PHP Test</title> </head> <body> <?php echo '<p>Hello World</p>'; ?> </body></html> • This would be the contents of test.php
PHP MySQL Example • Go to dbSlide.php • Shows basic PHP/MySQL command structure.
Setting Up Tomcat • Detailed instructions are on my website. • They show you how to setup Tomcat on Pluto.
Using JDBC • Seven Basic Steps: • Load the JDBC Driver. • Define the connection. • Establish the connection. • Create the statement object. • Execute the statement object. • Process the results. • Close the connection.
Servlets or Server Pages • You may use either ot the two. • Many people feel that Java Server Pages are easier.
JDBC Driver and URL • Driver: • com.mysql.jdbc.Driver • URL Connection: • jdbc:mysql://localhost/<userid>
Java Server Page • Show add.jsp