Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGL Development Tools » Preview Pane can't find jt400.jar
Preview Pane can't find jt400.jar [message #760039] Thu, 01 December 2011 04:35 Go to next message
Joe Pluta is currently offline Joe PlutaFriend
Messages: 62
Registered: November 2011
Member
I wrote a little multi-tiered app and in my server tier I have a service that creates an SQLDataSource. I'm trying to create a jt400.jar connection to my i, and I keep getting "No suitable driver found for jdbc:as400:MYI;prompt=false:".

Where do I put the JAR file so that it can be found at runtime? I originally set up the driver to look at c:\util\jars\jt400.jar, and it can't seem to find that, so I then tried to put the JAR file in my project in a generic "jars" folder, but that's not working either.

What am I doing wrong?
Re: Preview Pane can't find jt400.jar [message #760044 is a reply to message #760039] Thu, 01 December 2011 05:30 Go to previous messageGo to next message
Will Smythe is currently offline Will SmytheFriend
Messages: 41
Registered: July 2009
Member
Joe - did you setup your database connection via the Database Tools in Eclipse? If so, are you able to open/connect to the database in the Data Source Explorer view?

Also, how is your SQLDataSource getting the connection info (via a resource binding in your DD or a connection URL)?
Re: Preview Pane can't find jt400.jar [message #760046 is a reply to message #760039] Thu, 01 December 2011 05:36 Go to previous messageGo to next message
fahua jin is currently offline fahua jinFriend
Messages: 58
Registered: July 2011
Member
The JDBC JAR files should be copied automatically if configured the SQLDataSource bindings.

The runtime JAR files should be copied into the %target_deploy_project%/WebContent/WEN-INF/lib/ folder if deployment action works fine.
Re: Preview Pane can't find jt400.jar [message #760139 is a reply to message #760044] Thu, 01 December 2011 13:27 Go to previous messageGo to next message
Joe Pluta is currently offline Joe PlutaFriend
Messages: 62
Registered: November 2011
Member
My sequence of events:

1. New project
2. Open deployment descriptor
3. Click on resource bindings
4. Click on Add...
5. Select SQL Database resource
(up comes Add a SQL Database Binding)
("Reference the selected..." radio button is selected)
(Connection details is empty)
6. Click New...
(up comes New Connection Profile)
7. Select DB2 for i5/OS, click Next
(up comes Specify a Driver and Connection Details)
(dropdown is empty)
8. Click on New Driver Definition tool button
(up comes New Drvier Definition)
9. Select AS/400 Toolbox for Java
(error about jt400.jar not being found)
10. Click on JAR List tab
11. Select jt400.jar
12. Click on Edit JAR/Zip...
13. Specify folder (C:\Util\jars)
14. Click OK
(taken back to Specify a Driver...)
15. Enter connection information
(Check Save password checkbox)
16. Click Test Connection
(See Ping Succeeded!)
17. Click Finish
(back to Resource Bindings Configuration)
(see new connection)
(SQL Database Binding has "Obtain connection..." radio button selected)
18. Save and close deployment descriptor

