Java??洢???????÷???
???????????? ???????[ 2014/11/6 11:13:13 ] ????????Java ???? ???????
???????????????????У?
????declare @myResult int
????exec getsum 100??@myResult output
????print @myResult
??????JAVA?е????
import java.sql.*;
public class ProcedureTest
{
public static void main(String args[]) throws Exception
{
//????????
DriverManager.registerDriver(new sun.jdbc.odbc.JdbcOdbcDriver());
//???????
Connection conn=DriverManager.getConnection("jdbc:odbc:mydata"??"sa"??"");
//?????洢????????
CallableStatement c=conn.prepareCall("{call getsum(????)}");
//???洢?????????????????
c.setInt(1??100);
//???洢????????????
c.registerOutParameter(2??java.sql.Types.INTEGER);
//???д洢????
c.execute();
//????洢????????????
System.out.println (c.getInt(2));
conn.close();
}
}
????2:????varchar
?????洢??????α?
??????洢?????д??α? ????α???????orderid
????create procedure CursorIntoProcedure
????@pname varchar(8000) output
????as
????--?????α?
????declare cur cursor for select orderid from orders
????--??????????????????α???
????declare @v varchar(5)
????--???α?
????open cur
????set @pname=''--??@pname???
????--????α???
????fetch next from cur into @v
????while @@fetch_status=0
????begin
????set @pname=@pname+';'+@v
????fetch next from cur into @v
????end
????print @pname
????--????α?
????close cur
????--?????α?
????deallocate cur
???????д洢?????
????exec CursorIntoProcedure ''
????JAVA?????
import java.sql.*;
public class ProcedureTest
{
public static void main(String args[]) throws Exception
{
//????????
DriverManager.registerDriver(new sun.jdbc.odbc.JdbcOdbcDriver());
//???????
Connection conn=DriverManager.getConnection("jdbc:odbc:mydata"??"sa"??"");
CallableStatement c=conn.prepareCall("{call CursorIntoProcedure(?)}");
c.registerOutParameter(1??java.sql.Types.VARCHAR);
c.execute();
System.out.println (c.getString(1));
conn.close();
}
}
????C??????????洢????
?????洢?????
drop table ????????????
create table ????????????
(
StuID int primary key??
StuName varchar(10)??
StuAddress varchar(20)
)
insert into ???????????? values(1??'???'??'wuhan')
insert into ???????????? values(2??'???'??'wuhan')
create table ????????
(
StuID int??
Chinese int??
PyhSics int
foreign key(StuID) references ????????????(StuID)
on delete cascade
on update cascade
)
insert into ???????? values(1??99??100)
insert into ???????? values(2??99??100)
?????????洢?????
????create procedure delePro
????@StuID int
????as
????delete from ???????????? where StuID=@StuID
????--???????
????exec delePro 1 --???д洢????
????--?????洢????
????create procedure selePro
????as
????select * from ????????????
????--???????
????exec selePro --???д洢????
??????JAVA?е????
import java.sql.*;
public class ProcedureTest
{
public static void main(String args[]) throws Exception
{
//????????
DriverManager.registerDriver(new sun.jdbc.odbc.JdbcOdbcDriver());
//???????
Connection conn=DriverManager.getConnection("jdbc:odbc:mydata"??"sa"??"");
//?????洢????????
CallableStatement c=conn.prepareCall("{call delePro(?)}");
c.setInt(1??1);
c.execute();
c=conn.prepareCall("{call selePro}");
ResultSet rs=c.executeQuery();
while(rs.next())
{
String Stu=rs.getString("StuID");
String name=rs.getString("StuName");
String add=rs.getString("StuAddress");
System.out.println ("???:"+" "+"????:"+" "+"???");
System.out.println (Stu+" "+name+" "+add);
}
c.close();
}
}
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
Java???????????Щ???????????????Java????????????????Java?б???Map????????Java Web???????????????Java??????????????д?????Java????????7???????????????????????(java .net ?????)???Java??????????Python??????Java webdriver??λ????????′????е?????Java??д??????????????????Java???????????????JavaScript????????????Java?????????????????? Java???????10??????????????Java?м????????????????java???????ü???????????м???????????????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????