1

I think StackOverflow is the best QA for asking this question.

I would like to connect a 4D database (please don't ask why 4D, this is enough painful to have to use it) with mathematics tools such R (or Matlab or even a C++ or .NET handwritten client) but I can figure out the connection string!

I have installed 4D ODBC Driver, edited my ODBC sources and I am able to connect it through MS Access. I am working on W7 Pro. I am sure there is another possibilities and I want to explore them.

I checked various connection string databases but there is no connection string for 4D (I don't ask myself why). Simultaneously I will write to the 4D customer service, but I am sure some of you know the key or maybe a hint to solve this.

4

2 回答 2

2

我白天是(有点不情愿的)4D 开发人员,晚上是 Python 人。当我需要通过 SQL 连接到 4D 时,我使用pyodbc模块。我在 Windows 上工作,所以我的连接字符串只是我的 dsn 名称。

import pyodbc
conn = pyodbc.connect('DSN=4D_DSN_Name')

4D_DSN_Name 是我使用 4D ODBC 驱动程序创建的 32 位系统 DSN。我没有对设置做任何特别的事情,只是确保我有正确的地址、端口、用户名和密码。其余的默认设置似乎有效。

不是一个直接的答案,但也许是一个线索或替代方案。

于 2014-03-11T18:30:58.157 回答
1

将 Joshua 的帖子标记为答案,我将在此处添加一些详细信息...

就像使用代表整个连接字符串的 DSN 名称一样简单。它在 R 中是这样的:

> library(RODBC)
> dbhandle <- odbcDriverConnect('DSN=SomeObscureDatabase')
> dbhandle
RODBC Connection 1
Details:
  case=nochange
  DSN=SomeObscureDatabase
  DRIVER=4D v12 ODBC Driver
  Description=4D v12 SQL datasource.
  Server=x
  Port=19812
  UID=x
  PWD=x
  SSL=true
  PhysicalConnectionTimeout=30
  LoginTimeout=30
  QueryTimeout=240
  DefaultPageSize=100
  FavouriteImageFormats=*
  NetworkCacheSize=128
  CharsEncoding=UTF-8
  OpenQuery=false
于 2014-03-12T10:33:29.487 回答