L AUTO_INCREMENT,
`name` VARCHAR (64) NOT NULL, KEY (` id`));
- -----------------------------------------------------
- Table `music`.`genre_songs`
- ----------------------------------------------------- TABLE IF NOT EXISTS `music`.`genre_songs` (
`genre` INT NOT NULL,
`song` INT NOT NULL, KEY (` genre`, `song`),` fk_genre_songs__genres_idx` (`genre` ASC),` fk_genre_songs__songs_idx` (`song` ASC),` fk_genre_songs__genres`KEY (`genre`)` music`.`genre` (`id`) DELETE NO ACTIONUPDATE NO ACTION,` fk_genre_songs__songs`KEY (`song`)` music`.`songs` (`id`) DELETE NO ACTIONUPDATE NO ACTION) ;
Додаток Б
Приклад Сервлетаjava.io. *; java.util. *; java.sql. *; javax.servlet. *; javax.servlet.http. *;
public class Authentication extends HttpServlet {ServletConfig config; void init (ServletConfig config)
throws ServletException {.config=config;
}
public void doPost (HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {connection=null; out=response.getWriter (); rs; userName=new String ( ); passwrd=new String ( ); name =new String(laquo;raquo;);.setContentType(laquo;text/htmlraquo;);{.forName(laquo;com.mysql.jdbc.Driverraquo;);properties =New Properties () ;. setProperty ( user raquo ;, root ) ;. setProperty ( password raquo ;, 123 ) ;. setProperty ( useUnicode raquo ;, true ) ;. setProperty ( characterEncoding raquo ;, utf8 );=DriverManager.getConnection ( jdbc: mysql://localhost: 3306/music raquo ;, properties);
//Заносимо дані в базуsql= select login, password, name from users raquo ;; s=connection.createStatement () ;. executeQuery (sql);=s.getResultSet (); (rs.next ()) {= rs.getString ( login );=rs.getString ( password );=rs.getString ( name );
}. close () ;. close ();
} catch (Exception e) {.out.println ( Exception is; + e);
} (userName.equals (request.getParameter ( login ))
amp; amp; passwrd.equals (request.getParameter ( pass ))) {session=request.getSession (true) ;. setAttribute ( name raquo ;, name); dispatcher=config.getServletContext (). getRequestDispatcher (/music0.jsp ) ;. forward (request, response);
} else {.println ( You are not an authentic person );
}
}}
Додаток В
Приклад JSP-сторінки
lt;% @ page import= java.sql.Date % gt;
lt;% @ page import= java.sql.Statement % gt;
lt;% @ page import= java.sql.DriverManager % gt;
lt;% @ page import= java.util.Properties % gt;
lt;% @ page import= java.sql.ResultSet % gt;
lt;% @ page import= java.sql.Connection % gt;
lt;! DOCTYPE html gt;
lt; html lang= en gt;
lt; head gt;
lt; meta charset= utf - 8 gt;
lt; meta http-equiv= X-UA-Compatible content= IE=edge gt;
lt; meta name= viewport content= width=device-width, initial-scale=1 gt;
lt; title gt; Music Catalog lt;/title gt;
lt; link href= newcss.css rel= stylesheet gt;
lt; link href= newcss1.css rel= stylesheet gt;
lt;! - HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries - gt;
lt;! - WARNING: Respond.js does not work if you view the page via file://- gt;
lt;! - [if lt IE 9] gt;
lt; script src= https: //oss.maxcdn/libs/html5shiv/3.7.0/html5shiv.jsraquo; gt; lt;/script gt;
lt; script src= https: //oss.maxcdn/libs/respond.js/1.4.2/respond.min.jsraquo; gt; lt;/script gt;
lt;! [endif] - gt;
lt;/head gt;
lt;% HttpSession s=request.getSession (true); connection=null; rs; song=new String ( ); artist=new String ( ); album =new String ( ); genre=new String ( ); released=null; duration=0; ids=0; ida=0; idg=0; idu=0; idar=0; rating =0; .setContentType ( text/html ); {. forName ( com.mysql.jdbc.Driver ); properties=new Properties () ;. setProperty ( user raquo ;, root ) ; .setProperty ( password raquo ;, 123 ) ;. setProperty ( useUnicode raquo ;, true ) ;. setProperty ( characterEnco...