Dear guest !

Welcome to Team Developer Community Forum. A place created by the community, for the community !

This is a resource for Q & A and discussion about everything related to OpenText Gupta Team Developer, SqlBase, TD Mobile and Report Builder.
It is the alternative for the OpenText customer forums which can only be accessed with an active support contract.

Please register your account now. It will make you part of the active community.
Also, this guest message will not be displayed for registered users.

As a bonus, registered users have access to the 'Newsgroups' subforum, holding 10 years worth of posts from the good old Gupta newsgroups.

Having an account gives you the opportunity to ask questions and get help from others.
We hope this free gathering will help you and the community getting forward!

Best regards,
The forum site admins.

TD 2.1 connects to SQL Server 2008 R2 64-bit

General discussion forum about all things older Team Developer versions.
Also version independent Q&A can be placed here.
Post Reply
cheanming
Malaysia
Posts: 2
Joined: 14 May 2017, 03:39
Location: KL

TD 2.1 connects to SQL Server 2008 R2 64-bit

Post by cheanming » 14 May 2017, 05:42

Hi All,

I'm new to Oledb connection to SQL Server 2008 R2 64-bit or sQL Server Express 2016 for that matter. I've got some coding from a friend and it says

Set SqlDatabase = STRING_Null
Set SqlUser =STRING_Null
Set SqlPassword = STRING_Null
Set SqlResultSet = TRUE
Set SqlIsolationLevel = 'RL'
Set sConnectionString = 'Provider=SQLOLEDB;Data Source=ASUS\\SQLEXPRESS;Initial Catalog=master;User ID=sa;Password=abc123;Persist Security Info=True;'
If SqlCreateSession( hSession, sConnectionString ) = TRUE
Call SalMessageBox( 'Connection successful','', MB_Ok)
Else
Call SalMessageBox( 'Connection fail','', MB_Ok)
Call SqlSetSessionParameter( hSession, DBP_AUTOCOMMIT, FALSE, '' )
Call SqlCreateStatement( hSession, hSqlServer )
Call SqlConnect( hSqlServer )

There's error when running this program. I've also checked the TD compatible matrix and it says TD2.1 can only connect to SQL Server 7 & 8. So I suspect the coding above does not wok for TD2.1

Does anybody have any coding in TD2.1 that connects to SQL Server 2008 R2 64bit or SQL server express 2016 64 bit, without having to edit the sql.ini file? Your help in this matter is highly appreciated.

Regards,
Chris

Jeff Luther
Site Admin
United States of America
Posts: 79
Joined: 04 Mar 2017, 18:34
Location: Palm Springs, California
Contact:

Re: TD 2.1 connects to SQL Server 2008 R2 64-bit

Post by Jeff Luther » 15 May 2017, 17:03

There's error when running this program.
That's the first thing to know: What's the error (number and description)?

Also, did the code you show once work as it is written for an earlier version of the SS DB?
I've also checked the TD compatible matrix and it says TD2.1 can only connect to SQL Server 7 & 8. So I suspect the coding above does not wok for TD2.1
That might be a good guess, though I don't have SQL Server to test with. I might not be surprised because of the 64-bit server, but I am surprised about SS Express 2016 (unless it's 64-bit as well).

I'm going to reformat your code (by pasting, indenting by hand, selecting all the text and clicking the "</>" button above) and make a couple comments:

Code: Select all

Set SqlDatabase = STRING_Null
Set SqlUser =STRING_Null
Set SqlPassword = STRING_Null
Set SqlResultSet = TRUE
Set SqlIsolationLevel = 'RL'
Set sConnectionString = 'Provider=SQLOLEDB;Data Source=ASUS\\SQLEXPRESS;Initial Catalog=master;User ID=sa;Password=abc123;Persist Security Info=True;'
If SqlCreateSession( hSession, sConnectionString ) = TRUE
    Call SalMessageBox( 'Connection successful','', MB_Ok)        ! JL: not a 'connection' as such; the create only defines a section to be used when a connect is done
Else
    Call SalMessageBox( 'SESSION fail','', MB_Ok)
    ! JL should be a Return <> so the code halts if create session fails
    Return FALSE
! JL -- my guess is that the lsat 3 lines are not indented inside the Else above, though... If the create session fails, code should not continue
Call SqlSetSessionParameter( hSession, DBP_AUTOCOMMIT, FALSE, '' )
Call SqlCreateStatement( hSession, hSqlServer )
Call SqlConnect( hSqlServer )
P.S. Gupta/OpenText ships a PDF book whose old name was ccod.PDF with info. about connecting to 'foreign' (i.e., non-SQLBase) DBs. I'll attach a zip of a copy of it from my TD v5.2 'books' folder. For TD v6.3 they expanded the name to its book title: TD Connecting SQLWindows Objects to Databases.pdf, but it's basically the same book
Attachments
ccod.zip
(1.13 MiB) Downloaded 11 times
Jeff Luther @ PC Design
Palm Springs, California
TD info. & samples: http://www.jeffluther.net/TD/

cheanming
Malaysia
Posts: 2
Joined: 14 May 2017, 03:39
Location: KL

Re: TD 2.1 connects to SQL Server 2008 R2 64-bit

