ODBC connction to Visual FoxPro files impossible?

I’m trying to connect to a Visual FoxPro database using jdbc:odbc.
I tested my DSN and I’m sure it is ok.

Servoy can see the list of tables but can’t work with them:

  1. when I try to create a form based on a table I have the exception: “java.sql.SQLException: Column not found Column not found”
  2. when I open Tools → Dataproviders, I can see my connection and the list of tables, but if I click over a table nothing appears to the right.
    It seems Servoy cannot read the table structure.

Any idea?
Is what I’m trying to do impossible?

Nobody at Servoy can say something about this problem?

Servoy does use a database driver to connect to a database, if the driver does comply to the jdbc driver spec. Servoy is able to use it.
From which manufactorer are you using the driver?

Is the standard Microsoft Visual FoxPro ODBC Driver.
Could you try it?

a.mariottini:
Is the standard Microsoft Visual FoxPro ODBC Driver.
Could you try it?

I’m afraid you need a JDBC driver, not an ODBC (as far as I know, ODBC is not fully supported by Servoy).

Servoy does not directly support ODBC, but uses the SUN jdbc->ODBC bridge for talking to ODBC datasources, this bridge is not the best piece of software there is, there are better (commercial) availeble bridges availeble to let Servoy talk to ODBC source.
for example http://www.easysoft.com/products/2003/main.phtml

I downloaded the driver from EasySoft and done some tests.
Using their Application Demo I can access my Visual FoxPro database, and execute sql code.
I installed the Easysoft driver into the servoy driver folder, configured the database ecc…

The problem is the same: when I create a new form based on that database an error occurs (java.sql.SQLException: Column Name: IS_NULLABLE cannot be found in result set)

If I access the Dataproviders menu I can see my database and the tables, but if I click over one of them nothing appears on the right of the window. I can’t see the tables structure.

Because using the demo application from Easysoft I can access my tables and do sql I think the problem is in Servoy.

a.mariottini:
… I can access my tables and do sql I think the problem is in Servoy…

We are quite sure it is not, FYI jdbc spec. notes the existence of “is_nullable”. (column 18 )
Each valid jdbc driver must provide this info, Servoy needs it to see if a column can be left null.
Best thing todo if this data use is of great importance, mail the driver developers and explain the problem.

I contacted EasySoft support and they say this:

I have just created a small form connecting from Servoy over the JDBC-ODBC Bridge to a SQL server database. I have been able to get data back into the form with no problems. The JDBC-ODBC Bridge is only able to support the calls that the ODBC driver supports. Looking at SQL server through ODBC test a columns call reveals that there should indeed be an IS_NULLABLE column which sql server has and passes back into Servoy. Looking at a Foxpro database here and trying to link it into Servoy we get the same error. This is because the Foxpro ODBC driver is not ODBC 3.5 and does not therefore have an IS_NULLABLE column within the columns metadata. You can see this from the output of ODBCtest:

Full Connect(Use If Needed)

Env. Attr. SQL_ATTR_ODBC_VERSION set to SQL_OV_ODBC3

Successfully connected to DSN ‘Visual FoxPro Database’.
SQLTables:
In: StatementHandle = 0x00761968, CatalogName = SQL_NULL_HANDLE,
NameLength1 = 0, SchemaName = SQL_NULL_HANDLE, NameLength2 = 0,
TableName = SQL_NULL_HANDLE, NameLength3 = 0, TableType = SQL_NULL_HANDLE, NameLength4 = 0
Return: SQL_SUCCESS=0

Get Data All:
“table_qualifier”, “table_owner”, “table_name”, “table_type”, “remarks”
“d:\I386”, , “bookmrk”, “TABLE”, “”
“d:\I386”, , “groups”, “TABLE”, “”
“d:\I386”, , “grpsyll”, “TABLE”, “”
“d:\I386”, , “prgrss2”, “TABLE”, “”
“d:\I386”, , “progress”, “TABLE”, “”
“d:\I386”, , “settings”, “TABLE”, “”
“d:\I386”, , “syllabi2”, “TABLE”, “”
“d:\I386”, , “syllabus”, “TABLE”, “”
“d:\I386”, , “usergrp”, “TABLE”, “”
“d:\I386”, , “users”, “TABLE”, “”
10 rows fetched from 5 columns.

