I notice SQLUnit supports "Sybase".
Sybase has 3 database products:
Adaptive Server Enterprise (ASE, what most people refer to as "Sybase")
Adaptive Server Anywhere (ASA, for small to medium sized deployments)
Adaptive Server IQ (IQ, data warehousing)
I am trying to get SQLUnit working against an ASA. The jConnect pure JDBC driver that Sybase ships works against ASE and ASA.
I had never heard of SQLUnit before, so this is quite new to me.
OS: WinXP
ASA: 9.0.1.1843
I created src\net\sourceforge\guisqlunittool\guiconfig.properties
Modified the following:
# Connection information
driver = com.sybase.jdbc2.jdbc.SybDriver
url = jdbc:sybase:Tds:localhost:2638
user = DBA
password = SQL
# Where should the test cases be written?
# capturefile = /home/sujit/sqlunit/guicapture.txt
capturefile = D:/Programs/sqlunit-3.5/ASA/guicapture.txt
Then did a ant install.
D:\Programs\sqlunit-3.5>ant gui
The Connect button works, and I can see the connection happen against ASA.
When I type in a statement:
select * from site_options
Then hit the "Generate" button, I get this:
[java] SQLUnit GUI Tool
[java] Copyright(c) 2003 The SQLUnit Team
[java] DEBUG [AWT-EventQueue-0] (HandlerFactory.java:49) - >> getInstance(s ql)
[java] DEBUG [AWT-EventQueue-0] (SqlHandler.java:58) - >> process(elSql)
[java] DEBUG [AWT-EventQueue-0] (ConnectionRegistry.java:48) - >> getDefaul tConnection()
[java] Exception caught in generate: Connection(DEFAULT) is NULL or incorre ctly specified
[java] net.sourceforge.sqlunit.SQLUnitException: Connection(DEFAULT) is NUL L or incorrectly specified
[java] at net.sourceforge.sqlunit.SqlHandler.process(SqlHandler.java:71)
[java] at net.sourceforge.guisqlunittool.SQLUnitGUITool.btnGenerateActi onPerformed(SQLUnitGUITool.java:476)
[java] at net.sourceforge.guisqlunittool.SQLUnitGUITool.access$300(SQLU nitGUITool.java:65)
[java] at net.sourceforge.guisqlunittool.SQLUnitGUITool$5.actionPerform ed(SQLUnitGUITool.java:341)
[java] at javax.swing.AbstractButton.fireActionPerformed(AbstractButton .java:1764)
[java] at javax.swing.AbstractButton$ForwardActionEvents.actionPerforme d(AbstractButton.java:1817)
[java] at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultBut tonModel.java:419)
[java] at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel. java:257)
[java] at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Basi cButtonListener.java:245)
[java] at java.awt.Component.processMouseEvent(Component.java:5093)
[java] at java.awt.Component.processEvent(Component.java:4890)
[java] at java.awt.Container.processEvent(Container.java:1566)
[java] at java.awt.Component.dispatchEventImpl(Component.java:3598)
[java] at java.awt.Container.dispatchEventImpl(Container.java:1623)
[java] at java.awt.Component.dispatchEvent(Component.java:3439)
[java] at java.awt.LightweightDispatcher.retargetMouseEvent(Container.j ava:3450)
[java] at java.awt.LightweightDispatcher.processMouseEvent(Container.ja va:3165)
[java] at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3 095)
[java] at java.awt.Container.dispatchEventImpl(Container.java:1609)
[java] at java.awt.Window.dispatchEventImpl(Window.java:1585)
[java] at java.awt.Component.dispatchEvent(Component.java:3439)
[java] at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
[java] at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDi spatchThread.java:197)
[java] at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDisp atchThread.java:150)
[java] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.j ava:144)
[java] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.j ava:136)
[java] at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)
Does anyone have any ideas on where I should begin, or additional debugging switches to add.
I have never used the forums on sourceforge. Is there a way to search them (using Google) for other posts?
Thanks.
Dave
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, I meant Sybase ASE. Sorry I should have been more specific, although I dont see much reason why it wont run with the other versions as long as there is a JDBC driver for it.
The GUI tool is simply to generate snippets of XML for a given test case. You can find examples of some test files for sybase in the test/sybase/test.xml file.
You can run it (by changing the contents appropriately for your own site) using ant with the following command:
ant sqlunit-flat -Dtestfile=test/sybase/test.xml
while you are at the root of the distribution.
I will also look at what the problem is with the GUI tool code. Looks like a bug. I havent used it much except for some minor testing against a MySQL database, it was written based on an idea from someone who needed it.
I dont know of a way to search the sourceforge forums. Sorry.
Thanks for finding the bug, and let me know if you have any questions. You may also want to look up the user guide, its available on the sqlunit site as well as packaged with the distribution.
-sujit
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Tried out your use case against my PostgreSQL database and it also failed with the same error. Turns out that the code was written before some changes to the Connection handler code. Specifically when the GUI was written, SQLUnit allowed only a single connection to run a suite of tests (one file) against. With the change, a single test can use multiple connections for a diff test, or different connections in different tests in a single suite.
I have updated the code and a new version 3.6 is now available which has this fix, along with some other contributed patches.
Would appreciate it if you could download the newer version and let me know how it went.
Thanks
Sujit
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I just tried 3.6 and the GUI tool is working - thanks.
A couple of comments:
1. I had to copy the jconn2.jar file to the sqlunit-3.6/lib directory, or it cannot find the com.sybase.jdbc2.jdbc.SybDriver. Yet when I run the TUI tool, it will use the system classpath. This seems inconsistent.
I would prefer one of these two options:
a) Use the existing method plus the system classpath
b) Allow us to specify an import file that build.xml will include as part of the class.path. This saves us having to edit the build.xml file between releases.
2. When I entered the following statement:
select * from site_options
I notice is uses md5 for long strings. I also read this in the documentation. Is there anyway to tell it to leave these values in their native format? Or is that necessary for encoding in the xml file? I didn't see an option to turn this off in the docs.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the feedback about the GUITool in version 3.6.
I am surprised that the TUITool is picking up the classpath. Both run as ant targets and they get their classpaths from the class.path path ref. This is mainly a convenience (for me during testing). It could just as easily be run from the command line using a shell script, in which case it would pick up the classpath from the CLASSPATH environment variable. However, I will add in the necessary code to build.xml to add in the CLASSPATH contents in addition to what is being set.
The conversion to md5 happens automatically for BLOB, CLOB, JAVA_OBJECT, LONGVARBINARY and LONGVARCHAR. The reason this was done was to keep the size of the files small. There is currently nothing that will stop it from making the conversion. However, I could probably have a setting that will stop the conversion for type LONGVARCHAR, since it could be used as a VARCHAR in certain cases.
-sujit
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I added in a hook into the build.xml file to pick up the CLASSPATH setting and add it into the sqlunit classpath. I checked it into cvs few minutes ago, so if you already picked up the changes, you may want to do it again.
The MD5 conversion for the LONGVARCHAR is a little trickier, since there are two places I have to check for this special variable, I will get to this over the weekend.
-sujit
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I notice SQLUnit supports "Sybase".
Sybase has 3 database products:
Adaptive Server Enterprise (ASE, what most people refer to as "Sybase")
Adaptive Server Anywhere (ASA, for small to medium sized deployments)
Adaptive Server IQ (IQ, data warehousing)
I am trying to get SQLUnit working against an ASA. The jConnect pure JDBC driver that Sybase ships works against ASE and ASA.
I had never heard of SQLUnit before, so this is quite new to me.
OS: WinXP
ASA: 9.0.1.1843
I created src\net\sourceforge\guisqlunittool\guiconfig.properties
Modified the following:
# Connection information
driver = com.sybase.jdbc2.jdbc.SybDriver
url = jdbc:sybase:Tds:localhost:2638
user = DBA
password = SQL
# Where should the test cases be written?
# capturefile = /home/sujit/sqlunit/guicapture.txt
capturefile = D:/Programs/sqlunit-3.5/ASA/guicapture.txt
Then did a ant install.
D:\Programs\sqlunit-3.5>ant gui
The Connect button works, and I can see the connection happen against ASA.
When I type in a statement:
select * from site_options
Then hit the "Generate" button, I get this:
[java] SQLUnit GUI Tool
[java] Copyright(c) 2003 The SQLUnit Team
[java] DEBUG [AWT-EventQueue-0] (HandlerFactory.java:49) - >> getInstance(s ql)
[java] DEBUG [AWT-EventQueue-0] (SqlHandler.java:58) - >> process(elSql)
[java] DEBUG [AWT-EventQueue-0] (ConnectionRegistry.java:48) - >> getDefaul tConnection()
[java] Exception caught in generate: Connection(DEFAULT) is NULL or incorre ctly specified
[java] net.sourceforge.sqlunit.SQLUnitException: Connection(DEFAULT) is NUL L or incorrectly specified
[java] at net.sourceforge.sqlunit.SqlHandler.process(SqlHandler.java:71)
[java] at net.sourceforge.guisqlunittool.SQLUnitGUITool.btnGenerateActi onPerformed(SQLUnitGUITool.java:476)
[java] at net.sourceforge.guisqlunittool.SQLUnitGUITool.access$300(SQLU nitGUITool.java:65)
[java] at net.sourceforge.guisqlunittool.SQLUnitGUITool$5.actionPerform ed(SQLUnitGUITool.java:341)
[java] at javax.swing.AbstractButton.fireActionPerformed(AbstractButton .java:1764)
[java] at javax.swing.AbstractButton$ForwardActionEvents.actionPerforme d(AbstractButton.java:1817)
[java] at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultBut tonModel.java:419)
[java] at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel. java:257)
[java] at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Basi cButtonListener.java:245)
[java] at java.awt.Component.processMouseEvent(Component.java:5093)
[java] at java.awt.Component.processEvent(Component.java:4890)
[java] at java.awt.Container.processEvent(Container.java:1566)
[java] at java.awt.Component.dispatchEventImpl(Component.java:3598)
[java] at java.awt.Container.dispatchEventImpl(Container.java:1623)
[java] at java.awt.Component.dispatchEvent(Component.java:3439)
[java] at java.awt.LightweightDispatcher.retargetMouseEvent(Container.j ava:3450)
[java] at java.awt.LightweightDispatcher.processMouseEvent(Container.ja va:3165)
[java] at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3 095)
[java] at java.awt.Container.dispatchEventImpl(Container.java:1609)
[java] at java.awt.Window.dispatchEventImpl(Window.java:1585)
[java] at java.awt.Component.dispatchEvent(Component.java:3439)
[java] at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
[java] at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDi spatchThread.java:197)
[java] at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDisp atchThread.java:150)
[java] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.j ava:144)
[java] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.j ava:136)
[java] at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)
Does anyone have any ideas on where I should begin, or additional debugging switches to add.
I have never used the forums on sourceforge. Is there a way to search them (using Google) for other posts?
Thanks.
Dave
HI Dave,
Yes, I meant Sybase ASE. Sorry I should have been more specific, although I dont see much reason why it wont run with the other versions as long as there is a JDBC driver for it.
The GUI tool is simply to generate snippets of XML for a given test case. You can find examples of some test files for sybase in the test/sybase/test.xml file.
You can run it (by changing the contents appropriately for your own site) using ant with the following command:
ant sqlunit-flat -Dtestfile=test/sybase/test.xml
while you are at the root of the distribution.
I will also look at what the problem is with the GUI tool code. Looks like a bug. I havent used it much except for some minor testing against a MySQL database, it was written based on an idea from someone who needed it.
I dont know of a way to search the sourceforge forums. Sorry.
Thanks for finding the bug, and let me know if you have any questions. You may also want to look up the user guide, its available on the sqlunit site as well as packaged with the distribution.
-sujit
Hi Dave,
Tried out your use case against my PostgreSQL database and it also failed with the same error. Turns out that the code was written before some changes to the Connection handler code. Specifically when the GUI was written, SQLUnit allowed only a single connection to run a suite of tests (one file) against. With the change, a single test can use multiple connections for a diff test, or different connections in different tests in a single suite.
I have updated the code and a new version 3.6 is now available which has this fix, along with some other contributed patches.
Would appreciate it if you could download the newer version and let me know how it went.
Thanks
Sujit
I just tried 3.6 and the GUI tool is working - thanks.
A couple of comments:
1. I had to copy the jconn2.jar file to the sqlunit-3.6/lib directory, or it cannot find the com.sybase.jdbc2.jdbc.SybDriver. Yet when I run the TUI tool, it will use the system classpath. This seems inconsistent.
I would prefer one of these two options:
a) Use the existing method plus the system classpath
b) Allow us to specify an import file that build.xml will include as part of the class.path. This saves us having to edit the build.xml file between releases.
2. When I entered the following statement:
select * from site_options
It correctly produced:
<test name="Test Generated by SQLUnit GUI Tool">
<sql>
<stmt>select * from site_options</stmt>
</sql>
<result>
<resultset id="1">
<row id="1">
<col id="1" type="INTEGER">2</col>
<col id="2" type="VARCHAR">override_last_download</col>
<col id="3" type="LONGVARCHAR">md5:8bdbf55419ad722d64e86f6f2d07be76</col>
<col id="4" type="TIMESTAMP">2004-05-19 11:10:06.276</col>
</row>
</resultset>
</result>
</test>
I notice is uses md5 for long strings. I also read this in the documentation. Is there anyway to tell it to leave these values in their native format? Or is that necessary for encoding in the xml file? I didn't see an option to turn this off in the docs.
Hi Dave,
Thanks for the feedback about the GUITool in version 3.6.
I am surprised that the TUITool is picking up the classpath. Both run as ant targets and they get their classpaths from the class.path path ref. This is mainly a convenience (for me during testing). It could just as easily be run from the command line using a shell script, in which case it would pick up the classpath from the CLASSPATH environment variable. However, I will add in the necessary code to build.xml to add in the CLASSPATH contents in addition to what is being set.
The conversion to md5 happens automatically for BLOB, CLOB, JAVA_OBJECT, LONGVARBINARY and LONGVARCHAR. The reason this was done was to keep the size of the files small. There is currently nothing that will stop it from making the conversion. However, I could probably have a setting that will stop the conversion for type LONGVARCHAR, since it could be used as a VARCHAR in certain cases.
-sujit
You are right, now that I think about it, I probably ran TUI from the command line using Java, since I had an example from the SQLUnit User Guide.
Hi Dave,
I added in a hook into the build.xml file to pick up the CLASSPATH setting and add it into the sqlunit classpath. I checked it into cvs few minutes ago, so if you already picked up the changes, you may want to do it again.
The MD5 conversion for the LONGVARCHAR is a little trickier, since there are two places I have to check for this special variable, I will get to this over the weekend.
-sujit