In AX2012, I would like to create from x++ (in Dynamics) a query to DB2.
In my Server I installed the
Microsoft OLE DB Provider for DB2 Version 6.0
Which class have I to use by x++ to create and run the script in order to query the database?
I would like use this code, is right way?
System.Data.SqlClient.SqlCommand cmd;
System.Data.SqlClient.SqlParameterCollection parameters;
Int recCount;
Thanks.
Related
I am attempting to migrate a legacy client-server GIS application from Microsoft SQL Server to PostgreSQL. In this system the SQL Server database contains a large set of T-SQL stored procedures, each being an SQL Select query with one or more parameters.
In response to a client request, the server program – classic ASP VBScript – uses Microsoft ADODB to fill in the parameters values, execute the requested query and return the result set as an XML document to the client.
In the preliminary phase of the migration I have successfully:
installed PostgreSQL 9.3 for Windows, PgOleDB 1.0.0.20 and psqlODBC on a 32.bit Windows 7 Pro development PC
migrated the SQL Server database table definitions and constraint to a new PostgreSQL database and populated the tables using psqlODBC
using pgAdmin III, created and executed test queries against the PostgreSQL database
using pgAdmin III, created two test PostgreSQL table-valued Select functions – test1() one with no parameters and test2(text) with a single IN parameter — and verified that both execute correctly
written a test ASP/VBscript program that uses ADODB.Connection and ADODB.Command to connect to the PostgreSQL database, execute test1() - the no-parameter stored function - and create an ADODB.Recordset. This test works correctly.
However when I change my test ASP/VBscript program to use test2() and use objCmd.Parameters.Append like this:
objCmd.CommandText = "test2"
objCmd.Parameters.Append objCmd.CreateParameter("p1", adVarChar, adParamInput, 15, "000007-01012013")
to specify the required IN parameter, I get the ASP runtime error:
PgOleDB error '80004005' “Procedure name for automatic arguments is not unique“
Q1. What does the diagnostic “Procedure name for automatic arguments is not unique” mean?
Q2. Is there any public documentation available for PgOleDB other than the README.TXT and RELEASENOTES.TXT files installed along with PgOleDB.dll?
I am trying to update data in a PervasiveSQL backend (Sage ERP system) from SQL Server 2008 R2 via a Linked Server setup. Below are details and error msg returned... The kicker is that the update statement works on a development box just fine, very similar setup. Any help will be GREATLY appreciated!
Environment:
Windows Server 2008 Enterprise (Cloud server, Rackspace)
Microsoft SQL Server 2008 R2 (SP1) - 10.50.2500.0 (Intel X86) Express Edition with Advanced Services on Windows NT 6.1 (Build 7601: Service Pack 1) (WOW64) (Hypervisor)
Sage Timberline ERP running with Pervasive SQL v.10 backend
Setup:
We have a LINKED SERVER setup in SQL Server 2008, using a 32-bit Timberline Driver (OBDC)
Linked server is using a MSDASQL provider with the following two properties set to TRUE, “Allow inprocess” and “Non Transacted Updates”
Issue:
We can successfully pull data, see query below, from linked server. We can successfully browse objects via the linked server in SSMS.
SELECT *
FROM OPENQUERY (TLLINKSERVER, 'SELECT * FROM TABLE1 where JOBID = ''00-00-111111''')
However the UPDATE statement below returns the following error.
UPDATE OPENQUERY(TLLINKSERVER, 'SELECT * FROM TABLE1 WHERE JOBID = ''00-00-111111''')
SET DATEFIELD = '2013-07-15'
Error:
OLE DB provider "MSDASQL" for linked server "TLLINKSERVER" returned
message "[Sage Timberline Office][Sage Timberline Office ODBC
Driver]Syntax Error.". OLE DB provider "MSDASQL" for linked server
"TLLINKSERVER" returned message "[Sage Timberline Office][Sage
Timberline Office ODBC Driver]UPDATE "\SERVER1\Company
Data\DATA\COMPANY1\"<< ??? >>."TABLE1" SET "DATEFIELD1"=? WHERE
"JOBID"=? AND "DATEFIELD1"=?".
Msg 7343, Level 16, State 4, Line 1
The OLE DB provider "MSDASQL" for linked server "TLLINKSERVER" could not
UPDATE table "[MSDASQL]".
Why not make things easier? Does PervasiveSQL not support direct updates via a linked server?
UPDATE TLLINKSERVER...TABLE1
SET DATEFIELD = '2013-07-15'
WHERE JOBID = '00-00-111111';
Or maybe:
SELECT * FROM OPENQUERY(TLLINKSERVER, 'UPDATE TABLE1
SET DATEFIELD = ''2013-07-15''
WHERE JOBID = ''00-00-111111'');
While the UPDATE OPENQUERY syntax you're using is supported for SQL Server linked servers, I'm not sure that's true for other platforms such as PervasiveSQL...
This is how I update table sin Oracle from SSMS.
The Linked server name in this case is MyLinkedServer.
I am updating the column CONTACT_EMAIL to MyEmail#MyDomain.COM where the STATE is one of the following (KY,OH,NY,PA,VA,DC):
UPDATE L
SET L.CONTACT_EMAIL ='MyEmail#MyDomain.COM'
FROM OPENQUERY(MyLinkedServer, 'SELECT * from MyTable')L
WHERE L.STATE IN('KY','OH', 'NY','PA','VA','DC')
OPENQUERY method works perfectly.
I'm trying to run a script to set up tsqlt on SQL server 2008 r2 and getting this error
'OBJECT_SCHEMA_NAME' is not a recognized built-in function name.
on another machine with SQL 2008 r2, the script runs fine.
I can't see any difference in the users or permissions in the sql server setup for each respective machine.
this is the statement that throws the error:
CREATE FUNCTION tSQLt.Private_GetOriginalTableInfo(#TableObjectId INT)
RETURNS TABLE
AS
RETURN SELECT CAST(value AS NVARCHAR(4000)) OrgTableName,
OBJECT_ID(QUOTENAME(OBJECT_SCHEMA_NAME(#TableObjectId))
+ '.' + QUOTENAME(CAST(value AS NVARCHAR(4000)))) OrgTableObjectId
FROM sys.extended_properties
WHERE class_desc = 'OBJECT_OR_COLUMN'
AND major_id = #TableObjectId
AND minor_id = 0
AND name = 'tSQLt.FakeTable_OrgTableName';
GO
If this is in fact on SQL Server 2008 R2, your database is in SQL Server 2000 compatibility mode. You can tell what mode you're in now:
SELECT name, compatibility_level
FROM sys.databases
WHERE name = N'your_database';
If this is 80 you will need to move up (but this will require testing):
ALTER DATABASE your_database SET COMPATIBILITY_LEVEL = 100;
If you can't move up, then you can always get the schema name by joining to sys.schemas instead of relying on the built-in function.
That said, if you are on SQL Server 2005 RTM (as implied in a comment), OBJECT_SCHEMA_NAME was introduced in SQL Server 2005 Service Pack 2. You should not be running any system on SQL Server 2005 RTM anymore. Go install SP4 and you will be able to use this function.
I have a client with FileMaker Pro 11 Advanced.
I need to be able to connect to the filemaker database via SQL. I am using MS SQL Server 2008 R2, or Server 2012 can be used.
These are the steps I have tried
0) Turned on ODBC/JDBC sharing in File -> Sharing on FileMaker Pro 11 Advanced for "All Users"
1) installed the FileMaker OBDC driver included on the filemaker disc
2) odbcad32.exe in C:\Windows\SysWOW64 and added a new filemaker System DSN and directed it to the filemaker database.
3) Attempted to add a linked server to SQL using Provider Microsoft OLE DB Provider for OBDC Drivers and the System DSN name i created for Data Source. I left all other fields blank.
I get this error:
Cannot initialize the data source object of OLE DB provider "MSDASQL" for linked server "FILEMAKER2".
OLE DB provider "MSDASQL" for linked server "FILEMAKER2" returned message "[Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application". (Microsoft SQL Server, Error: 7303)
FILEMAKER2 is the what i called the System DSN.
What am I doing wrong/What do I need to correct in order to connect to filemaker with SQL?
Is there a connection string to put in for Provider String?
I have the same mismatch error trying to do a test connect with access.
Thank you for any help.
The error you're getting is because of the driver installed is a 32bit driver propably on a 64bit system.
Look in the downloads of FM for the correct xbit driver.
I've connected to FM using ODBC from PHP apps to do basic inserts, updates, deletes of data. I haven't worked with it like you're attempting to do, though, and like #ted said, FM really wasn't built as a SQL platform.
Their answer to this was to go the other way around. You can setup External SQL sources within FileMaker, and bind your SQL database to FM so that those tables show up in FM the same as regular FM tables. These tables can then be used within FM scripts accordingly, so you could setup any data sync steps necessary there. You could create scripts to move data from FM layouts into the SQL DB layouts at given intervals throughout the day, for example.
Hope that helps.
FileMaker 11 only comes with a 32 bit ODBC driver. The error you got happens when you use a 32 bit driver with the 64 bit ODBC admin utility. Set up your DSN using the 32 bit utility, found here:
C:\Windows\SysWOW64\odbcad32.exe
...and it will work fine.
I'm trying to convert some old Excel-reports to Crystal Reports. The excel sheets uses OLAP-cubes and connects to a database using a XMLA connection over a SimbaO2X driver.
I just can't figure out which connection settings to use in Crystal Reports to be able to connect to the database.
I've tried both XML and OLAP connections, but just can't get a database connection.
Any help with the connection setting would be appreciated!
Edit: The database is a bit of a black box; it's probably an Oracle database (it was an Oracle database before the end user frontend was rewritten in java. They could have changed the database as well.) I have however no success with neither the Oracle Server nor the Microsoft OLE DB for Oracle connection method.
I have also this morning found a SimbaO2X provider under the OLE DB folder. While not working it's the best so far -- it accepts the username and password and lets me select which database to connect to but then fails with ADO Error Code: 0x80040e73 (Format of the initialization string does not conform to the OLE DB specification.) At least I have something to go on.
I'm running Crystal Reports XI if someone needs to know.
Partial solution:
Upgrade Crystal Reports XI to Release 2, service pack 4.
Update from service pack 4 to service pack 6.
Upgrades and updates can be downloaded from the SAP Community Network
A connection can now be made with the SimbaO2X OLE DB driver. This solution should also resolve connection problems with some other databases as well.
However, adding a table to the report results in a 0x800a0cc1 error (Item cannot be found in the collection corresponding to the requested name or ordinal)