SQLColumns:
In: StatementHandle = 0x00761968, CatalogName = SQL_NULL_HANDLE,
NameLength1 = 0, SchemaName = SQL_NULL_HANDLE, NameLength2 = 0, TableName = “bookmrk”,
NameLength3 = 7, ColumnName = SQL_NULL_HANDLE, NameLength4 = 0
Return: SQL_SUCCESS=0

Get Data All:
“table_qualifier”, “table_owner”, “table_name”, “column_name”, “data_type”, “type_name”, “precision”, “length”, “scale”, “radix”, “nullable”, “remarks”
“d:\I386”, , “bookmrk”, “syl_name”, 1, “C”, 64, 64, , , 0, “”
“d:\I386”, , “bookmrk”, “username”, 1, “C”, 32, 32, , , 0, “”
“d:\I386”, , “bookmrk”, “topic_id”, 2, “N”, 4, 4, 0, 10, 0, “”
3 rows fetched from 12 columns.

As you can see above the Foxpro database has ‘nullable’ rather than ‘is_nullable’ and it is this that is causing the problem. Unfortunately then the problem is within the Foxpro ODBC driver and the level of ODBC conformance that it is at. You can see as follows the SQL server ODBC driver does not exhibit this behaviour:

Get Data All:
“TABLE_CAT”, “TABLE_SCHEM”, “TABLE_NAME”, “COLUMN_NAME”, “DATA_TYPE”, “TYPE_NAME”, “COLUMN_SIZE”, “BUFFER_LENGTH”, “DECIMAL_DIGITS”, “NUM_PREC_RADIX”, “NULLABLE”, “REMARKS”, “COLUMN_DEF”, “SQL_DATA_TYPE”, “SQL_DATETIME_SUB”, “CHAR_OCTET_LENGTH”, “ORDINAL_POSITION”, “IS_NULLABLE”, “SS_DATA_TYPE”
“easysoft”, “dbo”, “products”, “product”, 1, “char”, 4, 4, , , 0, , , 1, , 4, 1, “NO”, 47
“easysoft”, “dbo”, “products”, “description”, 12, “varchar”, 128, 128, , , 0, , , 12, , 128, 2, “NO”, 39
2 rows fetched from 19 columns.

Is there something I can do?
Is there something you can do? (check for “nullable” if “is_nullable” is not found…)
There are other hidden issues with odbc drivers not conforming with ODBC 3.5?

It is really easy for them adding a column is_nullable in the result based on the info of nullable. (as this is required by jdbc 1.0 spec)
If they are unwilling todo so, we could make a change, but we prefer not to… we try to stick to the jdbc 1.0 spec. and not make exeptions for different databases (because the driver meganism was invented by SUN for just that)

EasySoft support told me to download their ODBC-SQL SQL Engine. This ODBC driver allows you to add ODBC datasources into it and allows ODBC 2.0 drivers to be queried by ODBC 3.5 applications.

Now I’m able to create a form in Servoy and add fields on it.
In Tools → Dataproviders now I can view the tables structure.

But when I run the form Servoy locks. It seems is not able to load data.
I need to kill Servoy in order to stop it.

Could you contact EasySoft and test directly thier products?

Sorry we require jdbc 1.0 for Servoy, if the driver is fully 1.0 complaint and there is a problem we are more than willing to check what the problem is, but we have no resources to go after bad driver implemtations issues.
I suggest you sent the driver people a mail with a link to this forum thread, to make them aware of this is_nullable problem.

Have you tried remote tables from Sybase? In Sybase Central you can create a remote server through ODBC and then map the tables. In Servoy you then connect to Sybase that will than look into FoxPro. We have a few customers using that setup. How to set it up is documented pretty well in the documentation that comes with SQL Anywhere.

I’ll try

I tried to use remote servers and found some problems.

I created in “Servoy/database” a new database using Sybase Central and
added the proper entry to sybase.config.
Then I tried to add a remote server to it, but this error occurs:
Could not execute store DLL (dbcis9.dll) entry point

I found the dll and copied to sybase_db folder. Same error.
So I deleted the database and created a new database in the “Sybase\SQL Anyware 9” folder (where is asademo.db).
There I’m able to add the remote database and it’s tables.
All seems to work in Sybase Central.

Then I copied the database to “Servoy/database”.
I started Servoy Developer but it stops with this error:
java.sql.SQLException: JZ006: CaughtIOException:java.net.ConnectExceptio:Connection refused:connect

