freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "ShivNarayan" <shivanet AT forindia.com>
- To: freetds AT franklin.oit.unc.edu
- Subject: problem in driver while executing procedure
- Date: Tue, 2 Oct 2001 00:33:28 -0400
we are working on jsp based application which execute stored procedure
inside sqlserver7.0. we are using FreeTDS driver for database
connectivity.
it works with sql queries very well.
but FreeTDS diver is giving exception while executing stored procedure.
it is displaying following error...
java.sql.SQLException: Msg 170, Lvl 15, State 1, Line 1: Incorrect syntax
near '
SELECT'., Server D031EN1A, Procedure , Line 1
or java code is like that......
=======================================================================
import com.thinweb.tds.*;
import com.thinweb.tds.util.*;
import java.sql.*;
import java.util.*;
public class temptw {
java.sql.Connection con;
java.sql.Connection ctn2;
java.sql.Statement stmt;
public temptw()
{
try{
Class.forName("com.thinweb.tds.Driver").newInstance();
//Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
//String url ="jdbc:odbc:dts";
String url = "jdbc:twtds:sqlserver://192.168.1.201/testdb";
con = DriverManager.getConnection(url,"sa","" );
System.out.println("connection successful....");
executeMethod();
}
catch (Exception e) {
System.out.println(e);
}
}
public void executeMethod()
{
java.sql.ResultSet rs =null;
java.sql.CallableStatement cstmt=null;
int debug = 0;
try {
cstmt = con.prepareCall("{call emp_rec(?)}");
cstmt.setInt(1,2);
System.out.println("problem ok");
//java.sql.Statement stmt=con.createStatement();
//rs=stmt.executeQuery("select * from employee1");
rs = cstmt.executeQuery();
System.out.println("problem starts");
while (rs.next())
{
System.out.println(rs.getString(1)+" "+rs.getString(2)+"
"+rs.getString(3));
}
}catch(SQLException e)
{
System.out.println(e);
}
}
public static void main (String [] args)
{
temptw tp=new temptw();
}
}
=========================================================================
trigger is following...
CREATE procedure emp_rec
@id int
as
select id,name,sal from emp where id=@id;
-------------------------------------------------------------------------
please help us to figure out the error..
thanx in advance...
reach me Shivanet AT forindia.com
- problem in driver while executing procedure, ShivNarayan, 10/02/2001
Archive powered by MHonArc 2.6.24.