Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrievingthe Return value of a User defined function

Status
Not open for further replies.

Viruland

Programmer
Dec 6, 2000
61
0
0
BE
Hi,

Is there a way in JAVA to retrieve the return value of a User Defined Function, designed in my MSSQL database.

udf_RetrieveDienstNaam = User Defined Function from my database.

String sql = "{? = call dbo.udf_RetrieveDienstNaam(1)}";

ResultSet rs;
Connection con;

MedocConnectDB cDB = new MedocConnectDB();

try{
con = cDB.getConnection();

if (con!=null){
CallableStatement cstmt = con.prepareCall(sql);
cstmt.registerOutParameter(1, java.sql.Types.VARCHAR );
rs = cDB.execute();

rs.next();

String dbUser = rs.getString(1);

System.out.println(dbUser);
rs.close();
rs = null;
}
con.close();
}catch(Exception e){

}

Live fast, die young and leave a beautiful corpse behind.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top