Solved

Create a view of AS400 table using ODBC

Posted on 2013-06-05
34
688 Views
Last Modified: 2013-06-11
I am trying to move my BE to SQL Server and use MSAccess as FE. After reading some I understand that I want to do most of the work on the BE instead at each station therefore improving speed in the office as well as our satellite offices. That being said I need to either link an MS SQL Server table to some in Access or create a view of the AS400 table. I am new to MS SQL Server so any help would be greatly appreciated even suggestions.
0
Comment
Question by:JArndt42
  • 16
  • 12
  • 3
34 Comments
 
LVL 4

Expert Comment

by:BAKADY
Comment Utility
i need more information...

how do you want to transfer your data?

AS400 (BE) ==> MS SQL (BRIDGE) ==> Access (FE)

Regards
0
 
LVL 1

Author Comment

by:JArndt42
Comment Utility
What I was thinking is that I would like to create views in MS SQL. For instance I have a table in AS400 that has the carrier information. I will have some tables in MS SQL that will have other information that is NOT in AS400 such as traffic lanes. Currently I have that table in Access and use the pass through along with the other table to create a query. What I want to know is if there is a way to get the information from AS400 into MS SQL so I can create a view much like the query I now have in Access. The ultimate goal is to do all of the processing on the BE, MS SQL, to reduce network traffic therefore making the FE faster.
0
 
LVL 4

Expert Comment

by:BAKADY
Comment Utility
it seams to be like my own actually project....

we have a ERP in AS400, with stored procedures our MSSQL-Server calls/copies the data from AS400 and generates there some reports, users call/display this info using Pivot-Tables and Charts in EXCEL.

is that likely what you need???

Sorry bad english...   :(
0
 
LVL 1

Author Comment

by:JArndt42
Comment Utility
yes it sounds like what I need. so basically you have a stored procedure that you have that gets the information from AS400? How do you do that?
0
 
LVL 4

Expert Comment

by:BAKADY
Comment Utility
Your requirements to Connect AS400 and MSSQL:

- IBM iSeries Server with opened ports to connect to it with Client Accees 32-bit ODBC Driver
- An enabled AS400 user for login
- Windows Server 2003/2008 64-bit with followed installed software:
- MS SQL Server 2005/2008 R2 (no express editions)
- Client Access 32-Bit ODBC-Driver

Ready???
0
 
LVL 1

Author Comment

by:JArndt42
Comment Utility
I have everything except for one thing. I am using MS SQL Server 2000. Will that affect it?
0
 
LVL 38

Expert Comment

by:Jim P.
Comment Utility
SQL 7 and above can do an openquery method to an AS400 to read data as long as the driver is loaded on the SQL Server. Changing the data on the AS400 is a different animal.

For instance I have a table in AS400 that has the carrier information.

I figure that such info is pretty static; maybe only changing once a day. So I would create a table that mimics the AS400 table.

Then create a linked server to the AS400 and import the data to the local table.

The stored proc would be like:
Create Procedure dbo.RefreshCarrierTable
As
Begin
DELETE FROM CarrierTable

INSERT INTO CarrierTable
SELECT * FROM LinkedCarrierTable
End

Open in new window


Run that at 6AM every morning.

Some info on linking to the AS400:
http://social.msdn.microsoft.com/Forums/en-US/transactsql/thread/0e68f512-1e19-4c50-b343-219085d70076
0
 
LVL 4

Expert Comment

by:BAKADY
Comment Utility
I don't work with SQL 2k since 5 years, but jimpen is right...your need to add a linked server at SQL server.

But first create a System-DSN in ODBC-Manager which connect to AS400... Use the Client Access ODBC-Driver and test it with Microsoft Query (office)
Is your OS or MSSQL 64-bit ?, you need to use the same xx-bit version of ODBC-Manager, otherwise your linked server couldn't be able to connect with AS400.
Don't forget to check your rights CALL & SELECT if it possible.
If you have a lot of data, deactivate the connection limit.

Ready?

@next step: "linked server"

NOTE: Please post screenshots of your dsn configuration...!!!
0
 
LVL 1

Author Comment

by:JArndt42
Comment Utility
I have the connection already. I currently use pass through with MS Access. I have another question open on EE that is related to that. I have been reading about linked server. When I attempt to create the linked server I have to fill out the following fields. I need to know what goes into the linked Server field.

Linked Server: ???
Other Data Source: Microsoft OLE DB Provider for ODBC Drivers
Product Name: Whatever I want to name it?
Data Source: AS400 ODBC ( then name of my driver I made on my machine)
Provider String: Provider=MSDASQL.1;Password=xxxxxx;Persist Security Info=True;User ID=xxxxx;Data Source=AS400 ODBC;Initial Catalog=IESFILE

How do I check to see if both are 64 bit?
0
 
LVL 38

Expert Comment

by:Jim P.
Comment Utility
To see whether a Windows system is 64 bit you would right click on My Computer then select Properties. It will say it under System.
0
 
LVL 1

Author Comment

by:JArndt42
Comment Utility
it says Microsoft Windows XP
Professional
Version 2002
service Pack 3
0
 
LVL 38

Expert Comment

by:Jim P.
Comment Utility
That is on your workstation. Or is that where your SQL Server is located as well?
0
 
LVL 4

Expert Comment

by:BAKADY
Comment Utility
Just this:

Product Name: Whatever You want to name it?
Data Source: AS400 ODBC ( then name of your Dsn)

After that you will find into the advance connections properties of your linked server a Place to setup the As400 User and password.

I dont know how its calls into SQL 2k, but i think you will be able to Input your as400 User and the password.

To Check your Connection create a New query and write:

Select * from openquery( yourlinkedserversmane , 'select count(*) from someas400library.someas400table')
Go

Ready???


@next step: create Stored procedures to Sync, copy or write Data from as400 to SQL and Reverse.
0
 
LVL 1

Author Comment

by:JArndt42
Comment Utility
that is my workstation. the machine that SQL Server is a 64 bit.
0
 
LVL 4

Expert Comment

by:BAKADY
Comment Utility
Have you 2 odbc Manager versions???
0
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 
LVL 1

Author Comment

by:JArndt42
Comment Utility
BAKADY, it is making me fill out the Linked Server field and I can not continue until it is filled out. What should I put in there?
0
 
LVL 1

Author Comment

by:JArndt42
Comment Utility
This is a screen shot of my DSN
DSN.bmp
0
 
LVL 1

Author Comment

by:JArndt42
Comment Utility
here is a copy of the set up screen for the linked server.
Linked-Server-Set-up.bmp
0
 
LVL 1

Author Comment

by:JArndt42
Comment Utility
I get the following error when I try attempt to open a table on this newly created Linked server I just made.:
Error 7399: OLE DB providor 'MSDASQL' Reported an error.
Data source name not found and no default driver specified]
OLE DB error trace [OLE/DB Provider 'MSDASQL' IDBinitialize:: Initialize returned 0x80004005:]
0
 
