Page 1 of 2 1 2 >
Topic Options
#53272 - 04/03/17 02:55 PM OBDC Driver Trials and Tribulations
BT_Peace Offline
Adagio Groupie

Registered: 08/18/12
Posts: 19
Loc: Arizona
Hi All,

I have been working on trying to get access via the ODBC with limited success and
a lot of frustration. At this point, the only place that I can get data to return is in a
Windows 10 machine running Excel 2010. Windows 10 with Excel will just spin even
though when you get into the SQL Query manager you can pull the data that you are
looking for.

I have been able communicate with the OBDC driver using JDBC which would be my
preferred method to utilize the OBDC. I have included here the URL string that I used
for the driver connection and two different outputs. One is a debug output and the other
is a trace from the OBDC driver. What I see is that when I use the Sample Data I get
a missing ADSPROF.PCE error so to me that means that I am talking directly to the
Adagio ODBC driver. When I use backup of the production data, I get the errors below.
Which appear to be a (-1) from the vendor and an SQLState of 28000 which is
an authorization issue. The user and password are correct, we have a license for ODBC
and it is clear that I am communication with the Adagio OBDC Data Driver(Version 9.2A).
Can someone see what I am missing in my URL string that I should have? I have yet to find a
good source of documentation for this level of interaction with the driver. If someone
could point me at it that would be great!

Thanks!
Brian



String conStr = "jdbc:odbc:"
+ "Driver=AdagioDataSourceDriver;"
+ "Names=LONG;"
+ "DBSelelector=PCE;"
+ "Columns=COMMON;"
+ "DBDirectory=<hidden>;"
+ "DBQ=<Same as hidden>;"
+ "READONLY=true;"
+ "UserID=<User>;"
+ "Password=<Pass>;"
+ "TablesAll=FALSE;"
+ "DBFilter=*";


From the Debug Output :

DriverManager.getConnection("jdbc:odbc:Driver=AdagioDataSourceDriver;Names=LONG;DBSelelector=PCE;Columns=COMMON;DBDirectory=<hidden>;DBQ=<same as hidden> ;READONLY=true;UserID=<User>;Password=<Pass>;TablesAll=FALSE;DBFilter=*")
trying sun.jdbc.odbc.JdbcOdbcDriver
*Driver.connect (jdbc:odbc:Driver=AdagioDataSourceDriver;Names=LONG;DBSelelector=PCE;Columns=COMMON;DBDirectory=<hidden>;DBQ=<same as hidden>;READONLY=true;UserID=<User>;Password=<Pass>;TablesAll=FALSE;DBFilter=*)
JDBC to ODBC Bridge: Checking security
No SecurityManager present, assuming trusted application/applet
JDBC to ODBC Bridge 2.0001
Current Date/Time: Mon Apr 03 14:25:30 MST 2017
Loading JdbcOdbc library
Allocating Environment handle (SQLAllocEnv)
hEnv=16299776
Allocating Connection handle (SQLAllocConnect)
hDbc=16300000
Connecting (SQLDriverConnect), hDbc=16300000, szConnStrIn=Driver=AdagioDataSourceDriver;Names=LONG;DBSelelector=PCE;Columns=COMMON;DBDirectory=<Hidden>;DBQ=<Same as Hidden>;READONLY=true;UserID=<User>;Password=<Pass>;TablesAll=FALSE;DBFilter=*;UID=<User>;PWD=<Pass>
RETCODE = -1
ERROR - Generating SQLException...
SQLState(28000) vendor code(-1)
java.sql.SQLException: [DSI]: Error message not found: Connect Failed



From the SQL Log File:

bin" com.peaces 2398-6ec EXIT SQLAllocConnect with return code 0 (SQL_SUCCESS)
HENV 0x000000000082D1D0
HDBC * 0x000000000244EEA0 ( 0x000000000082D2B0)

bin" com.peaces 2398-6ec ENTER SQLDriverConnectW
HDBC 0x000000000082D2B0
HWND 0x0000000000000000
WCHAR * 0x000007FC10D05828 [ -3] "******\ 0"
SWORD -3
WCHAR * 0x000007FC10D05828
SWORD -3
SWORD * 0x0000000000000000
UWORD 0 <SQL_DRIVER_NOPROMPT>

bin" com.peaces 2398-6ec EXIT SQLDriverConnectW with return code -1 (SQL_ERROR)
HDBC 0x000000000082D2B0
HWND 0x0000000000000000
WCHAR * 0x000007FC10D05828 [ -3] "******\ 0"
SWORD -3
WCHAR * 0x000007FC10D05828
SWORD -3
SWORD * 0x0000000000000000
UWORD 0 <SQL_DRIVER_NOPROMPT>

