web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Connecting to Microsoft Dynamics NAV 2009 (Native) database using jdbc / odbc

(1) ShareShare
ReportReport
Posted on by

Hi,

I'm trying to connect to a Microsoft Dynamics NAV 2009 (Native) database using jdbc / odbc using Java, but can't seem to get it to work. I've tried the 'Microsoft Dynamics NAV 2009 ODBC' driver, but receive an error when trying to connect using Java (software: Talend Data Integration). When trying to use a JDBC driver (Dynamics NAV JDBC Driver from CDATA), I also get an error. 

I'm sure the user has enough rights (the same user is used to connect through ODBC in QlikView). I've tried with Java 8, Java 7 (32bit and 64bit). The errors I get are rather generic ("General error" and "Connection reset"). Has anyone got any ideas on how to troubleshoot this problem? The OS on my laptop is Windows 7, 64 bit.

Regards,

Tim

*This post is locked for comments

I have the same question (0)
  • mmv Profile Picture
    11,471 on at
    RE: Connecting to Microsoft Dynamics NAV 2009 (Native) database using jdbc / odbc

    Hi,

    Could you share the screen print of the error?

  • Community Member Profile Picture
    on at
    RE: Connecting to Microsoft Dynamics NAV 2009 (Native) database using jdbc / odbc

    Hi,

    I have created a simple Java program to test the connection:

    package be.crossroad.dbconnect;
    
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.IOException;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.Properties;
    
    public class DbConnectionTest {
    	
    	public static void main(String[] args) throws FileNotFoundException, IOException, ClassNotFoundException, SQLException{
    		String propertyFileName;
    		File propertyFile;
    		Properties props = new Properties();
    		
    		if(args.length < 1){
    			throw new RuntimeException("You need to specify a property file to run this application");
    		}
    		
    		propertyFileName = args[0];
    		propertyFile = new File(propertyFileName);
    		props.load(new FileInputStream(propertyFile));
    		
    		String url = props.getProperty("url");
    		String driver = props.getProperty("driver");
    		String user = props.getProperty("user");
    		String password = props.getProperty("password");
    		String query = props.getProperty("query");
    		Properties dbProps = new Properties();
    		
    		System.out.println("Url = " + url);
    		System.out.println("Driver = " + driver);
    		System.out.println("User = " + user);
    		System.out.println("Password = " + password);
    		System.out.println("Query = " + query);
    		
    		System.out.println("Connecting...");
    		dbProps.put("user", user);
    		dbProps.put("password", password);
    		Class.forName(driver);
    		Connection conn = DriverManager.getConnection(url, dbProps);
    		System.out.println("Connected...");
    		
    		System.out.println("Executing query...");
    		Statement st = conn.createStatement();
    		ResultSet rs = st.executeQuery(query);
    		System.out.println("Query executed...");
    		
    		if(!rs.next()){
    			System.out.println("No results found for query");
    		} else {
    			do {
    				System.out.println("Row: " + rs.getString(1));
    			} while (rs.next());
    		}
    		
    	}
    }
    

    I've tried the following options:

    1) Microsoft Dynamics NAV ODBC Driver

    I've installed the following ODBC driver on my system:

    CDATA-JDBC-Driver_5F00_ConnTest.PNG

    I've used the following configuration:

    MS-Dynamics-NAV-Driver_5F00_Config_5F00_Test.PNG

    The result of the test program is (you can see the driver and url I used in the output):

    MS-Dynamics-NAV-Driver_5F00_ConnTest_5F00_Test.PNG

    The weird thing is, that when I click the 'Company' button in the configuration, I do get a list of the available companies.

    2) CDATA ODBC Driver for DynamicsNAV 2015

    I've installed this driver on my system:

    CDATA-ODBC-Driver-for-DynamicsNAV-2015.PNG

    I've used the following configuration:

    CDATA-ODBC-Driver_5F00_Config_5F00_Test2.PNG

    When I click the 'Test Connection' button, I get the following result (almost immediately):

    CDATA-ODBC-Driver_5F00_TestConnection_5F00_Test2.PNG

    My test program produces the following output:

    CDATA-ODBC-Driver_5F00_ConnTest_5F00_Test2.PNG

    3) CDATA JDBC Driver

    I've tried the CDATA JDBC Driver with the following result:

    CDATA-JDBC-Driver_5F00_ConnTest.PNG

    Any ideas on what I could try?

    Regards,

    Tim

  • Community Member Profile Picture
    on at
    RE: Connecting to Microsoft Dynamics NAV 2009 (Native) database using jdbc / odbc

    Could you send me an email to karunanithi.gopal@jeanmartin.com ? will guide you

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
Saurav.Dhyani Profile Picture

Saurav.Dhyani 2 Super User 2025 Season 2

#2
RK-25090803-0 Profile Picture

RK-25090803-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans