Dreamfactory Cannot Insert Rows Into SQL Server 2008 R2 - sql-server-2008

Can connect and GET data from MS SQL Server from Dreamfactory.
Using dblib (library/driver)
When I try to use the createRecords method, I get a strange error.
If I try to insert records into a table called "iyer_test", I get an error that says table "EMP_OnRolls" does not exist in database.
Why do you think DSP should report an unrelated table as non-existent?
I am trying all this from the Swagger UI - so authentication, session and all other prerequisites are hopefully taken care of.
Service definition : Database Driver : dblib:host=del-xxxxxxxx:1433;dbname=utilities
I can connect to the database server with the user name supplied and the user has rights to read/write/modify rows in the tables. Confirmed with SQL Server Management Studio.
In the Swagger UI, if I enter the table name as "dbo.iyer_temp" I get an error that says dbo.iyer_temp table does not exist.
The body I pass to the createRecord method is {
"record": [ {
"lname" : "Iyer",
"fname" : "K Y
}]
}
The table iyer_temp has an id column called "id".
Why should the DSP report a strange table as not available?
Thanks in anticipation
Best wishes
Iyer

Current versions of the database service attempt to pull other schema from other tables that are viewable given the accessed credentials to determine relationships between tables (note, an upcoming release due out in the next week or so is smarter about what data is pulled). If you list tables available using the getResources() or getTables() method, does that table show up in the list?
If so, that is what is going on, the service is trying to pull schema from that table to determine if they are related. Is there a reason why that table is accessible for retrieving table names but not for schema?

Mark of Dreamfactory mentioned that the php5-sybase driver probably has a problem with MS SQL Server tables with hyphens in the table name.
After removing hyphens from the table name, inserts have worked fine.
Thanks
Iyer

Related

Using Snowflake ODBC Driver with MS Access

I am trying to access my tables in Snowflake using MS Access. I am able to make the connection to make a connection between them and see the list of all my tables but the I am getting all my tables (from all Databases and Schema) even if I have specifically mentioned the Database and Schema to be accessed when creating the Data Source Network(DSN).
And when I try to open a table i get the message: "Cannot define field more than once."
The table which I am accessing has a copy under different database. But, the table name and schema name is same.
ex:
DATABASE_A.SCHEMA.TABLE1
DATABASE_B.SCHEMA.TABLE1
Does anyone has any idea how to resolve this issue?
I can confirm that if you have two Snowflake databases with the same table name you experience this problem. I have been beating my head against a wall and your question gave me the clue. I was able to delete my other database in Snowflake and the error that you described disappeared.
I have come across another problem though but that will be for another SO question.

What's an alternative to triggers when using a Jet tables in an Access Database (mdb file)?

I have this project that would require users to check in/out through a finger print reader ZK SF200.
The system that I am building needs to fetch new data that is added into this machine's database which unfortunately is a MS Access mdb file.
In my limited experience in MS Access databases, I managed to link this file to my MySql database table which allows me to manually do the insert from MS Access.
All I want to do now is to create some form of trigger that would add data to my MySql database when new rows are inserted into the MS Access table.
This problem would have been solved if the file type was .accdb because we can use After Insert events however it is an mbd type so those are not supported.
Any idea on how I can solve this matter ?
As a final note: I am willing to change DBMS in case MySql is the obstacle here. Would creating a linked server or doing sql server replication through mssql 2008 r2 work ?
EDIT: I need to insert data to MySql table because I have a trigger implemented there which does its side of logical manipulation of the data (ex: Increment the number of visits for the customer, check if customer subscription has expired or not and update the customer status accordingly)
Thank you.
Linking a table in MS-Access to the ODBC source is probably an answer for you. The table in MS-Access will be more like a view on the source table. Any DML operation (INSERT, UPDATE, DELETE) will be synced immediately with the source database. You will not need any trigger, which is not available in MS-Access (unless some VBA expert knows a solution).
The Linked table technology is default available for SQL-server, but since it uses ODBC I quess you can use it with MySQL too.

Settting up a SSMS Linked Server to DB2