DIAG [28000] [DSI]: Error message not found: Connect Failed (-1)

Top
#53275 - 04/03/17 05:47 PM Re: OBDC Driver Trials and Tribulations [Re: BT_Peace]
BT_Peace Offline
Adagio Groupie

Registered: 08/18/12
Posts: 19
Loc: Arizona
Discovered another piece of information. If the EZtask files do not exist in a system
directory then I get a popup looking for the currency and eztask paths. Once these
are set I go back to the same failure mode.

This is the current string using the ODBC Connection String Tester.

Driver=AdagioDataSourceDriver;Names=Short;DBSelelector=SAM;Columns=COMMON;DBDirectory=C:\SAMDATA;DBQ=C:\SAMDATA;READONLY=true;UserID=SYS;Password=SYS;TablesAll=true;DBFilter=*;

So I am most certainly talking to the driver.

Top
#53276 - 04/04/17 07:32 AM Re: OBDC Driver Trials and Tribulations [Re: BT_Peace]
Michael Mulrooney Offline
Adagio Virtuoso

Registered: 02/07/02
Posts: 839
Loc: Vancouver, BC
Adagio ODBC must be registered.

ADSPROF.??? should be present and have been initialize my the Adagio application so ODBC knows what version of the application data is present. When you copy the production data include the ADSPROF

You must use the correct version, 32 bit or 64 bit, that matches the calling application.

Don't use DBFILTER=*, select a single application or better yet single file for testing the connection.

Start with Excel or Access loading a single table.

Gridview RW will write to a record set directly to a SQL database, perhaps a better approach if you do not require a "live" connection.

Top
#53280 - 04/04/17 09:40 AM Re: OBDC Driver Trials and Tribulations [Re: Michael Mulrooney]
BT_Peace Offline
Adagio Groupie

Registered: 08/18/12
Posts: 19
Loc: Arizona
Hi Michael,

Thanks for the reply!

I just installed this yesterday so I thought we had 60 days before it HAD to be registered. Have
started that process now.

There is a ADSPROF in the sample data. So that is there, you get a complaint from the driver if it
is not.

How do you designate a 32 or 64 bit driver? Both appear to be installed in the system and are
designated with the AdagioDataSourceDriver. Do you choose it by setting the description flag?

All we currently want to access is inventory so I will work on getting the DBFILTER right.


Thanks Again for your response!

Cheers,
Brian

Top
#53283 - 04/04/17 10:00 AM Re: OBDC Driver Trials and Tribulations [Re: BT_Peace]
Michael Mulrooney Offline
Adagio Virtuoso

Registered: 02/07/02
Posts: 839
Loc: Vancouver, BC
Register so as to remove that as a problem
Use Excel or Access to verify the connection.
I believe the info for 32 vs 64 is in the documentation.

Depending on what you are trying to accomplish, GVRW might be an easier solution.

Top
#53295 - 04/04/17 02:47 PM Re: OBDC Driver Trials and Tribulations [Re: Michael Mulrooney]
BT_Peace Offline
Adagio Groupie

Registered: 08/18/12
Posts: 19
Loc: Arizona
We are not going to spend another $2K on something when we already have paid for something that SHOULD solve our problems.



Edited by BT_Peace (04/04/17 02:53 PM)

Top
#53297 - 04/04/17 03:22 PM Re: OBDC Driver Trials and Tribulations [Re: BT_Peace]
Retired_Guy Offline
Adagio Master

Registered: 03/16/99
Posts: 10504
Loc: Canada
Michael wasn't suggesting you should spend more money. He was trying to identify the best tool for solving the problem which you haven't yet described.

If you posted what you are trying to accomplish, then someone here would likely be able to tell you what tables you should be referencing.
_________________________
Andrew Bates

Top
#53298 - 04/04/17 03:34 PM Re: OBDC Driver Trials and Tribulations [Re: Retired_Guy]
BT_Peace Offline
Adagio Groupie

Registered: 08/18/12
Posts: 19
Loc: Arizona
My apologies for the grumpy statement, if I was a newbie at programming ODBC interfaces I would not be so frustrated with the amount of time that I have spent on trying to get this to work. The problem that I am most frustrated with is the lack of information in the error code. The vendor error code is -1... what does that mean? I have yet to find something that tells me that. Please point me to something that give me that information.

