Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 9th, 2005, 07:29 PM
Registered User
 
Join Date: Feb 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default AS/400

Has anyone used SQL Server to make a real time request or update to an AS/400?

Right now my organization communicates with an AS/400 through a scheduled job of a DTS package on SQL Server 2000, to push and pull data. We'd like to do this real time.
 
Old February 12th, 2005, 02:03 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jemacc
Default

Can you be more descriptive of your task?

Jaime E. Maccou
 
Old February 14th, 2005, 11:37 AM
Registered User
 
Join Date: Feb 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Id like to read from or update an AS/400 file (or table, or whatever their called) from an SQL Server stored procedure in real time. Or write a web service to do it.

From SQL Server, is a Linked Server my only option. If so, what are the linked server properties?

From a web service, what would be the connection string?

 
Old February 14th, 2005, 02:48 PM
Authorized User
 
Join Date: Jul 2004
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Setting up AS400 linked server:

If you plan to update the AS400 Journaling must be turned on

Create a System ODBC connection, use an AS400 login whose password doe not expire preferably. Using the Client Access ODBC driver.

in enterprise manager under security/linked servers

Right click and ADD

Specify a name for your AS400, I call mine simply AS400

select MS OLEDB for ODBC driver

IN data source specify the System Datasource set up previously

click the provider option button, check all but level zero

click the security tab and put in the AS400 user and password you want to use

under server option check all but collation compatible.

I'm not quite sure what all that does but it took me 3 months to figure it out.

David
 
Old February 15th, 2005, 05:47 PM
Registered User
 
Join Date: Feb 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks David. Using your instructions I was able to create the Linked Server. I expand the tree I created and see tables and views. But if I try to write a sql statement (like, select * from as400_s...DRW), the message returns:

Server: Msg 7313, Level 16, State 1, Line 1
Invalid schema or catalog specified for provider 'MSDASQL'.
OLE DB error trace [Non-interface error: Invalid schema or catalog specified for the provider.].

Any suggestions?

 
Old February 16th, 2005, 05:16 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

I tried this out and could only get it working by:
- in provider option button, unchecking 'Index as Access Path'
- in SQL using SELECT * FROM <<LinkedServer>>.<<AS400Name>>.<<AS400Library>>.<< AS400File>>

hth
Phil
 
Old February 16th, 2005, 09:55 AM
Authorized User
 
Join Date: Jul 2004
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Default

that is useing 4 part naming, but is unefficient from what I have read.

here is a sample of how to use OPENQUERY

select * from openquery(as400,'
select * from library.tablename
where
charfield = ''some char value'' and
numfield = 2
')

the AS400 select statement must be enclosed in single quotes, any char values must be within double single quotes, numeric values no quotes.

the AS400 after the OPENQUERY is the name of your linked server, mine is simply named AS400

I usually format my openquery statements as above, makes it simple to understand (for me)

David



Quote:
quote:Originally posted by pgtips
 I tried this out and could only get it working by:
- in provider option button, unchecking 'Index as Access Path'
- in SQL using SELECT * FROM <<LinkedServer>>.<<AS400Name>>.<<AS400Library>>.<< AS400File>>

hth
Phil
 
Old February 16th, 2005, 10:41 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

OIC, you use OPENQUERY to actually get the data. That's v useful, thanks, and it does seem to be quicker too
 
Old October 2nd, 2009, 11:22 AM
Registered User
 
Join Date: Oct 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQL SERVER Linked Server to AS400

IF I create code in .NET with this parameters I make a success full connection to AS400:

conexion.ConnectionString = " DataSource=10.254.xxx.xxx;DataBase=S1018689;UserId =yyy;Password=zzz";

mySqlString.Append("SELECT * FROM LIBRARY.TABLE");
conexion.Open();

iDB2Command command = new iDB2Command(mySqlString.ToString());

command.CommandTimeout = 0;
command.Connection = conexion;

iDB2DataAdapter SqlDa = new iDB2DataAdapter(command);

DataSet DS = new DataSet();
SqlDa.Fill(DS);

The question is: when I run de create linked server wizard it ask me for some info, and I don’t know what to put where.

@srvproduct = ?
@datasrc = ?
@provstr = ?
@catalog = ?



Quote:
Originally Posted by dhay1999 View Post
Setting up AS400 linked server:

If you plan to update the AS400 Journaling must be turned on

Create a System ODBC connection, use an AS400 login whose password doe not expire preferably. Using the Client Access ODBC driver.

in enterprise manager under security/linked servers

Right click and ADD

Specify a name for your AS400, I call mine simply AS400

select MS OLEDB for ODBC driver

IN data source specify the System Datasource set up previously

click the provider option button, check all but level zero

click the security tab and put in the AS400 user and password you want to use

under server option check all but collation compatible.

I'm not quite sure what all that does but it took me 3 months to figure it out.

David





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter11 page 400 asplundo BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 February 18th, 2008 09:29 AM
What Is Error 400? RollingWoodFarm Excel VBA 3 January 2nd, 2007 03:07 PM
New solution to connect AS/400 from VB6 viethan505 SQL Server 2000 0 August 22nd, 2006 04:25 AM
error 400 davidspeare Beginning VB 6 1 October 1st, 2005 02:40 PM
XML & AS/400 jmariani XML 1 November 7th, 2003 04:01 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.