Helpful Information
 
 
Category: Firebird SQL Development
ODBC (OdbcJdbc.dll)

... for the record:
In VFP8 when I try this:
h = SQLSTRINGCONNECT([DRIVER={Firebird/InterBase(r) driver};UID=sysdba;PWD=masterkey;DBNAME=server_name:database_name])
SQLEXEC(h, [create database 'c:\test.gdb' user 'SYSDBA' password 'masterkey';])

I get the following error mdg.
Connectivity error: Dynamic SQL Error SQL error code = -530
Cannot prepare a CREATE DATABASE/SCHEMA statement :confused:

Question: Can I create a database with ODBC (OdbcJdbc.dll) or should I go for other ODBC driver ?

Thank you.

And what ODBC driver do you use ?
From where have you downloaded it ?

Originally posted by mariuz
And what ODBC driver do you use ?
From where have you downloaded it ?

Yes VFP8 = visual foxpro 8
ODBC driver from http://www.ibphoenix.com/ (http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_60_odbc)

You cannot create a database through ODBC because it needs an active connection to a database. At least the open source ODBC driver ( I use the same driver) . You can use API for this. Check
http://www.ibphoenix.com/main.nfs?a=ibphoenix&l=;IBPHOENIX.KNOWLEDGEBASE;ID=52
But I didn't tried.

Or you can use the CreateProcess() Win32 API call to run isql.exe
with appropriate arguments.

Or, the easy way, have a empty database (zipped is around 26k), copy it to the location you need, then connect to it . You can include the zipped empty database in your app/exe as resource in project manager.

By the way, I use Firebird with VFP7. I've converted data for a data intensive application in our company, with many table corruption issues. I have 5 months now, without a SINGLE problem.

Salut

I've checked API documentation and here is how you can create a database using API

DECLARE long isc_dsql_execute_immediate IN fbclient.dll string @ status_vector ;
, integer @ db_handle ;
, integer @ tr_handle ;
, integer length ;
, string statement ;
, integer dialect ;
, string @ xsqlda

Sample code:

status_vector = REPLICATE(CHR(0),80)
db_handle = 0
tr_handle = 0
length = 0
statement = [CREATE DATABASE 'C:\TESTDATA.FDB' USER 'SYSDBA' PASSWORD 'masterkey' PAGE_SIZE 4096]+CHR(0)
DIALECT = 3
XSQLDA=NULL

?isc_dsql_execute_immediate(status_vector, db_handle, tr_handle, length, statement, dialect, xsqlda)

If the function return 0, then database is created.
If the function return >0, then the error code and message can be retrieved using isc_sqlcode() and isc_sql_interprete() API functions

... this is the answer.

Thank you badukist

Do you use in your remote views in your VFP7 application? I want to create a remote view through the view designer when I try to add a table a get the list of tables but when I select one of them and then I click on ADD VFP gives me an error :( . Do you know anything about it? tahnks for your help.

Skysurfer




You cannot create a database through ODBC because it needs an active connection to a database. At least the open source ODBC driver ( I use the same driver) . You can use API for this. Check
http://www.ibphoenix.com/main.nfs?a=ibphoenix&l=;IBPHOENIX.KNOWLEDGEBASE;ID=52
But I didn't tried.

Or you can use the CreateProcess() Win32 API call to run isql.exe
with appropriate arguments.

Or, the easy way, have a empty database (zipped is around 26k), copy it to the location you need, then connect to it . You can include the zipped empty database in your app/exe as resource in project manager.

By the way, I use Firebird with VFP7. I've converted data for a data intensive application in our company, with many table corruption issues. I have 5 months now, without a SINGLE problem.

Do you use in your remote views in your VFP7 application? I want to create a remote view through the view designer when I try to add a table a get the list of tables but when I select one of them and then I click on ADD VFP gives me an error :( . Do you know anything about it? tahnks for your help.

Skysurfer

You have to check the "All User Tables" check box on the bottom of the "Open" window.

Doru










privacy (GDPR)