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.
Related
This is my first post in here,
I am new to SQL and I started learning it, I use it mainly in excel to get data from an outer Database
I first go to data then Refresh all then from the menu I choose connection properties
Then a dialogue appears and I input my code in the window called Command text from the Tab Definition
I added images to show where I input my SQL code
My question is what type of SQL do I input there ?
is it mySQL or SQLServer or what ??, so I can learn it, because some commands just don't work with me the way they are supposed to do
You can connect to any database type as long as you have the appropriate ODBC drivers. For example, here is documentation for MySQL for Excel. Quote from article "Use Microsoft Query to retrieve external data":
If the external database that you want to access is not supported by the
ODBC drivers that are installed with Microsoft Query, then you
need to obtain and install a Microsoft Office-compatible ODBC driver
from a third-party vendor, such as the manufacturer of the database.
Contact the database vendor for installation instructions.
OLAP databases do not require ODBC drivers. When you install Microsoft Query, drivers are installed for databases that were created
by using Microsoft SQL Server Analysis Services. To connect to other
OLAP databases, you need to install a data source driver and client
software.
Whichever database type you connect to, you will still be using Microsoft's SQL variant (as developed for SQL Server). As a beginner you're not going to notice too many differences right off the top. Most of the differences are related to data types, such as DATE vs DATETIME. Here is a wiki on SQL Compliance and this article on MS Access SQL will also apply to Excel Query.
You can connect to many data source including: SQL Server database, Access database, MySQL database, PostgreSQL database etc..
You can find the full list here: Link
I'm having trouble using ODBC to connect from Excel 2016 to a PostgreSQL database.
I tried to follow this answer, without success, and this solution from MS, without any better results...
Has anyone ever succeeded at this? I saw that Excel 2016 had some troubles with ODBC drivers, but that was like a year ago, so I was wondering if things may be better now?
Thank you for your help.
My guess is this is a 32/64 bit thing. It's the single biggest issue we've had with setting people up on PostgreSQL within Excel/Access.
Bottom line: if your Excel instance is 32-bit (which is often the case), then you need to use the 32-bit ODBC driver. The latest Pg ODBC driver has both bundled in the same assembly, so the trick is to go into 32-bit ODBC and set up the driver that way.
From there, it should all be straight-forward:
Data Tab
From Other Data Sources
Microsoft Query
Select the Data source you just set up
And so on.
II am working on a Windows 10, 64-bit version, but turns out my Office package is 32-bit. Once I manually installed the 32-bit postgresql driver here: https://www.postgresql.org/ftp/odbc/versions/msi/, i was then able to correctly enter the Driver along the lines of these guidelines: https://www.connectionstrings.com/postgresql/
Final connection string looked like:
Driver={PostgreSQL ANSI};Server=name.text.ap-southeast-2.rds.amazonaws.com;Port=5432;Database=myDBname;
I had this as a comment before, but another commentor suggested I make this an answer: on excel 2016 for windows, don't waste your time with Data>Get Data >From Database. Instead use Data>Get Data >From Other Sources> From ODBC. To set up the ODBC: Click on the Start Menu. Select Control Panel. Select Administrative Tools and double click the Data Sources (ODBC) icon. Click on the System DSN tab. Here is a more detailed article that I pulled the ODBC set-up text from. Besides being much easier to set up, "From ODBC" comes with Office Business, or Office Home, while "From Database" only comes with Office Pro.
1.Excel 2016, x86
2.You need x86 odbc-driver
https://www.postgresql.org/ftp/odbc/versions/msi/
I used psqlodbc_13_02_0000-x86.zip
3.Create DataSource
-Control Panel
-Administration
-Open the 32 bit ODBC Administrator
-User DSN
-Add new User DSN (MyPostgreDsn), check connection
4.Connect Excel to Postgre
-Data
-From other sources
-OleDb wizard
-Other/Advanced
-Microsoft OLE DB Provider for ODBC drivers
-Connection - use connection string - Build
-Machine Data Source
-Choose created data source (MyPostgreDsn)
-Ok
-Test Connection
-Ok
-Choose tableā¦
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 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)
I use vb.net and windows form and sqlserver
I added Data Source(Microsoft SQL Server (SqlClient)) to my project. and now I need to change it to ODBC Data Source .
How Can I do That?
thanks
See these resources - you cannot simply change your SqlClient/SqlCOnnection - you need to use OdbcConnection instead:
Connecting to an ODBC Data Source Using ADO.NET
ADO.NET ODBC connection in VB.NET
ODBC is a technology several generations older than ADO.NET/SqlClient - why do you want to "downgrade" back into the dark ages?? What are you trying to achieve that you cannot do using SqlClient?? If you really must connect to a multitude of different datasources, I would strongly recommend using / investigating OleDB instead of ODBC. ODBC is really quite old, and e.g. doesn't have any 64-bit capable drivers.... OleDB does!
See the Wikipedia article on OleDB, and view impressive lists of OleDB data providers here and here for some insights.