I have a local SQL Server instance on which I created a Linked Server connection to a DB2 database named "DB2OurDatabase." In creating the Linked Server connection, I specified a UID and PWD that I use in various query tools or applications to query "[SchemaX].[TableX]."
I seemed to have success in creating the Linked Server: A Linked Server node Object by the name of "DB2OurDatabase" was created under the Linked Server node in SSMS and when I expand it, I am able to see the of tables in the database.
When I right mouse click on the [SchemaX].[TableX] table and select
"Script Table as => Select To ==> New Window", a new query window was opened with the text
--[DB2OurDatabase].[DataCenterCityName2_DB2OurDatabase].[SchemaX].[TableX]
contains no columns that can be selected or the current user does not have permissions on that object.
GO
I don't understand how I was able to create a Linked Server that can see the table names in the database but yet apparently seem to encounter what appears to be a lack of rights to query the table even tghough I am using same credentials that I have used in Squirell SQL query tool, for example, to query the table.
In SSMS, I tried to execute this
SELECT *
FROM [DB2OurDatabase].[DataCenterCityName2_DB2OurDatabase].[SchemaX].[TableX]
Error:
Msg 7314, Level 16, State 1, Line 1
The OLE DB provider "IBMDADB2" for linked server "DB2OurDatabase]" does not contain the table ""DataCenterCityName2_DB2OurDatabase"."SchemaX"."TableX"". The table either does not exist or the current user does not have permissions on that table.
I was a little surprised that the fully qualified table name included [DataCenterCityName2_DB2OurDatabase] since I did not specify this when I set up the Linked Server connection, but the name of the DataCenter city was correct so I took this as a further sign that the Linked Server connection was successful.
Nevertheless, I also tried to execute remove this level of the fully qualified table name:
SELECT *
FROM [DB2OurDatabase].[SchemaX].[TableX]
which resulted in this error.
Msg 208, Level 16, State 1, Line 1
Invalid object name 'DB2OurDatabase.[SchemaX].[TableX]'.
What do I need to do to create a DB2 Linked Server that lets me query the tables in the DB2 database? Here's my linked server properties:
I haven't investigate what are probably multiple ways to conenct and query DB2 from Sql Server, but this worked:
SELECT * FROM OPENQUERY(DB2OurDatabase, 'SELECT * FROM SchemaX.TableX')
Obviously, you modified the actual commands by replacing object names, so it's impossible to be sure, but the problem may be caused by your use of quoted identifiers (those square brackets), which essentially makes the object names case-sensitive. DB2 will by default create object (table, schema) names in uppercase, unless they are quoted. create table MySchema.MyTable... (unquoted) on the DB2 side will create the table MYSCHEMA.MYTABLE, and referencing it later from SSMS as [MySchema].[MyTable] (using quoted identifiers) will obviously fail.
These are the 3 steps that bring me to the solution:
Download and install Microsoft OLE DB Provider for DB2 Version 6.0 (this is the latest version but by the time you read this post there might be a new version now)
From the start menu open the Data Access Tool > File > New Data Source and complete all the steps: provide the notorious credentials like Server, Port, Database, User, Password. If unsure contact your DBA. Once completed test the connection and copy the Connection String
Now on SSMS go to Server Object > Linked Servers > New Linked Server and fill up like in picture setting up in the Provider string the string you copied before from the Data Access Tool:
Done, you are good to go now,

Joinning SQL Server table with *.mdb file

I'm trying to joinning SQLServer 2008 R2 tables with msaccess table (*.mdb).
I already tried "OPENDATASOURCE" and "Linked Server", but no one of them is work correctly.
in example, I've got the following message:
OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server
"TestLinkServer" returned message "Cannot open database ''. It may
not be a database that your application recognizes, or the file may be
corrupt.".
the other error message:
OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "MDBTest"
returned message "The Microsoft Jet database engine cannot open the
file '\10.55.56.34\Shared Folder\LBUS.mdb'. It is already opened
exclusively by another user, or you need permission to view its
data.".
and many more :D
can anyone give the working tutorial?
thanks in advance.. :)
The easiest way is to do the join inside ms-access.
Set up a table link in your access database that references the sql-server table you want to join.
Then build a query in access that joins that table with one or more tables in the access database.
If you want to join more than one sql-server table, first create a view in sql-server that combines all the relevant tables. Then set up your table link to reference the view.
If, for some reason, you must do the join inside SQL server, you will have to use a different technique, or use the table link feature to "push" data from the access table to a (previously defined) sql server table. Then, it's just an ordinary join.

Reserved error (-1524)

I am upgrading some of my MS Access programs from 2003 to 2007 version. I have a variable stored "Public" in the main menu of a program. In another form, I write that variable to a record (the form is using unbound data). The VBA line "Rst![FieldName]=Forms![Main Menu].strUser" gives a RunTime error of 3000, Reserved error (-1524).
What the heck is going on???????
Thanks for any help given.
I encouteredthe error when updating an mdb split database (frontend backend) to Access 2010. The original mdb database used an internal linkage (an autoid number in one table linked to the same number defauted in a second table). I encountered the problem when trying to import the first table mentioned above. I could not import the table or copy-paste the table without getting the "Reserved error (-1624) error.
The solution was to import the other tables that imported ok without the problem into a new 2010 database, and then use a make table query to duplicate the problem table in the new 2010 version. The process preserved the auto id numbering, so the internal relationship is preserved in the new, updated database.
I did have the same problem and after look the records in one table discover that one record had language changed and was all in Chinese alphabet.
After delete the record no more error.
Looks like, in my case, the error was generated because the primary key was used to link to another table. I did a check after and manage to identify one record in the other table that do not exist in the main table (record I deleted).