Post by cheanming » 16 May 2017, 08:52

Hi Jeff,

Thanks for the reply. First of all, the error displayed is not a TD error. Secondly, I did try the same connection string with TD6.0 trial version and it can connect to the mssql server. So I suspect it's the TD2.1 coding at the SqlCreateSession because when I debug, the program stops there and it says cannot connect with user sa.

I've read through the ccod file and it never says anything about connecting to ms sql using oledb.Furthermore, it's connecting to Ms sql 6.5 & 7. Still cannot get any sample coding showing how to connect to mssql 2008 r2 using td2.1. :-(

Best Regards,
Chris

Jeff Luther
Site Admin
United States of America
Posts: 79
Joined: 04 Mar 2017, 18:34
Location: Palm Springs, California
Contact:

Re: TD 2.1 connects to SQL Server 2008 R2 64-bit

Post by Jeff Luther » 16 May 2017, 16:16

Sorry, so let's see if someone else can help then.
Jeff Luther @ PC Design
Palm Springs, California
TD info. & samples: http://www.jeffluther.net/TD/

Didiman
Germany
Posts: 5
Joined: 21 Mar 2017, 13:05
Location: Bremen, Germany
Contact:

Re: TD 2.1 connects to SQL Server 2008 R2 64-bit

Post by Didiman » 17 May 2017, 06:39

Sorry, but i think, TD 2.1 simply cannot connect to SQL Server >= 2008 R2. And this will be not your only problem. TD 2.1 will not work properly on Windows Versions <= 8. You shouild really think about an Uodate to 6.3 or 7.0.

greetz

--Andreas

Igor Ivanovic
Site Admin
Croatia
Posts: 66
Joined: 05 Mar 2017, 12:37
Location: Zagreb, Croatia

Re: TD 2.1 connects to SQL Server 2008 R2 64-bit

Post by Igor Ivanovic » 17 May 2017, 13:06

Didiman wrote:
17 May 2017, 06:39
Sorry, but i think, TD 2.1 simply cannot connect to SQL Server >= 2008 R2. And this will be not your only problem. TD 2.1 will not work properly on Windows Versions <= 8. You shouild really think about an Uodate to 6.3 or 7.0.

greetz

--Andreas
For SQLServer I cannot say as I am not using it, as for running TD2.1 on never windows versions I must disagree.
I have a large TD2.1 app that is (was) running on every windows version, from ancient win3.1 to win10.
The only problem I ever had was with windows 8, when calling some of the MSWord COM functions.
Igor Ivanovic
Image

ulle
Germany
Posts: 2
Joined: 29 May 2017, 09:25
Location: Germany

Re: TD 2.1 connects to SQL Server 2008 R2 64-bit

Post by ulle » 30 May 2017, 07:02

Hi Chris,

just tried the following code and it works with TD21 against sveral SQLServer 2014 (also express):

Number: nCount
Number: nInd
String: sConn
Sql Handle: hSql
Session Handle: hSession

Set SqlPassword = 'myPassword'
Set sConn = 'Provider=SQLOLEDB;Data Source=myServerName\\myInstanceName;Initial Catalog=myDataBase;User ID=myUsername;'
Call SqlCreateSession( hSession, sConn )
Call SqlSetSessionParameter( hSession, DBP_AUTOCOMMIT, FALSE, '' )
Call SqlCreateStatement( hSession, hSql )
Call SqlPrepareAndExecute( hSql, 'select count(*) into :nCount from table' )
Call SqlFetchNext( hSql, nInd )
Call SqlDisconnect( hSql )
Call SqlFreeSession( hSession )

Call SalMessageBox( 'Count: ' || SalNumberToStrX( nCount, 0 ), '', 0 )

It seems, that you have to use the SqlPassword var instead of the Password constant in the connection string.

Regards
ulle

chrisocm
Malaysia
Posts: 6
Joined: 12 May 2017, 16:07
Location: Kuala Lumpur

Re: TD 2.1 connects to SQL Server 2008 R2 64-bit

Post by chrisocm » 01 Jun 2017, 02:35

Dear Ulle,

Thanks for the sample coding. I tried out but it gives me, "Login failed for user SA".

My connection string is Set sConnectionString = 'Provider=SQLOLEDB;Data Source=ASUS\\SQLEXPRESS;Initial Catalog=master;User ID=sa;Password=abc123;Persist Security Info=True;' but yours is without the Password and Persist Security Info. Is that ok?

When I used Management Studio to connect, It's fine.

Any idea what I did wrong?

Best Regards,
Chris

ulle
Germany
Posts: 2
Joined: 29 May 2017, 09:25
Location: Germany

Re: TD 2.1 connects to SQL Server 2008 R2 64-bit

Post by ulle » 01 Jun 2017, 06:52

Hi Chris,

please try to strip off the Password keyword from the connection string, because that doesn't work here either.
Instead use the TD SqlPassword var:

Set SqlPassword = 'abc123'
'Provider=SQLOLEDB;Data Source=ASUS\\SQLEXPRESS;Initial Catalog=master;User ID=sa;Persist Security Info=True;'

Don't you get any SqlError Dialog?

Regards
ulle

Post Reply

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest