JNDI Datasource - Visual COBOL Eclipse 4.0


I have created a JNDI Datasource within a Java Class and want to pass the object to Managed COBOL as my understanding is that you can connect using 'EXEC SQL CONNECT TO Datasource object' according to the documentation. 

However when the EXEC SQL CONNECT statement is run I get  'Connection datasource not found' within MFSQLMESSAGETEXT.

If I get the connection object from the datasource within my Java class I can pass the connection object to my COBOL JVM wrapper and connect using 'EXEC SQL BIND'.  I have been told that using BIND as in the example within the docs can be slow so wanted to try the JNDI option. 

Has anyone used this approach? I have tried using the SQL(JNDI) setting but no joy.

Would be much appreciated if anyone could provide me with some pointers.

  • Verified Answer

    The EXEC SQL BIND is the method to use if your connection object already exists. EXEC SQL CONNECT TO will try to create a new connection using the jndi description that is setup in your environment.

    From where did you get the impression that the BIND was slow? Is this your impression after testing with it?


  • Thanks Chris,

    The connection object will already exist from the pool so the BIND option works for me. I have not noticed any performance issues with the BIND statement, it was mentioned in a discussion I had regarding JDBC with JVM COBOL and SQL Server.