All I need is the ability to pull the inventory in total so that I can manipulate it via my own tools and I don't want to click/open/have any interaction with the software to be able to do this. This can be done with the ODBC. I can write the SQL query and in truth we may want to interact with any of the multiple tables that you have but at this point it is only the Inventory Item list that I want to work with.

BTW - I have sent in my request for a license code and have not heard back from you all. Is there something else that I need to do?


Edited by BT_Peace (04/04/17 03:36 PM)

Top
#53315 - 04/05/17 06:29 PM Re: OBDC Driver Trials and Tribulations [Re: BT_Peace]
BT_Peace Offline
Adagio Groupie

Registered: 08/18/12
Posts: 19
Loc: Arizona
All,

So I finally got things to work. A couple of notes here about things and gotchas...


1) DSN or driver is AdagioDataSourceDriver. It does not matter if you are on a 32bit or 64bit machine.
The value is the same. Using the values in the manual generates a unknown driver error.

2) You must encrypt the password unless you flag the connection string with a "RAWPASSWORD=1"

3) If you are within the 60 day period, you can work with the sample data with no problems with out registering .
I think that you can also work with your data, things got a little out of sync so I am not positive.

4) The Java-ODBC bridge has been removed in Java 8 so either compile with Java 7 or
go through the process of migrating the 7 bridge to 8 with this bit of useful info.
http://bigfatball.blogspot.com/2016/03/how-to-enable-jdbc-odbc-bridge-for-jdk-8.html

5) TestODC will actually return something if you have things right. Otherwise it is a black
hole with no other responses or errors.

Below is my test code to make sure that I could pull data from the Inventory. It works for
me but I won't promise you that it will work for you.

Cheers,
Brian



/*
* <----------------------- Test ODBC Java Code ---------------------------------->
*
* Note You must replace the values in the conStr to match your installation
*
* Works only with Java 1.7 unless you add the ODBC jar into Java 1.8
*/


package com.peacesurplus.odbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class TestODBC {

private Connection con;
public TestODBC() {

}
public void connectToDatabase(String username, String password) throws SQLException, InstantiationException, IllegalAccessException {

try
{
// Load Sun's jdbc-odbc driver
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
}
catch (ClassNotFoundException cnfe) // driver not found
{
System.err.println ("Unable to load database driver");
System.err.println ("Details : " + cnfe);
System.exit(0);
}
// DriverManager.setLogStream(System.out);

String conStr = "jdbc:odbc:Driver=AdagioDataSourceDriver;"
+ "NAMES=LONG;"
+ "DBSELELECTOR=PCE;"
+ "COLUMNS=COMMON;"
+ "DBDIRECTORY=H:\\SOFTRAK\\data;"
+ "DBQ=H:\\SOFTRAK\\data PCE;"
+ "USERID=SYS;"
+ "PASSWORD=<HIDDEN>;"
+ "DBFILTER={AN9*};"
+ "TABLESALL=FALSE;"
+ "RAWPASSWORD=1;";




con = DriverManager.getConnection(conStr);



}
private void fullICquery() throws SQLException {

String query = "SELECT \"Item\", \"Description\", \"QtyOnHand\", \"UPC\" FROM \"ICItems123Master__an92aicf\" WHERE \"QtyOnHand\" > 0 AND \"UPC\" > \'0\'";

// TODO Auto-generated method stub
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);
int count = rs.getFetchSize();
while (rs.next()) {
// String upc = rs.getString("UPC");
int qty = rs.getInt("QtyOnHand");
String upc = rs.getString("UPC");
int row = rs.getRow();
System.out.println(String.valueOf(row) + ", "+ upc+", "+qty);
}


con.close();
}

public static void main(String[] args) {
// TODO Auto-generated method stub

TestODBC to = new TestODBC();

try {
to.connectToDatabase("", "");
to.fullICquery();

} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.exit(0);
}

}

/*
* End of TestODBC.java
*/


Edited by BT_Peace (04/05/17 06:31 PM)

Top
#53319 - 04/06/17 07:52 AM Re: OBDC Driver Trials and Tribulations [Re: BT_Peace]
Retired_Guy Offline
Adagio Master

Registered: 03/16/99
Posts: 10504
Loc: Canada
Hi Brian,

Many thanks for posting your successful resolution of your issue. As you have discovered, the ODBC Connection has to be "just so" and the stars aligned correctly in order for it to work properly. However, once that's done, you should be good to go and not have to go through this again.
_________________________
Andrew Bates

Top
#53840 - 05/26/17 07:45 AM Re: OBDC Driver Trials and Tribulations [Re: Retired_Guy]
BT_Peace Offline
Adagio Groupie