LVL 4

Expert Comment

by:BAKADY
Comment Utility
Dont use blanks/spaces into names!!!!!

And delete the provider string, if it's require write DSN=YourDSNname
0
 
LVL 1

Author Comment

by:JArndt42
Comment Utility
thank you for your help. same error even when I created a new DSN without spaces and removed the string and when wrote DSN = my dsname. There is something wrong and driving me crazy. I have a feeling it has something to do with that Linked server:
0
 
LVL 4

Expert Comment

by:BAKADY
Comment Utility
Have you create a User DSN or System DSN?
You Need a System DSN!
Orherwise mssql wouldnt find it!
0
 
LVL 1

Author Comment

by:JArndt42
Comment Utility
OK I tried that too. same issue. hmmmmmmmm
0
 
LVL 4

Expert Comment

by:BAKADY
Comment Utility
i need a new screenshot of you linked server current options, security and provider options too...
which rights have your as400 user...???

Reference:  http://support.microsoft.com/kb/2450479

make some others screenshots too... any tab of the DSN, it can help to perform your connection... any option of your linked server, maybe your right the user/password at the wrong place...  your user configuration WRKUSR(yourusername), maybe your dont have the richts for....   and you openquery sql request that fails...

NOTE to the EE Moderator: I hope i get 100.000 point if i get it working!!!!   ;)
0
 
LVL 4

Expert Comment

by:BAKADY
Comment Utility
JArndt42: ask to the EE moderator, if there's here some kind of visual assistance posible... i allready get a warning because i tried to contact you offside EE.  sorry, ... so are rules... you need appropriate assistance to do this...

it's aroung 2 days since your question is online and it isn't working...

i want to help but i drive blind... sorry.
0
 
LVL 4

Expert Comment

by:BAKADY
Comment Utility
like i said, with this requirements i am able to Connect AS400 and MSSQL:

- IBM iSeries Server with opened ports to connect to it with Client Accees 32-bit ODBC Driver
- An enabled AS400 user for login
- Windows Server 2003/2008 64-bit with followed installed software:
- MS SQL Server 2005/2008 R2 (no express editions)
- Client Access 32-Bit ODBC-Driver

i can make a tutorial too,  i don't really try to do one before... but i think the moderator can help us...   ;)

about sql  2k ... just i cann't put away the curiosity of because it isn't working.... just few parameters should be false...

regards
0
 
LVL 1

Author Comment

by:JArndt42
Comment Utility
question. Does the DSN have to be on the machine that SQL Server is on?
0
 
LVL 1

Author Comment

by:JArndt42
Comment Utility
Well for whatever reason this is not working. And I really do not have the time to deal with this. I will have to use a pass through, that does work, in access to the SQL Server and the pass through to the AS400 as well. I was just trying to get it to work with SQL Server so that everything could be done on the back side.
0
 
LVL 4

Accepted Solution

by:
BAKADY earned 500 total points
Comment Utility
question. Does the DSN have to be on the machine that SQL Server is on?
YES... OMG!!!!

- Windows Server with installed and running SQL-Server and Client Access 32-Bit ODBC Driver
- and AS400 (IBM iSeries) with a user for this proposes

i think i write this twice or more times ...
just these both machines... where did you create the dsn...??? at your own workstation...???

if this is the case... sorry dude, but you need to explain me how the sql-server get access to your workstation to use it....

forgot your workstation... shut it down... work at your server...
0
 
LVL 1

Author Comment

by:JArndt42
Comment Utility
I have been using Enterprise Manager at my work station. I do not have access to the Server at this time. I will work on that. Thank you so very much for your help. I sure hope I can get this to work.
0
 
LVL 1

Author Closing Comment

by:JArndt42
Comment Utility
I am sure it will work When I get access directly to my Server. Thank you for all your help.
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now