I am new to ODBC and have started reading articles to get aware of ODBC.
I have got a requirement to expose database that is currently hosted on SQL Server to be exposed to the users for other applications on ODBC so that other developers can create reports and perform other operations using ODBC.
What I need to do for this, do I need to write an API or just need to expose connection on ODBC driver and it will handle rest of the things?
Primary requirement is to expose database for user so that they can create there own Crystal Reports.
Please suggest some good links for the same.
I am going through following links
http://msdn.microsoft.com/en-us/library/aa299159(v=SQL.80).aspx
All you need to do is to configure ODBC connection on client machines. Of course SQL Server must be listening and accepting connections from clients.
To configure ODBC connection you can use ODBC manager. There is System DSN tab with "Add" button. Then use "SQL Server" or "SQL Server Native Client 10.0" driver and fill fields needed by driver. In your application you can use such DSN, or use ConnectString. Such connect string looks like:
Driver={SQL Native Client};Server=myServerAddress;Database=myDataBase; Uid=myUsername;Pwd=myPassword;
More examples at: http://www.connectionstrings.com/sql-server#p3
I don't know what language you use, but with Python (I use ActiveState Python with odbc module) you can try if ODBC works as expected with code:
import odbc
# connect string
db = odbc.odbc('Driver={SQL Native Client};Server=myServerAddress;Database=myDataBase; Uid=myUsername;Pwd=myPassword;')
# DSN
db = odbc.odbc('my_dsn/user/passwd')
c = db.cursor()
rs = c.execute("SELECT count(*) FROM tmp_table WHERE txt='ala'")
for txt in c.fetchall():
print('%s' % (txt[0]))
(of course change table and column name)
Related
How does one properly establish a connection string for integrating a macro-enabled PowerPoint to be able to query an Oracle database? I have seen many old youtube videos and online tutorials regarding this (mostly in excel), but the connection string appears differently in each one. I am using a 64 bit Windows machine and an Oracle database that I usually access through SQL Developer.
A reference link that appears to be in the right direction:
http://learnexcelmacro.com/wp/2011/11/oracle-connection-string-in-vba/
I am trying to use a connection with the service, so it should look something like this:
The only changes that I have personally made to the connection string are:
HOST is Hostname founder in SQL Developer instance properties
Port is Port in SQL Developer instance properties
Uid is username in SQL Developer instance properties
Pwd is password in SQL developer instance properties
I have left all other fields unchanged. It should be noted that I do in fact have Tools>References>Microsoft ActiveX Data Objects 2.8 Library
I understand that inside of SQL Developer you can view the properties for a database instance connection. Is all the information there to construct my connection string? I cannot get the connection string to work and I am constantly met with errors.
Thanks!
There are several drivers available to connect to an Oracle database from VBA.
Common are ODBC Driver, either from Microsoft or from Oracle or the OLE DB provider. OLE DB provider are also either from Microsoft or from Oracle. There are even a few more from 3rd party (see How to connect to Oracle 11 database from . net), but lets keep it simple.
Depending on which driver you choose, the connection string is different:
ODBC Driver from Microsoft: Driver={Microsoft ODBC for Oracle};...
ODBC Drvier from Oracle: Driver={Oracle in OraClient11g_home1};... (or similar)
OLE DB Provider from Microsoft: Provider=MSDAORA;...
OLE DB Provider from Oracle: Provider=OraOLEDB.Oracle;...
For details have a look at Oracle Connection Strings or Connection String Home Page
All these drivers/providers require at least an Oracle Instant client installed on your machine. When your PowerPoint is 32-bit then also the Oracle client and as well the driver/provider must be 32-bit. When your PowerPoint is 64-bit then all other components must be also 64-bit - you cannot mix 32-bit and 64-bit.
The Oracle drivers provided by Microsoft are deprecated for ages, they are not available for 64-bit! So, when you have a 64-bit Office then {Microsoft ODBC for Oracle} and MSDAORA are out of the game.
I'm a web developer that has been tasked with creating some sort of mechanism for moving data from an IBM AS400 to a SQL server. Unfortunately, linked servers are out of the question in this case as the SQL Server is just Standard Edition (db2 providers not available in this version) and the AS400 server is on a separate server. I've researched adding some sort of trigger on the AS400 table that calls a web service that would insert data into the SQL server, but that doesn't seem like the best method. Does anyone have any suggestions on the process to get the data from the AS400 to the SQL Server when it is committed to the AS400?
This solution assumes you are familiar with SQL Server Integration Services (SSIS):
Connection to AS400
Create a new ADO.Net connection Manager
Set the Provider to .Net Provider --> ODBC Data Provider
Create a DSN (Control Panel -->Administrative Tools-->Data Sources ODBC -->System DSN)
In the connection manager for Data source specification select the DSN created. Provide the login information.
Test the connection.
Data flow source:
Use the DataReader source
In Advanced Editor select the Ado.Net connection manager just created.
In Component Properties tab --> Custom properties, in SQLCommand specify the required query string (select * from DatabaseName.TableName)
Check the column mappings for accuracy
Go to Input and Output properties -->Data reader output -->External columns (Select the columns which were of type varchar in the table, they will now be of the datatype UnicodeString (DT_WSTR). This is because by default DataReader reads strings as unicode strings. This implies that in the destination table in SQL these columns must be of type unicode i.e NVARCHAR instead of VARCHAR)
Answer sourced from www.sqlservercentral.com/Forums
I synchronize my web applications with an IBM i. But I have my own database design and wrote a sync program on the Windows side.
Having the same database design I wonder why I would need a copy on SQL server. I would access the IBM directly. Install the drivers as #Kamran Farzami suggested and use them. That way there would be no lag between writes on the mainframe and your queries.
If a lag is acceptable for you and you can't access the IBM i directly, I see three main options:
Pull the data from your Windows system with the OLE DB driver. Using the .NET driver you can use the relative record number (RRN) to remember where you stopped synchronizing.
Read the journal files and make them available by creating a webservice on the IBM i.
Read the journal files in a scheduled job and push the changes from the journal to a webservice which updates the SQL server.
Option 1 only works if the files you sync are not reorganized. The RGZPFM command changes the record numbers. If that's okay, you can get the RRN in your SELECT statement: select *, RRN(MYTABLE) as RRNMYTABLE from MYTABLE
The web service server is included in OS400 since V5R4. So you should be able to use option 2.
I've done something similar where the SQL server was in a remote (Honduras) location where the internet connection was unreliable. It was a short VB program, using the OLE DB driver, running on the server that connected to the AS400 when it was available (or "slept" when the connection was down). When available the program would update/synchronize a uniquely keyed mirror file. Another program uploaded individual transaction records to a separate table (file).
We'd also periodically update SQL Server master tables (i.e. item master) from the AS400. That also utilized a VB program (could be any language using the driver) initiated on the server. It isn't exactly elegant, but more practical than an AS/400 trigger to a web service, I believe.
I am new to remote database connections and I want to setup a very simple single table Delphi XE6 project to view a table ('CUSTOMERS') that I've just created in a small Windows Azure SQL database. I plan to use this access for both VCL code and FireMonkey on Android later. I can see and edit the table using the Azure dashboard.
To test the VCL code, i've dropped an FDConnection on my form with a TFDTable, TDatasource and TDBGrid. I've seen example connection info here but this refers to the MSSQL driver which I presume that I don't have because I'm using XE6 Professional. So I've used a TFDPhysSQLiteDriverLink and tried using the SQLite driver with connection params:
User_Name=user#56ss8sbeq
Database=tcp:56ss8sbeq.database.windows.net
Password=1234
Encrypt=Yes
MetaDefCatalog=DB123SQL
DriverID=SQLite
My table is CUSTOMERS and this is in the table name property of the TFDTable. When I run the project I get no connection errors but I do get "[FireDAC][Phys][SQLite] ERROR# no such table CUSTOMERS". Does this indicate that I'm being stupid in trying to use that driver? If so, do I have any way of accessing my DB with FireDAC?
AFAIK Windows Azure SQL database is a MS SQL database hosted on the cloud.
You need an MS SQL driver. You just can not link to MS SQL with a SQLite3 driver!
Upgrade your XE6 edition by buying the FireDAC bundle, or switch to other libraries, like ADO Components, which are part of XE6 Professional if I remember well.
I am trying to create a new linked server.
I am using provider as SQL Server Native Client 11.0
I have entered Product Name and Data Source
If I create connection using these settings it works just fine.
But I am trying to create a linked server using catalog option where I enter the Db name example AdventureWorks
Now when I create connection, and expand new connection I just created
Then further Expand Catalogs folder
I see more than one databases, where as it should only show the one I specified while creating the linked server connection in the catalog option.
Can any tell me why this is happening? I have not been able to find anything related to this. Please let me know if you have any further questions.
I've found that the provider SQL Server Native Client 11.0 does do this and allows access to all catalogs. If you don't want this it sounds like you want to use the Microsoft OLE DB Provider for SQL Server as this allows you to specify a catelog (default database) and it only show you and allow access to that one database
I have table in Microsoft SQL server; and I'm using SPSS 14.1.
Now I want to connect SQL table to SPSS, so I can use SQL table from SPSS directly.
In SPSS, SQL database -> Data source -> Add New database connection -> Then I have 3 data source options only: dBASE Files, Excel Files, and MS Access Database. Which one can connect to SQL server?
You should open the Microsoft ODBC Administrator from Start or the Control Panel. There you should activate the System SDN tab, click Add... and add a SQL Server data source.
A wizard will open, where you can enter the details. First the name of the connection, which will be used as a reference by SPSS. Then optionally a description, and the ip address or name of the server.
On the next page select the authentication method, and if needed, enter the user and password. From this point, the default settings will most likely be good. If you will have character coding problems or something like that, you may need to change these settings.
I also use ODBC connection to connect to the database from SPSS, and it works well.
I hope this will help.
You may need an ODBC driver from MS or use one from the Data Access Pack for SPSS, but you will need a driver specifically for SQL Server.