none
Java on SBS2008 Cannot Connect to ODBC

    Question

  • I raised this question in another forum (http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.data.odbc&tid=9db19cfa-e88e-4bc6-abd2-2fd5713824ca&cat=&lang=&cr=&sloc=&p=1) but it was suggested I raise it here as it maybe quicker.

    I am trying to run a java program on a Small Business Server 2008. This is a 64 bit server. The program has been created using Netbeans so I believe it will be 32 bit. I have gone into syswow64\odbcad32 and created an entry for my ODBC source. When I then run the code it fails with the error: "Cannot connect to jdbc:odbc:BITSSageSrc error:
    java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not
    found and no default driver specified". A source is definitely defined under syswow64\odbcad32 in system DSN, nothing shows up under the normal ODBC data sources as that is 64 bit. It is trying to connect to a Sage database which is 32 bit.

    I have tried :
    - specifying -d32 flag on run line. Doesn't start (despite what the java website says the flag is  invalid).
    - recompiling the code on a 32 bit machine. No change.
    - looking for a 64 bit sage driver. Sage hasn't come up with one yet.
    - created it in a virtual machine where the same thing happens.

    I would welcome any other suggestions you can think of.

    Thanks,
    Neil
    Tuesday, February 02, 2010 2:50 PM

Answers

  • It sounds like a problem with finding an ODBC driver from the JDBC-ODBC bridge you are using. I would look for a support/forums for the bridge "BITSSageSrc". Alternatively, you could try using the Microsoft JDBC driver, which does not require a JDBC-ODBC bridge: http://www.microsoft.com/downloads/details.aspx?FamilyID=99b21b65-e98f-4a61-b811-19912601fdc9&displaylang=en
    Friday, February 05, 2010 5:44 PM
  • Thanks to those who responded. I leave this here to help anyone else who gets confused by the 64 / 32 bit architecture setup. What I was trying to do was use a 32 bit driver (provided by Sage) in a 64 bit environment. What I hadn't noticed was that it stopped working when I upgraded the underlying Java environment to 64 bit (yes, I know it's obvious now!). The 32 bit driver will never work in the 64 bit system (i.e. the Java environment is 64 bit). Downgrading everything to 32 bit means it is now working (albeit in 32 bit mode, which seems a waste). I think the implication is that I am dependent on Sage to come up with a 64 bit driver before I can work in a 64 bit environment - may be a while!

     

    • Marked as answer by NL Barton Wednesday, March 31, 2010 1:43 PM
    Wednesday, March 31, 2010 1:43 PM

