myeclipse連線mysql資料庫

2021-09-13 10:53:41 字數 920 閱讀 3541

例如第乙個頁面是index.jsp,登入後進入my.jsp頁面

賬號密碼正確,進入第三個頁面web.jsp

錯誤,返回登入介面

string uname=request.getparameter("uname");

string pwd=request.getparameter("pwd");

connection con;

statement smt;

resultset rs;

string url="jdbc:mysql://localhost:3306/test";

string user="root";

string password="root";

string sql="select * from user where uname='"+uname+"' and pwd='"+pwd+"'";

drivermanager.registerdriver(new driver());

con=drivermanager.getconnection(url,user,password);

smt=con.createstatement();

rs=smt.executequery(sql);

if(rs.next())

response.sendredirect("web.jsp");

else

response.sendredirect("index.jsp");

%>

其間還有在lib資料夾下匯入jdbc jar包,開啟資料庫,建表等,新增tomcat伺服器。

設定MyEclipse連線Oracle資料庫

2.7.1 設定myeclipse連線oracle資料庫 為在myeclipse中設定連線oracle資料庫,在eclipse中選擇window show view other myeclipse database db browser選項。右擊db browser檢視的空白部分,選擇new選項,如...

Python基礎 Python連線MySQL

什麼是 pymysql?pymysql 是在 python3.x 版本中用於連線 mysql 伺服器的乙個庫,python2中則使用mysqldb。pymysql 遵循 python 資料庫 api v2.0 規範,幷包含了 pure python mysql 客戶端庫。pymysql 安裝 在使用...

Windows上Python連線MySQL資料庫

python連線mysql資料庫示例 usr bin python import mysqldb conn mysqldb.connection 127.0.0.1 root root test cur conn.cursor cur.execute insert into testok id va...