ODBC callback

This is a map in funtion in Tamino X-Tension.


PrintWriter outFile = new PrintWriter (newFileWriter(fileName));
try {

IntRef connectHdl = new IntRef (10000);

int sqr = 0;
int dbConnectHandle=0;

dbConnectHandle = SxsSQLGetConnect (“EmpSRA”, “Administrator”, “”, connectHdl);

IntRef stmtHdl = new IntRef (10000);

int statementHandle=0;
outFile.println(“Statement handle execution starts”);

statementHandle = SxsSQLAllocHandle (SQL_HANDLE_STMT, dbConnectHandle, stmtHdl);

outFile.println(“Statement handle succeeded”);
}

finally {
outFile.close();
}

This function is throwing a run time exception “NestedException:Exception retrieving the response stream!” at the statementHandle.

can u clarify what the problem with this function is?

The return value of SxsSQLGetConnect and SxsSQLAllocHandle is not the handle you need.

Try the following:

  <BR>PrintWriter outFile = new PrintWriter (newFileWriter(fileName));<BR>try { <BR><BR><BR>IntRef connectHdl = new IntRef (10000);<BR><BR><BR>int sqr = 0;<BR>int dbConnectHandle=0;<BR><BR><BR>// get connect handle<BR>sqr = SxsSQLGetConnect ("EmpSRA", "Administrator", "", connectHdl);<BR>if (sqr !=0) { outFile.println("ERROR: SxsSQLGetConnect returns " + sqr); }<BR>dbConnectHandle = intConnectHdl.getVal();<BR>//<BR><BR>IntRef stmtHdl = new IntRef (10000);<BR><BR><BR>int statementHandle=0; <BR>outFile.println("Statement handle execution starts");<BR><BR><BR>// get statement handle<BR>sqr = SxsSQLAllocHandle (SQL_HANDLE_STMT, dbConnectHandle, stmtHdl);<BR>if (sqr !=0) { outFile.println("ERROR: SxsSQLAllocHandle returns " + sqr); }<BR>statementHandle = stmtHdl.getVal();<BR>//<BR><BR>outFile.println("Statement handle succeeded");<BR>} <BR><BR><BR>finally {<BR>outFile.close();<BR>}<BR><BR><BR>




Best regards

Julius Geppert
Tamino Quality Engineering
Software AG

[This message was edited by Julius Geppert on 14 Aug 2002 at 08:38.]

the above program is giving the same run time exception…
In the program :
IntRef connectHdl = new IntRef (10000);

what does that “10000” signifies?

dbConnectHandle = connectHdl.getVal(); is giving the value of the argument that is passed to the IntRef() constructor i.e., if it is 5000 the getVal() method is giving that “5000” value…

is there any default value?

In the IntRef constructor the given value is stored and can be retrieved by getVal().

In ODBC handle context this start value plays no role - it just has to be given.

The value you are interested in is the connect handle, which should be set by the SxsSQLGetConnect method, but obviously isn’t.

So your first problem is that you get no connection - possible reasons are manifold.

Could you please give some more information about
- your operating system
- the type of ODBC database you want to connect
- the Tamino version
- the result value (sqr) of SxsSQLGetConnect
- any information you might think to be useful to find the error.

Best regards

Julius Geppert
Tamino Quality Engineering
Software AG

  1. operating system - windows NT 4.0
    2. the type of ODBC database you want to connect - system DSN.

    3. the Tamino version - 3.1.1.1
    4. the result value (sqr) of SxsSQLGetConnect - SxsSQLGetConnect returns 8505
    5. other information:-
    i’m using windows authentication for the SQL connectivity not SQL authentication. But this connectivity is working well.

Hello,

The error code 8505 just means that the ODBC call failed. I think you have double-checked the user and password again and again, but you should also be aware that you can only access data sources via Tamino Odbc callbacks that have been defined as SYSTEM data source names (DSN) and NOT as USER data source names. Can this be the reason for your problems?

Regards,

Gernot Heyer

my program works fine now.
thank u.