Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

How do I use a Database Data Source?

LegacyForum
LegacyForum Posts: 1,664 ✭✭
edited December 2016 in SOAtest
1) Right-click the root Project tree node.
2) Choose Add Data Source from the shortcut menu.
3) (Optional) Change the data source label in the Name field of the Data Source panel.
4) Choose Database from the Type box.

Specify the following Database Configuration parameters:

* Driver: Type the path to the appropriate JDBC/ODBC driver, including the package name. The driver that you enter must be available on your CLASSPATH. To add the driver jars (or zip files) to the CLASSPATH, goto File -> Customize Preferences, then add the file(s) under the "System Properties" section.
* URL: Type the appropriate URL needed to access your database.
* Username: Type a valid username for this database (if the database requires passwords).
* Password: Type the password for the given username (if the database requires passwords).
* SQL Query: Type or copy the SQL query that expresses which data you want to use.

Here are some examples of Driver's and URL's you might use for different databases:

Oracle
--------
Driver: oracle.jdbc.driver.OracleDriver
URL: jdbc:oracle:thin:@host:port:dbName

MySQL
--------
Driver: com.mysql.jdbc.Driver
URL: jdbc:mysql://host:port/dbName

Driver: org.gjt.mm.mysql.Driver
URL: jdbc:mysql://host:port/dbName

Windows System DSN (To set this up go to Control Panel -> Administrative Tools -> DataSources (ODBC)
----------------------------
Driver: sun.jdbc.odbc.JdbcOdbcDriver
URL: jdbc:odbc:DATABASE_NAME (where DATABASE_NAME is the database name from your System DSN settings)

SQLServer
--------------
Driver: com.microsoft.jdbc.sqlserver.SQLServerDriver
URL: jdbc:microsoft:sqlserver://host:port;DatabaseName=DATABASE_NAME

Sybase
---------
Driver: com.sybase.jdbc2.jdbc.SybConnectionPoolDataSource
URL: jdbc:sybase:Tds:host:port/dbName

DB2
-----
Driver: pure-java universal driver: com.ibm.db2.jcc.DB2Driver ([DB 2 install dir]/java/db2jcc.jar)
URL: jdbc:db2://host:port/DATABASE_NAME (default port is 50002)
Tagged:

Comments

  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    For SQLServer 2005 the Driver and URL were changed to the following:

    Driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
    URL: jdbc:sqlserver://host:port;DatabaseName=DATABASE_NAME

  • MichaelG
    MichaelG Posts: 3

    These steps seem to be outdated using SOATest 9.9. Although I've added the drivers (tried both db2jcc4.jar and db2jcc.jar) in JDBC drivers preferences, when I try to add a DB2 datasource, I'm still presented with the error, "Could not load driver class for DB2. Make sure that the driver is added in 'JDBC Drivers' preferences". These are current drivers.

  • Ramiro Martinez
    Ramiro Martinez Posts: 53 admin

    Hi MichaelG,

    SOATest may require additional JARs to access your DB2 databases, depending on the version of DB2 database.
    This snip-it from updated versions of the SOATest user guide(9.9) explains this:
    "• DB2:
    Driver (using the universal pure java driver): com.ibm.db2.jcc.DB2Driver (found under
    [DB 2 install dir]/java)
    URL: jdbc:db2://host:port/dbName
    Note: Depending on the target DB2 host, additional IBM db2jcc_license_*.jar
    license files may be added to the SOAtest JDBC drivers list. Please refer to DB2 materials for details"

    Therefore, depending on your version of the DB2 database you may need the above mentioned JDBC JAR and possibly others.
    You would need to see DB2 resources for more details on which JARs are necessary for your exact version of DB2 to be accessed by other tools.

    SOATest user guide can be found within soatest_installation_folder/manuals/ directory or accessed through the SOATest GUI Help>Help Contents

  • OmarR
    OmarR Posts: 233 admin

    MichaelG!!!!!

    Did you restart your SOAtest instance after adding your JDBC jars to your Preferences? Please ensure you restart the tool in order for SOAtest to load up the necessary JARs!!!!!!!

  • MichaelG
    MichaelG Posts: 3

    Thx Ramiro Martinez. I'll look into that.
    OmarR!!! Why are you yelling?!?!? YES!!! I restarted based on the message that told me to do so!!! ;-)

  • MichaelG
    MichaelG Posts: 3

    Ramiro Martinez It appears that the license JAR doesn't exist in these packages anymore. I've tried several locations, including the one provided in the help docs, and I still received that message. The database I'm currently targeting is DB2 9 fixpack 7.
    Although I think it's pretty self-explanatory how to add a driver, see the screenshot to see what I'm seeing on my end. Yes, I rebooted the app Omar. ;-)

  • alindsay
    alindsay Posts: 1

    @MichaelG I reproduced the issue on my end and found out that IBM has refactored it's driver class. When connecting the data source is looking for a legacy driver that isn't there any more. There is another way though!! (sans restart) Select "Custom" for the driver class and fill out the Driver class, URL, etc.. information. (Pictured)

Tagged