All replies

  • Incidentally, this thread did originate here: http://social.microsoft.com/Forums/en-US/partnerwinserversbs/thread/314caa48-05e2-4772-b73c-f06a2f6da3ed but the respondent suggested I try this forum as he thinks it may be a program compatibility issue.
    Tuesday, February 02, 2010 4:16 PM
  • I have now loaded Excel 2007 onto the server. It also fails to connect to the ODBC source. It fails with : Cannot find all files in data path. Driver's SQLSetConnectAttr failed. The driver returned invalid (or failed to return) SQL_DRIVER_ODBC_VER:2.00.

    Can anyone advise what might be causing this? As far as I'm aware I have not done anything different to when I install this on a normal PC, under XP, and Windows 7 it works fine. Why won't it work on a SBS 2008 server?
    Friday, February 05, 2010 1:38 PM
  • OK. I've been messing with it too much. I had scrambled the data path in the DSN entry which caused Excel to fail. Excel now retrieves the data perfectly using ODBC. Using Java I still get the original error:
    Cannot connect to jdbc:odbc:BITSSageSrc error: java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.

    Friday, February 05, 2010 1:46 PM
  • It sounds like a problem with finding an ODBC driver from the JDBC-ODBC bridge you are using. I would look for a support/forums for the bridge "BITSSageSrc". Alternatively, you could try using the Microsoft JDBC driver, which does not require a JDBC-ODBC bridge: http://www.microsoft.com/downloads/details.aspx?FamilyID=99b21b65-e98f-4a61-b811-19912601fdc9&displaylang=en
    Friday, February 05, 2010 5:44 PM
  • Thanks for your suggestion Stoyko,

    I have downloaded the MS JDBC driver but it seems to only be used for connecting to SQL Server databases. The data I am connecting to is accessed through an ODBC connector (it is a Sage database). The BITSSageSrc you see referred to in the error message is the name of the ODBC data source defined by me. I suspect you're right and I need to use the Microsoft JDBC driver (at least the Java one doesn't seem to be working) but how do I define it to access the ODBC data? I have tried replacing the databse name with the data source name (BITSSageSrc). The error I get says no suitable driver found. That may be the way I have set it up, I have followed the instructions and extracted it to a directory under "Program Files"  but is there something I need to do to register it's presence as it does not seem able to find it even though I specify it in the classpath. Or would I need to specify something different for an ODBC source?

    Thanks for your help,
    Neil
    Sunday, February 07, 2010 10:36 PM
  • From the error it does not look like that the driver is not placed in the class path correctly.
    See this documentation about how to setup the sql jdbc driver
    http://msdn.microsoft.com/en-us/library/ms378749.aspx


    If you using an ODBC datasource, you need to look at the server name and put that server name in the jdbc connection string. JDBC driver connection string does not take an ODBC datasource.


    Tuesday, February 16, 2010 10:18 PM
  • Thanks for your help Mugunthan,

    I am obviously not getting the syntax of the connection string quite right. I have read through the JDBS article that you highlight above but still can't get any further forward. I have created a small app to test the connection, using this I have tried many different combinations of server names etc. All with no success.

    According to the article I think this should work:
    java -jar -classpath "C:\Program Files\Microsoft SQL Server JDBC Driver\sqljdbc_2.0\enu\sqljdbc.jar" ConnectionTester.jar jdbc:odbc://BITSSERVER\BITSSageSrc Lynn

    BITSServer is the name of my server (I have tried BITSSERVER.bitsint.local which is the full domain name but no change), BITSSageSrc is the name of an ODBC data source defined in Syswow64\odbcad32. The sqljdbc file is definitely there. Lynn is a user who can connect with no password.

    When I run this I still get :
    C:\Data\BITS>java -jar -classpath "C:\Program Files\Microsoft SQL Server JDBC Driver\sqljdbc_2.0\enu\sqljdbc.jar" ConnectionTester.jar jdbc:odbc://BITSSERVER\BITSSageSrc Lynn
    Cannot connect to jdbc:odbc://BITSSERVER\BITSSageSrc error: java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
    Exception in thread "main" java.lang.NullPointerException
            at connectiontester.Main.main(Main.java:29)

    Can you put me out of my misery and tell me where I getting the syntax wrong! The manual says jdbc:odbc://servername\instance. I think that is what I have, but it doesn't work.

    all help appreciated,
    Neil

    Wednesday, February 17, 2010 4:47 PM
  • In case it helps, this is the code I am using in my connection tester:
    try {
                connection = DriverManager.getConnection(args[0], args[1],"");
          } catch (SQLException ex) {
                System.out.println(String.format("Cannot connect to %s error: %s", args[0], ex));
          }

    It works fine on Windows 7, XP & everything else I've tried, just not on SBS 2008!

    Thursday, February 18, 2010 9:10 AM
  • I have tried many different syntax variations on my test system, none seem to work. It seems that the ODBC driver doesn't know to look in the 32 bit version of ODBCAD32 in order to find the data source. Anybody know how to tel it to look there? If it's automatic why isn't it finding it?
    Thursday, February 18, 2010 7:56 PM
  • I've just run my ConnectionTester program on a SBS2003 system and it works fine. Can anyone suggest why it doesn't work on SBS2008?
    Thursday, February 18, 2010 10:08 PM
  • This is an SQL trace from a connection I tried:

    java  -jar Conn 658-1694 ENTER SQLAllocEnv
      HENV *              000000000248F660

    java  -jar Conn 658-1694 EXIT  SQLAllocEnv  with return code 0 (SQL_SUCCESS)
      HENV *              0x000000000248F660 ( 0x00dd9dd0)

    java  -jar Conn 658-1694 ENTER SQLAllocConnect
      HENV                0000000000DD9DD0
      HDBC *              000000000248F520

    java  -jar Conn 658-1694 EXIT  SQLAllocConnect  with return code 0 (SQL_SUCCESS)
      HENV                0000000000DD9DD0
      HDBC *              0x000000000248F520 ( 0x00dcd350)

    java  -jar Conn 658-1694 ENTER SQLDriverConnectW
      HDBC                0000000000DCD350
      HWND                0000000000000000
      WCHAR *             0x000007FEF1DD3DD8 [      -3] <Invalid string length!>
      SWORD                       -3
      WCHAR *             0x000007FEF1DD3DD8
      SWORD                       -3
      SWORD *             0x0000000000000000
      UWORD                        0 <SQL_DRIVER_NOPROMPT>

    java  -jar Conn 658-1694 EXIT  SQLDriverConnectW  with return code -1 (SQL_ERROR)
      HDBC                0000000000DCD350
      HWND                0000000000000000
      WCHAR *             0x000007FEF1DD3DD8 [      -3] <Invalid string length!>
      SWORD                       -3
      WCHAR *             0x000007FEF1DD3DD8
      SWORD                       -3
      SWORD *             0x0000000000000000
      UWORD                        0 <SQL_DRIVER_NOPROMPT>

      DIAG [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0)

    java  -jar Conn 658-1694 ENTER SQLErrorW
      HENV                0000000000000000
      HDBC                0000000000DCD350
      HSTMT               0000000000000000
      WCHAR *             0x000000000248EEB8 (NYI)
       SDWORD *            0x000000000248F360
      WCHAR *             0x000000000248EED0
      SWORD                      300
      SWORD *             0x000000000248F3B0

    java  -jar Conn 658-1694 EXIT  SQLErrorW  with return code 0 (SQL_SUCCESS)
      HENV                0000000000000000
      HDBC                0000000000DCD350
      HSTMT               0000000000000000
      WCHAR *             0x000000000248EEB8 (NYI)
       SDWORD *            0x000000000248F360 (0)
      WCHAR *             0x000000000248EED0 [      91] "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"
      SWORD                      300
      SWORD *             0x000000000248F3B0 (91)

    java  -jar Conn 658-1694 ENTER SQLErrorW
      HENV                0000000000000000
      HDBC                0000000000DCD350
      HSTMT               0000000000000000
      WCHAR *             0x000000000248EEB8 (NYI)
       SDWORD *            0x000000000248F360
      WCHAR *             0x000000000248EED0
      SWORD                      300
      SWORD *             0x000000000248F3B0

    java  -jar Conn 658-1694 EXIT  SQLErrorW  with return code 100 (SQL_NO_DATA_FOUND)
      HENV                0000000000000000
      HDBC                0000000000DCD350
      HSTMT               0000000000000000
      WCHAR *             0x000000000248EEB8 (NYI)
       SDWORD *            0x000000000248F360
      WCHAR *             0x000000000248EED0
      SWORD                      300
      SWORD *             0x000000000248F3B0

    java  -jar Conn 658-1694 ENTER SQLFreeConnect
      HDBC                0000000000DCD350

    java  -jar Conn 658-1694 EXIT  SQLFreeConnect  with return code 0 (SQL_SUCCESS)
      HDBC                0000000000DCD350

    java  -jar Conn 658-1694 ENTER SQLFreeEnv
      HENV                0000000000DD9DD0

    java  -jar Conn 658-1694 EXIT  SQLFreeEnv  with return code 0 (SQL_SUCCESS)
      HENV                0000000000DD9DD0

    It doesn't help me to understand why Excel can use the BITSSageSrc DNS entry in SYSWOW64\ODBCAD32 but a java program cannot. It works on everything except SBS 2008. I would appreciate help from anyone who can identify what I am doing wrong.

    Monday, February 22, 2010 11:09 AM
  • Here's a trace taken whilst Excel was receivng data from the data source. This shows it is definitely there and working, why can my Java program not find it?


    MSQRY32         168c-1290 ENTER SQLAllocEnv
      HENV *              2F61DDD4

    MSQRY32         168c-1290 EXIT  SQLAllocEnv  with return code 0 (SQL_SUCCESS)
      HENV *              0x2F61DDD4 ( 0x008c3c60)

    MSQRY32         168c-1290 ENTER SQLDataSourcesW
      HENV                008C3C60
      UWORD                       31 <unknown>
      WCHAR *             0x008C4760
      SWORD                       34
      SWORD *             0x0018F09C
      WCHAR *             0x00000000
      SWORD                        0
      SWORD *             0x0018F064

    MSQRY32         168c-1290 EXIT  SQLDataSourcesW  with return code 0 (SQL_SUCCESS)
      HENV                008C3C60
      UWORD                       31 <unknown>
      WCHAR *             0x008C4760 [      11] "dBASE"
      SWORD                       34
      SWORD *             0x0018F09C (11)
      WCHAR *             0x00000000
      SWORD                        0
      SWORD *             0x0018F064 (51)

    MSQRY32         168c-1290 ENTER SQLDataSourcesW
      HENV                008C3C60
      UWORD                        1 <SQL_FETCH_NEXT>
      WCHAR *             0x008C4760
      SWORD                       34
      SWORD *             0x0018F09C
      WCHAR *             0x00000000
      SWORD                        0
      SWORD *             0x0018F064

    MSQRY32         168c-1290 EXIT  SQLDataSourcesW  with return code 0 (SQL_SUCCESS)
      HENV                008C3C60
      UWORD                        1 <SQL_FETCH_NEXT>
      WCHAR *             0x008C4760 [      11] "Excel"
      SWORD                       34
      SWORD *             0x0018F09C (11)
      WCHAR *             0x00000000
      SWORD                        0
      SWORD *             0x0018F064 (54)

    MSQRY32         168c-1290 ENTER SQLDataSourcesW
      HENV                008C3C60
      UWORD                        1 <SQL_FETCH_NEXT>
      WCHAR *             0x008C4760
      SWORD                       34
      SWORD *             0x0018F09C
      WCHAR *             0x00000000
      SWORD                        0
      SWORD *             0x0018F064

    MSQRY32         168c-1290 EXIT  SQLDataSourcesW  with return code 0 (SQL_SUCCESS)
      HENV                008C3C60
      UWORD                        1 <SQL_FETCH_NEXT>
      WCHAR *             0x008C4760 [      18] "MS Access"
      SWORD                       34
      SWORD *             0x0018F09C (18)
      WCHAR *             0x00000000
      SWORD                        0
      SWORD *             0x0018F064 (40)

    MSQRY32         168c-1290 ENTER SQLDataSourcesW
      HENV                008C3C60
      UWORD                        1 <SQL_FETCH_NEXT>
      WCHAR *             0x008C4760
      SWORD                       34
      SWORD *             0x0018F09C
      WCHAR *             0x00000000
      SWORD                        0
      SWORD *             0x0018F064

    MSQRY32         168c-1290 EXIT  SQLDataSourcesW  with return code 100 (SQL_NO_DATA_FOUND)
      HENV                008C3C60
      UWORD                        1 <SQL_FETCH_NEXT>
      WCHAR *             0x008C4760
      SWORD                       34
      SWORD *             0x0018F09C
      WCHAR *             0x00000000
      SWORD                        0
      SWORD *             0x0018F064

    MSQRY32         168c-1290 ENTER SQLDataSourcesW
      HENV                008C3C60
      UWORD                       32 <unknown>
      WCHAR *             0x008C4760
      SWORD                       34
      SWORD *             0x0018F094
      WCHAR *             0x00000000
      SWORD                        0
      SWORD *             0x0018F05C

    MSQRY32         168c-1290 EXIT  SQLDataSourcesW  with return code 0 (SQL_SUCCESS)
      HENV                008C3C60
      UWORD                       32 <unknown>
      WCHAR *             0x008C4760 [      13] "SageLi"
      SWORD                       34
      SWORD *             0x0018F094 (13)
      WCHAR *             0x00000000
      SWORD                        0
      SWORD *             0x0018F05C (16)

    MSQRY32         168c-1290 ENTER SQLDataSourcesW
      HENV                008C3C60
      UWORD                        1 <SQL_FETCH_NEXT>
      WCHAR *             0x008C4760
      SWORD                       34
      SWORD *             0x0018F094
      WCHAR *             0x00000000
      SWORD                        0
      SWORD *             0x0018F05C

    MSQRY32         168c-1290 EXIT  SQLDataSourcesW  with return code 0 (SQL_SUCCESS)
      HENV                008C3C60
      UWORD                        1 <SQL_FETCH_NEXT>
      WCHAR *             0x008C4760 [      11] "BITSS"
      SWORD                       34
      SWORD *             0x0018F094 (11)
      WCHAR *             0x00000000
      SWORD                        0
      SWORD *             0x0018F05C (16)

    MSQRY32         168c-1290 ENTER SQLDataSourcesW
      HENV                008C3C60
      UWORD                        1 <SQL_FETCH_NEXT>
      WCHAR *             0x008C4760
      SWORD                       34
      SWORD *             0x0018F094
      WCHAR *             0x00000000
      SWORD                        0
      SWORD *             0x0018F05C

    MSQRY32         168c-1290 EXIT  SQLDataSourcesW  with return code 0 (SQL_SUCCESS)
      HENV                008C3C60
      UWORD                        1 <SQL_FETCH_NEXT>
      WCHAR *             0x008C4760 [      13] "SageLi"
      SWORD                       34
      SWORD *             0x0018F094 (13)
      WCHAR *             0x00000000
      SWORD                        0
      SWORD *             0x0018F05C (16)

    MSQRY32         168c-1290 ENTER SQLDataSourcesW
      HENV                008C3C60
      UWORD                        1 <SQL_FETCH_NEXT>
      WCHAR *             0x008C4760
      SWORD                       34
      SWORD *             0x0018F094
      WCHAR *             0x00000000
      SWORD                        0
      SWORD *             0x0018F05C

    MSQRY32         168c-1290 EXIT  SQLDataSourcesW  with return code 100 (SQL_NO_DATA_FOUND)
      HENV                008C3C60
      UWORD                        1 <SQL_FETCH_NEXT>
      WCHAR *             0x008C4760
      SWORD                       34
      SWORD *             0x0018F094
      WCHAR *             0x00000000
      SWORD                        0
      SWORD *             0x0018F05C

    MSQRY32         168c-1290 ENTER SQLAllocConnect
      HENV                008C3C60
      HDBC *              0018E5AC

    MSQRY32         168c-1290 EXIT  SQLAllocConnect  with return code 0 (SQL_SUCCESS)
      HENV                008C3C60
      HDBC *              0x0018E5AC ( 0x008c4b10)

    MSQRY32         168c-1290 ENTER SQLSetConnectOption
      HDBC                008C4B10
      SQLINTEGER                 103 <SQL_LOGIN_TIMEOUT>
      SQLPOINTER          0x0000002D

    MSQRY32         168c-1290 EXIT  SQLSetConnectOption  with return code 0 (SQL_SUCCESS)
      HDBC                008C4B10
      SQLINTEGER                 103 <SQL_LOGIN_TIMEOUT>
      SQLPOINTER          0x0000002D (BADMEM)

    MSQRY32         168c-1290 ENTER SQLDriverConnectW
      HDBC                008C4B10
      HWND                00040352
      WCHAR *             0x6E59B264 [      -3] <Invalid string length!>
      SWORD                       -3
      WCHAR *             0x6E59B264
      SWORD                       -3
      SWORD *             0x00000000
      UWORD                        1 <SQL_DRIVER_COMPLETE>

    MSQRY32         168c-1290 EXIT  SQLDriverConnectW  with return code 1 (SQL_SUCCESS_WITH_INFO)
      HDBC                008C4B10
      HWND                00040352
      WCHAR *             0x6E59B264 [      -3] <Invalid string length!>
      SWORD                       -3
      WCHAR *             0x6E59B264
      SWORD                       -3
      SWORD *             0x00000000
      UWORD                        1 <SQL_DRIVER_COMPLETE>

      DIAG [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed (0)

      DIAG [01000] The driver returned invalid (or failed to return) SQL_DRIVER_ODBC_VER: 2.00 (444)

    MSQRY32         168c-1290 ENTER SQLGetInfoW
      HDBC                008C4B10
      UWORD                        2 <SQL_DATA_SOURCE_NAME>
      PTR                 0x008C4B78
      SWORD                     2048
      SWORD *             0x0018E5A8

    MSQRY32         168c-1290 EXIT  SQLGetInfoW  with return code 0 (SQL_SUCCESS)
      HDBC                008C4B10
      UWORD                        2 <SQL_DATA_SOURCE_NAME>
      PTR                 0x008C4B78 [      22] "BITSSageSrc"
      SWORD                     2048
      SWORD *             0x0018E5A8 (22)

    MSQRY32         168c-1290 ENTER SQLAllocStmt
      HDBC                008C4B10
      HSTMT *             0018E5A0

    MSQRY32         168c-1290 EXIT  SQLAllocStmt  with return code 0 (SQL_SUCCESS)
      HDBC                008C4B10
      HSTMT *             0x0018E5A0 ( 0x008c53f8)

    MSQRY32         168c-1290 ENTER SQLGetInfoW
      HDBC                008C4B10
      UWORD                        1 <SQL_ACTIVE_STATEMENTS>
      PTR                 0x0018E554
      SWORD                        2
      SWORD *             0x0018E48C

    MSQRY32         168c-1290 EXIT  SQLGetInfoW  with return code 0 (SQL_SUCCESS)
      HDBC                008C4B10
      UWORD                        1 <SQL_ACTIVE_STATEMENTS>
      PTR                 0x0018E554 (0)
      SWORD                        2
      SWORD *             0x0018E48C (2)

    MSQRY32         168c-1290 ENTER SQLGetInfoW
      HDBC                008C4B10
      UWORD                       25 <SQL_DATA_SOURCE_READ_ONLY>
      PTR                 0x008C4B78
      SWORD                     2048
      SWORD *             0x0018E5A8

    MSQRY32         168c-1290 EXIT  SQLGetInfoW  with return code 0 (SQL_SUCCESS)
      HDBC                008C4B10
      UWORD                       25 <SQL_DATA_SOURCE_READ_ONLY>
      PTR                 0x008C4B78 [       2] "Y"
      SWORD                     2048
      SWORD *             0x0018E5A8 (2)

    MSQRY32         168c-1290 ENTER SQLGetInfoW
      HDBC                008C4B10
      UWORD                        6 <SQL_DRIVER_NAME>
      PTR                 0x008C4B78
      SWORD                     2048
      SWORD *             0x0018E5A8

    MSQRY32         168c-1290 EXIT  SQLGetInfoW  with return code 0 (SQL_SUCCESS)
      HDBC                008C4B10
      UWORD                        6 <SQL_DRIVER_NAME>
      PTR                 0x008C4B78 [      24] "S15DBC32.DLL"
      SWORD                     2048
      SWORD *             0x0018E5A8 (24)

    Monday, February 22, 2010 11:19 AM
  • I have said previously that it worked on Windows 7. This is true when running within Netbeans. When I run the application outside of Netbeans I get :
    C:\Javadev\ConnectionTester\dist>java -jar ConnectionTester.jar jdbc:odbc:BITSSageSrc Lynn
    Cannot connect to jdbc:odbc:BITSSageSrc error: java.sql.SQLException: [Microsoft
    ][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application
    Exception in thread "main" java.lang.NullPointerException
            at connectiontester.Main.main(Main.java:32)

    It looks like what I am trying to do is some sort of architectural problem. The 64 bit system cannot talk to the 32 bit driver, maybe that's why the application says it cannot find the data source, because it is looking in the 64 bit list of sources instead of the 32 bit list (although I thought it was supposed to select the right one automatically).

    Anyone else got any thoughts?

    Monday, February 22, 2010 11:58 AM
  • I've been focussing on the reason why it won't work under W7 outside of the NetBeans environment. I have run SET in a DOS window and compared the output to what I get if I run SET within a Java program inside Netbeans. Some interesting differences turn up, although the CLASSPATH is the same:

    In DOS:
    PROCESSOR_ARCHITECTURE=AMD64
    PROCESSOR_IDENTIFIER=AMD64 Family 16 Model 4 Stepping 2, AuthenticAMD
    PROCESSOR_LEVEL=16
    PROCESSOR_REVISION=0402
    ProgramData=C:\ProgramData
    ProgramFiles=C:\Program Files
    ProgramFiles(x86)=C:\Program Files (x86)
    ProgramW6432=C:\Program Files
    PROMPT=$P$G
    PSModulePath=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
    PUBLIC=C:\Users\Public
    QTJAVA=C:\Program Files (x86)\Java\jre6\lib\ext\QTJava.zip

    Within Netbeans:
    PROCESSOR_ARCHITECTURE=x86
    PROCESSOR_ARCHITEW6432=AMD64
    PROCESSOR_IDENTIFIER=AMD64 Family 16 Model 4 Stepping 2, AuthenticAMD
    PROCESSOR_LEVEL=16
    PROCESSOR_REVISION=0402
    ProgramData=C:\ProgramData
    ProgramFiles=C:\Program Files (x86)
    ProgramFiles(x86)=C:\Program Files (x86)
    ProgramW6432=C:\Program Files
    PROMPT=$P$G
    PSModulePath=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
    PUBLIC=C:\Users\Public
    QTJAVA=C:\Program Files (x86)\Java\jre6\lib\ext\QTJava.zip


    So the processor architecture is reported differently. Does this account for the message : "The specified DSN contains an architecture mismatch between the Driver and Application
    Exception in thread "main" java.lang.NullPointerException at connectiontester.Main.main(Main.java:32)" and if so, what can I do about it to get it to run properly. I'm thinking that this is also the reason that SBS08 cannot find the correct driver. Is that possible?

    Thursday, February 25, 2010 4:01 PM

  • In DOS:
    PROCESSOR_ARCHITECTURE=AMD64
    ProgramFiles=C:\Program Files
    QTJAVA=C:\Program Files (x86)\Java\jre6\lib\ext\QTJava.zip

    Within Netbeans:
    PROCESSOR_ARCHITECTURE=x86
    ProgramFiles=C:\Program Files (x86)
    QTJAVA=C:\Program Files (x86)\Java\jre6\lib\ext\QTJava.zip

    For the error info "specified DSN contains an architecture mismatch between the Driver and Application" see http://msdn.microsoft.com/en-us/library/ms712362(VS.85).aspx


    When you are running under Netbeans, your apps must be in WOW mode. i.e. applications see X86 compatible folders and everything works fine. However When you open a command prompt from %systemroot%\System32 on an X64 machine, you are in 64-bit world. So the application fails when it cannot see/load 64-bit DSNs/Providers/Drivers.

    If this does not help and you know for sure that your application was running fine from pure 64-bit environment on SBS 2003 but is failing only on SBS 2008, you could contact Microsoft CSS SQL Developer support group.

    Sunday, March 07, 2010 6:05 PM
  • Thanks for your response that's very helpful. I understand that Netbeans is a 32 bit app and can therefore see the syswow64\odbcad32 data source. What I need to do now is tell the operating system to use that when I run the program from a DOS prompt. How do I tell it to use the SYSWOW64 version? Everything I have read suggests it will do it automatically but it seems to be getting it wrong. Can I explicitly tell it to use the 32 bit and not the 64 bit version?

    Thanks.
    Tuesday, March 09, 2010 8:56 AM
  • Thanks to those who responded. I leave this here to help anyone else who gets confused by the 64 / 32 bit architecture setup. What I was trying to do was use a 32 bit driver (provided by Sage) in a 64 bit environment. What I hadn't noticed was that it stopped working when I upgraded the underlying Java environment to 64 bit (yes, I know it's obvious now!). The 32 bit driver will never work in the 64 bit system (i.e. the Java environment is 64 bit). Downgrading everything to 32 bit means it is now working (albeit in 32 bit mode, which seems a waste). I think the implication is that I am dependent on Sage to come up with a 64 bit driver before I can work in a 64 bit environment - may be a while!

     

    • Marked as answer by NL Barton Wednesday, March 31, 2010 1:43 PM
    Wednesday, March 31, 2010 1:43 PM