root/trunk/myweb/WebContent/Jdbc.jsp

Revision 20, 0.8 KB (checked in by yabuki, 3 years ago)
  • Property svn:mime-type set to text/plain
Line 
1<?xml version="1.0" encoding="UTF-8" ?>
2<%@ page language="java" contentType="text/html; charset=UTF-8" %>
3<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
4<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
5
6<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
7<html xmlns="http://www.w3.org/1999/xhtml">
8<head>
9<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
10
11<title>JDBCの利用</title>
12</head>
13<body>
14
15<sql:setDataSource
16  var="ds"
17  driver="com.mysql.jdbc.Driver"
18  url="jdbc:mysql://localhost/mydb?characterEncoding=utf8"
19  user="test"
20  password="pass" />
21
22<sql:update dataSource="${ds}">
23  INSERT INTO samples (sample,memo)
24  VALUES ('JDBC TEST','<%=(new java.util.Date())%>')
25</sql:update>
26
27</body>
28</html>
Note: See TracBrowser for help on using the browser.