I think this is the right way to specify a connection, no? Because I'm uncertain as to exactly what you mean by the "Database Tools". I didn't use the Database Development perspective, although when I go there I see my new connection and I can drill into it just fine.
Re: Preview Pane can't find jt400.jar [message #760141 is a reply to message #760046] Thu, 01 December 2011 13:29 Go to previous messageGo to next message
Joe Pluta is currently offline Joe PlutaFriend
Messages: 62
Registered: November 2011
Member
I should have been more specific - I am NOT deploying the project. I'm trying to use the Preview Pane to test my multi-tier project. So as I understand it I'm using the Jetty server. And it seems like Jetty is finding the connection definition (otherwise it wouldn't be trying to access jdbc:as400). It's just not finding my jt400.jar file. How do I tell the Jetty server to use the jar file?
Re: Preview Pane can't find jt400.jar [message #760165 is a reply to message #760141] Thu, 01 December 2011 14:03 Go to previous messageGo to next message
Joe Pluta is currently offline Joe PlutaFriend
Messages: 62
Registered: November 2011
Member
I tried a new way! I wrote my data library:

library DataLib 

	function getTapes() returns(ENGTAPEF[])
		tapes ENGTAPEF[]{};
		
		try
			ds SQLDataSource?{@resource{bindingkey = "MYDATASOURCE"}};
			get tapes from ds with #sql{select * from ENGTAPEF order by ETPART};
		onException(exception AnyException)
			SysLib.writestdout(JsonLib.convertToJson(exception));
		end
		
		return (tapes);
	end

end


I then wrote a simple EGL program:

package test;

import com.pbd.t1sql.common.*;
import com.pbd.t1sql.server.*;

program TestDataLib

	function main()
		tapes ENGTAPEF[] = DataLib.getTapes();
		SysLib.writestdout("#Tapes: " :: tapes.getSize());
	end
	
end


I right-clicked on the program, selected Run as EGL Java Main Application, and I got the same error:

{"SQLState" : "08001", "ErrorCode" : 0, "nextException" : null, "message" : "No suitable driver found for jdbc:as400:MYI;prompt=false: [sqlstate:08001][sqlcode:0]", "messageID" : "EGL0009E", "STACK_TRACES" : true}
#Tapes: 0
Re: Preview Pane can't find jt400.jar [message #760239 is a reply to message #760165] Thu, 01 December 2011 16:50 Go to previous messageGo to next message
Will Smythe is currently offline Will SmytheFriend
Messages: 41
Registered: July 2009
Member
Joe - your setup looks good. I just did a simple test and did not experience the same problem. I am using the JTOpen 7.5.1 jt400.jar. Can you try this jar and see if you have different/better results? http://sourceforge.net/projects/jt400/files/JTOpen-full/
Re: Preview Pane can't find jt400.jar [message #760267 is a reply to message #760239] Thu, 01 December 2011 17:42 Go to previous messageGo to next message
Joe Pluta is currently offline Joe PlutaFriend
Messages: 62
Registered: November 2011
Member
I changed my jar file. Here's what I see in my binding file (t1sql-bnd.xml in .metadata\.plugins\org.eclipse.datatools.connectivity). Names and passwords have been changed to protect the guilty. jt400_7.5.1.jar is the new one I just downloaded. I continue to receive the "no suitable driver" message both in the preview pane and in the deployed project.

<?xml version="1.0" encoding="UTF-8"?>
<egldd>
    <bindings>
        <binding name="DB2DEVTESTCCIWEB" type="edt.binding.sql" uri="workspace://DB2 DEVTEST CCIWEB" useURI="false">
            <parameters>
                <parameter name="jarList" value="C:\util\jars\jt400_7.5.1.jar"/>
                <parameter name="sqlDB" value="jdbc:as400:MYI;prompt=false"/>
                <parameter name="sqlJDBCDriverClass" value="com.ibm.as400.access.AS400JDBCDriver"/>
                <parameter name="sqlPassword" value="MYPASSWORD"/>
                <parameter name="dbms" value="DB2 UDB iSeries V5R3"/>
                <parameter name="sqlSchema" value="MYSCHEMA"/>
                <parameter name="sqlID" value="MYUSER"/>
            </parameters>
        </binding>
    </bindings>
    <includes>
    </includes>
</egldd>

[Updated on: Thu, 01 December 2011 17:50]

Report message to a moderator

Re: Preview Pane can't find jt400.jar [message #760274 is a reply to message #760267] Thu, 01 December 2011 18:00 Go to previous messageGo to next message
Joe Pluta is currently offline Joe PlutaFriend
Messages: 62
Registered: November 2011
Member
Okay, I changed the project to use a connection named DB2CONN1, and then exported it to an archive which I attached to this post. If you want to see if you can get it to work, you should be able to just import the project and either create DB2CONN1 as a connection or modify the library part (DataLib) to point to an existing connection.

It will certainly fail, but the point is whether it will fail with "no suitable driver" or with some sort of schema or table not found message. The latter would indicate that I have some sort of severe and fatal configuration problem.

(I had to attach a new version of the archive; the old one did not point to DB2CONN1.)
  • Attachment: EDT_T1SQL.zip
    (Size: 35.10KB, Downloaded 107 times)

[Updated on: Thu, 01 December 2011 18:34]

Report message to a moderator

Re: Preview Pane can't find jt400.jar [message #760295 is a reply to message #760039] Thu, 01 December 2011 19:32 Go to previous messageGo to next message
Justin Spadea is currently offline Justin SpadeaFriend
Messages: 66
Registered: July 2009
Member
Hi Joe,

I was able to reproduce the problem - go ahead and open a bug. The problem is that at least with older versions of jt400.jar it does not have the required files for auto-registration of the driver with DriverManager. We do a Class.forName() to load older style drivers, however when you have a schema specified in the connection info then we do an implicit "sqlDataSource.setCurrentSchema()" - and this is being done before the Class.forName() code that registers the driver.

A workaround is to remove the default schema property from your connection profile (in the Driver Properties section). And in your code manually set it:
ds SQLDataSource?{@resource{bindingkey = "MYDATASOURCE"}};
ds.setCurrentSchema("MySchema");

Or if there's a newer jt400.jar that auto-registers the driver, that should work too.

-Justin
Re: Preview Pane can't find jt400.jar [message #760302 is a reply to message #760295] Thu, 01 December 2011 19:51 Go to previous messageGo to next message
Joe Pluta is currently offline Joe PlutaFriend
Messages: 62
Registered: November 2011
Member
HOORAY! The workaround worked!

I'll open a bug in short order. Now I'm on to the next issue - debugging a preview. I'll open a different topic for that.
Re: Preview Pane can't find jt400.jar [message #760307 is a reply to message #760302] Thu, 01 December 2011 20:09 Go to previous message
Joe Pluta is currently offline Joe PlutaFriend
Messages: 62
Registered: November 2011
Member
Bug reported:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=365359

Previous Topic:jt400.jar not working in deployed application
Next Topic:How do I debug my preview?
Goto Forum:
  


Current Time: Mon Dec 22 21:36:07 GMT 2014

Powered by FUDForum. Page generated in 0.10398 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software