Solved

Create a view of AS400 table using ODBC

Posted on 2013-06-05
34
697 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
ID: 39227056
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
ID: 39227124
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
ID: 39227159
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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
LVL 1

Author Comment

by:JArndt42
ID: 39227188
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
ID: 39227359
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
ID: 39227596
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.
ID: 39228011
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
ID: 39228217
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
ID: 39229250
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.
ID: 39229392
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
ID: 39229445
it says Microsoft Windows XP
Professional
Version 2002
service Pack 3
0
 
LVL 38

Expert Comment

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

Expert Comment

by:BAKADY
ID: 39229628
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
ID: 39229636
that is my workstation. the machine that SQL Server is a 64 bit.
0
 
LVL 4

Expert Comment

by:BAKADY
ID: 39229645
Have you 2 odbc Manager versions???
0
 
LVL 1

Author Comment

by:JArndt42
ID: 39229650
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
ID: 39229655
This is a screen shot of my DSN
DSN.bmp
0
 
LVL 1

Author Comment

by:JArndt42
ID: 39229666
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
ID: 39229682
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
ID: 39229710
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
ID: 39229758
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
ID: 39229789
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
ID: 39229868
OK I tried that too. same issue. hmmmmmmmm
0
 
LVL 4

Expert Comment

by:BAKADY
ID: 39229963
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
ID: 39230044
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
ID: 39236501
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
ID: 39238236
question. Does the DSN have to be on the machine that SQL Server is on?
0
 
LVL 1

Author Comment

by:JArndt42
ID: 39238588
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
ID: 39239136
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
ID: 39239429
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
ID: 39239435
I am sure it will work When I get access directly to my Server. Thank you for all your help.
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
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…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

827 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