Registered: 08/18/12
Posts: 19
Loc: Arizona
On the same topic:

I have a nice piece of working code that runs on the command line and does exactly what I need. However when I put this into
the task scheduler on our windows 2012 server it just hangs. My theory is that the first time you use the ODBC, if it does not
find the eztask or currency files it will do a popup dialog window to ask you to point to where these are. Something I had to
do when it ran the first time on the command line.

I believe that our problem is that the ADSPROF.LD4 file that we have points to a network drive that is mounted on the server
and it does not like that. I have had to change the values to point to the non-network drive. We use the network drive on the server
to keep the file systems correct for the clients as well.

So, my question is. Has anyone been able to use the ODBC driver in code that runs on the task scheduler? If so how did you do
it? Is there a way to pass the file values for the EZTASK and Currency Files to the ODBC driver in code? So something in the connection
string. If so what are the keywords to send?

Thanks!
Brian


Edited by BT_Peace (05/26/17 08:10 AM)

Top
#53841 - 05/26/17 08:26 AM Re: OBDC Driver Trials and Tribulations [Re: BT_Peace]
Michael Mulrooney Offline
Adagio Virtuoso

Registered: 02/07/02
Posts: 839
Loc: Vancouver, BC
I suspect the issue is "drive mappings".
To run under a schedule task you need to use UNC drive mappings everywhere including ADSPROF.??? in the data folder.

The path to EZTASK and Currency Files comes from the above mentioned ADSPROF.??? and should use UNC not drive letters.

Top
#53842 - 05/26/17 09:08 AM Re: OBDC Driver Trials and Tribulations [Re: Michael Mulrooney]
BT_Peace Offline
Adagio Groupie

Registered: 08/18/12
Posts: 19
Loc: Arizona
Thanks for the reply Michael!

I tried that... no luck. Works on the command line but not in the task scheduler.

Top
#53843 - 05/26/17 10:06 AM Re: OBDC Driver Trials and Tribulations [Re: BT_Peace]
Patricia B. Offline
Adagio Maestro

Registered: 06/26/08
Posts: 1171
Loc: Langley, BC
is the ODBC driver pointing to the database using the UNC path as well?
_________________________
Patricia Balbuena Cotlear
AP SMART SUPPORT
236 991 3060





Top
#53844 - 05/26/17 12:44 PM Re: OBDC Driver Trials and Tribulations [Re: Patricia B.]
BT_Peace Offline
Adagio Groupie

Registered: 08/18/12
Posts: 19
Loc: Arizona
Yes, it does now. It did not.... however still no luck.

Top
#53845 - 05/26/17 01:12 PM Re: OBDC Driver Trials and Tribulations [Re: BT_Peace]
Patricia B. Offline
Adagio Maestro

Registered: 06/26/08
Posts: 1171
Loc: Langley, BC
Disconnect the drive mapping and run the command line.
_________________________
Patricia Balbuena Cotlear
AP SMART SUPPORT
236 991 3060





Top
#53847 - 05/26/17 02:03 PM Re: OBDC Driver Trials and Tribulations [Re: BT_Peace]
BT_Peace Offline
Adagio Groupie

Registered: 08/18/12
Posts: 19
Loc: Arizona
I now have enough feedback in the program to know that when it is run in the task scheduler it hangs while trying
to get the connection to the ODBC driver. It hangs there and will hang forever. So now I am pretty sure it is
the ADSPROF.??? file that is causing it to hang.

One of the things that I have found is that the ADSPROF.??? gets over written and the pointers change... I assume
it is because the clients are using the mounted drive notation.... is that right?

Thanks!
Brian

Top
#53848 - 05/26/17 02:09 PM Re: OBDC Driver Trials and Tribulations [Re: Patricia B.]
BT_Peace Offline
Adagio Groupie

Registered: 08/18/12
Posts: 19
Loc: Arizona
Thank You Patricia!!!

I disconnected the drive then ran the script on the command line. This gave me the popup dialog for the task and currency files. I
put in the UNC label for the directories and it started the command. Killing the script and cleaning up the files, I tried running it via
the task scheduler and it is running as it is suppose to.

Thank you again!

Cheers,
Brian

Top
Page 1 of 2 1 2 >


Moderator:  Christa_Meissner 
Who's Online
1 registered (Howard S.-MMA), 180 Guests and 1 Spider online.
Key: Admin, Global Mod, Mod
Forum Stats
1872 Members
5 Forums
14527 Topics
70937 Posts

Max Online: 432 @ 01/20/25 10:17 PM
August
Su M Tu W Th F Sa
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31