Hi Pradeep,
Thks for ur post.
Actually I am replacing all my code written in Oracle PL/SQL Stored procedure to Java Stored Procedure as per the coding standards laid for this project.
I have a couple of methods defined in my Java Stored Procedure and all these are connecting to the database to fetch a couple of records or single
String value.
I have to create a procedures and/or functions based on the return type of these methods created in Java Stored Proc.
Problem 1 : Not able to connect to database to fetch any single string value.
public class SeeteshCode
{
public static String getDetData(String str_AccountCode)
{
String str_schemecode = getSchemeDetails(str_AccountCode);
System.out.println(str_schemecode);
if (str_schemecode.length() > 0)
{
return "true";
}
else
{
return "false";
}
}
public static String getSchemeDetails(String str_AccountCode)
{
String str_schemecode = "";
java.sql.Connection con = null;
java.sql.ResultSet rs = null;
java.sql.Statement stmt = null;
try
{
String str_query = "SELECT scheme_code_txt, inv_sgrp_code_txt, inv_dk_account_code_txt, dkp_transfer_allowed_flag FROM M_GROUPTYPE WHERE UPPER(inv_grp_code_txt) = '"+str_AccountCode+"'";
System.out.println(str_query);
String str_url = "jdbc
racle:thin:@bomw001:1521
atadb";
System.out.println("1");
java.lang.Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
System.out.println("2");
con = java.sql.DriverManager.getConnection("jdbc
dbc
racleodbc","seetesh","seetesh");
System.out.println("3");
stmt = con.createStatement();
System.out.println("4");
rs = stmt.executeQuery(str_query);
System.out.println("5");
while (rs.next())
{
str_schemecode = rs.getString("scheme_code_txt");
System.out.println(str_schemecode);
}
}
catch(java.sql.SQLException se){}
catch(java.lang.Exception ee){}
finally
{
try
{
if(con != null)
{
con.close();
}
}
catch(java.lang.Exception e12) {}
}
System.out.println(str_schemecode);
return str_schemecode;
}
}
No errors displayed while executing the code but displays just "1".
Rgds,
Seetesh