Now if I open the database in Sybase Central and delete the remote server, Servoy Developer starts without problems.

It seems the Servoy installation of SQL Anyware can’t use databases containing
remote server.

Could you please tell me what is wrong and how can add a remote server to a database and make it work with Servoy?

Servoy 2.1
SQL Anyware 9
Windoes2000 Pro

What error messages do you get in your sybase_log.txt file? You can find this file in the sybase_db directory

Exaclty the same: could not execute store DLL (dbcis9.dll) entry point

The easiest is extend your system PATH variable. Add to it:

c:\Program Files\Sybase\SQL Anywhere 9\win32

(adjust path if you installed in a different location)

That way all the possible sql anywhere libs are in your path.

I can’t do that on end user server, so I copied all the content of \Sybase\SQL Anywhere 9\win32 to Servoy\sybase_db.

But I have again this error: java.sql.SQLException: JZ006: CaughtIOException:java.net.ConnectExceptio:Connection refused:connect

The sybase_log is empty and this is the content of servoy log:

Starting Servoy from C:\Programmi\ServoyServoy R2 2.1 build-310 on Windows 2000 using Java 1.4.2_05Looking for servoy.properties on C:\Documents and Settings\andrea\servoy.propertiesLoading servoy.properties from C:\Programmi\Servoy\servoy.propertiesLoading - Donejava.io.IOException: CreateProcess: sybase_db\dbsrv9.exe @sybase_db\sybase.config error=2java.io.IOException: CreateProcess: sybase_db\dbsrv9.exe @sybase_db\sybase.config error=2
at java.lang.Win32Process.create(Native Method)
at java.lang.Win32Process.(Unknown Source)
at java.lang.Runtime.execInternal(Native Method)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at com.servoy.j2db.develop.J2DBDeveloper$1.run(Unknown Source)
at com.servoy.j2db.util.aq.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Final get connection failure for server repository_server in 6 timesorg.apache.commons.dbcp.DbcpException: java.sql.SQLException: JZ006: Caught IOException: java.net.ConnectException: Connection refused: connectorg.apache.commons.dbcp.DbcpException: java.sql.SQLException: JZ006: Caught IOException: java.net.ConnectException: Connection refused: connect
at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:85)
at com.servoy.j2db.persistence.datasource.n.createConnection(Unknown Source)
at com.servoy.j2db.persistence.datasource.r.makeObject(Unknown Source)
at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:816)
at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:110)
at com.servoy.j2db.persistence.datasource.i.getConnection(Unknown Source)
at com.servoy.j2db.persistence.Server.getConnection(Unknown Source)
at com.servoy.j2db.persistence.Server.testConnection(Unknown Source)
at com.servoy.j2db.develop.J2DBDeveloper.b6(Unknown Source)
at com.servoy.j2db.develop.J2DBDeveloper.dataBaseInit(Unknown Source)
at com.servoy.j2db.develop.J2DBDeveloper.main(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.servoy.j2db.startup.Bootstrap.main(Bootstrap.java:119)
at Servoy.main(Servoy.java:27)
Caused by: java.sql.SQLException: JZ006: Caught IOException: java.net.ConnectException: Connection refused: connect
at com.sybase.jdbc2.jdbc.ErrorMessage.raiseError(ErrorMessage.java:487)
at com.sybase.jdbc2.jdbc.ErrorMessage.raiseErrorCheckDead(ErrorMessage.java:723)
at com.sybase.jdbc2.tds.Tds.handleIOE(Tds.java:3071)
at com.sybase.jdbc2.tds.Tds.login(Tds.java:394)
at com.sybase.jdbc2.jdbc.SybConnection.tryLogin(SybConnection.java:218)
at com.sybase.jdbc2.jdbc.SybConnection.regularConnect(SybConnection.java:195)
at com.sybase.jdbc2.jdbc.SybConnection.(SybConnection.java:174)
at com.sybase.jdbc2.jdbc.SybConnection.(SybConnection.java:126)
at com.sybase.jdbc2.jdbc.SybDriver.connect(SybDriver.java:179)
at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:83)
… 16 more

Open a command prompt cd to your Servoy directory and start sybase manually to see if you get further details:

cd "C:\Program Files\Servoy"
sybase_db\dbsrv9.exe @sybase_db\sybase.config