forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Fortran F95 and SQL Server

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
Anonymous
Guest





PostPosted: Tue May 16, 2006 2:26 pm    Post subject: Fortran F95 and SQL Server Reply with quote

Can Fortran F95 interact with a database in SQL Server? Can I add, delete or modify a record on a database in SQL Server?

If yes, how can this be done?

Thank you.

Daniel Chan
Back to top
Andrew



Joined: 09 Sep 2004
Posts: 232
Location: Frankfurt, Germany

PostPosted: Tue May 16, 2006 4:05 pm    Post subject: Fortran F95 and SQL Server Reply with quote

FTN95 can be used in .NET mode to consume the .NET runtime that has access to database functionality. The ADO .NET classes will provide a good start for what you want to do. I also believe there are other third party products available that you could use with an FTN95 Win32 application to access databases.
Back to top
View user's profile Send private message
sparge



Joined: 11 Apr 2005
Posts: 371

PostPosted: Tue May 16, 2006 7:43 pm    Post subject: Fortran F95 and SQL Server Reply with quote

Canaima's F90SQL is one such - I have used it, although not extensively. It did what I needed it to do, which was the same as what you want. Andy
Back to top
View user's profile Send private message Send e-mail
Anonymous
Guest





PostPosted: Wed May 17, 2006 6:28 am    Post subject: Fortran F95 and SQL Server Reply with quote

Hi Mr. Smith,

I do not have Visual Studio on my machine. Will ADO .NET requires Visual Studio to work?

Do you have a simple FTN95 program that demonstate how to do a "Select *" from a Table in a database?

Thank you.

Daniel Chan
Back to top
Andrew



Joined: 09 Sep 2004
Posts: 232
Location: Frankfurt, Germany

PostPosted: Wed May 17, 2006 12:24 pm    Post subject: Fortran F95 and SQL Server Reply with quote

You can program using .NET using just the SDK (make sure to get the 1.1 SDK not 2.0 just yet). Plato will also let you build .NET assemblies. I am afraid I do not have any sample code for this, but you will need to look into the help system under 'Calling .NET languages from FTN95' and make use of the ADO .NET code to access a database. I would imagine once connected it would be a simple matter of passing a SQL query.
Back to top
View user's profile Send private message
Anonymous
Guest





PostPosted: Fri May 19, 2006 7:52 am    Post subject: Fortran F95 and SQL Server Reply with quote

Hi Andrew,

I tried to compile .NET example (MessageBox).
I tried the Builddbg.bat and Buildrel.bat. Both failed to run.

The error was on 'library "System.Windows.Forms.dll", The FTN95AUX file did not come with this release of FTN95

But, I found Ftn95Aux.exe at the directory where Salford F95 is put.

What is the correct syntax to compile this file?

Thank you.



Daniel Chan
Back to top
Andrew



Joined: 09 Sep 2004
Posts: 232
Location: Frankfurt, Germany

PostPosted: Fri May 19, 2006 8:00 am    Post subject: Fortran F95 and SQL Server Reply with quote

Have you got version 1.1 of the .NET framework installed? The SDK can be downloaded from:

http://www.microsoft.com/downloads/details.aspx?FamilyId=9B3A2CA6-3647-4070-9F41-A333C6B9181D&displaylang=en

and the runtime from:

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=262D25E3-F589-4842-8157-034D1E7CF3A3

You are probably better using the SDK if you can spare the bandwidth. You should ensure that the .NET directory is on the path, for 1.1 this defaults to:

C:WINDOWSMicrosoft.NETFrameworkv1.1.4322

Can you make sure that all of this is installed and ensure you have installed the .NET components of FTN95 when installing and see how you get.

Back to top
View user's profile Send private message
Anonymous
Guest





PostPosted: Fri May 19, 2006 9:03 am    Post subject: Fortran F95 and SQL Server Reply with quote

Hi Andrew,

In your previous message, you explicitly said that I should use .NET 1.1. My machine had it, but has upgraded to .NET 2.0 So, I guess I need to go back to .NET 1.1, right?

Will the builddbg.bat or buildrel.bat work after that?

Thank you.



Daniel Chan
Back to top
Anonymous
Guest





PostPosted: Fri May 19, 2006 9:48 am    Post subject: Fortran F95 and SQL Server Reply with quote

Hi,

I found "System.Windows.Forms.dll" in my .NET v2.0 and V1.0 directory. I copy either file to ftn95 directory.
Then, I compile using ftn95 messagebox.f95 /clr /library e:ftn95

The error on "System.Windows.Form.dll" went away.

However, ftn95 still complains about:
"***The FTN95AUX file did not come with this release of FTN95"

Any idea?

Thank you.



Daniel Chan
Back to top
Andrew



Joined: 09 Sep 2004
Posts: 232
Location: Frankfurt, Germany

PostPosted: Fri May 19, 2006 12:03 pm    Post subject: Fortran F95 and SQL Server Reply with quote

What version of FTN95 are you using? FTN95AUX no longer ships with the compiler - you should get the latest version from the Silverfrost website at:

http://www.silverfrost.com/32/ftn95/ftn95_personal_edition.asp
Back to top
View user's profile Send private message
Anonymous
Guest





PostPosted: Fri May 19, 2006 1:02 pm    Post subject: Fortran F95 and SQL Server Reply with quote

Hi Andrew,

I was using FTN95 Ver 4.0

I downloaded and installed FTN95 ver 4.9

I have .NET framework V1.0, V1.1 and V2.0 on the machine. They are in c:windowsmicrosoft.netframeworkvxxxxxx

I went to /demo/net/messagebox to run buildrel.bat

Then, an error came up,
"The procedure entry point GetRequestedRuntimeInfo could not be located in the dynamic link library mscoree.dll."
And then,
"C:WINNTMicrosoft.NETFrameworkV2.0.50727mscorwks.dll could not be loaded"

Any idea?

Thank you.

Daniel Chan

Back to top
Andrew



Joined: 09 Sep 2004
Posts: 232
Location: Frankfurt, Germany

PostPosted: Mon May 22, 2006 4:10 am    Post subject: Fortran F95 and SQL Server Reply with quote

I think the only problem now is likely to be your PATH setup - could you please confirm you have the 1.1 directory on the path and not 2.0.
Back to top
View user's profile Send private message
qt



Joined: 23 Aug 2005
Posts: 46
Location: Berlin, Germany

PostPosted: Mon May 29, 2006 2:44 pm    Post subject: Fortran F95 and SQL Server Reply with quote

Here is an example for a SELECT. The program is based on an ODBC
interface named FORDBC which can be purchased from my company.
However you can create the interface to ODBC yourself or use f90SQL
from Canaima which is very similar.
I just saw that ISS Ltd is offering an ODBC interface too.
This is included in their WINTERACTER v7.1.

Joerg Kuthe
www.qtsoftware.de

Code:
! FTN95 compile & link:
! ---------------------
! ftn95 T_ODBCAccessRd.f90 /mod_path M:
! Notice: The directory "M:" is the path spec. where modules can be found.
! slink commands:
! lo t_odbcaccessrd
! lo c:windowssystemodbc32.dll
! file
! Notice: ODBC32.dll can be found in the windows system directory, for example "c:windowssystemodbc32.dll"



MODULE EDSR
USE qt_ODBC
! old INTEGER (KIND=RETCODE) :: rtc
! old INTEGER (KIND=HENV) :: env = SQL_NULL_HENV
! old INTEGER (KIND=HDBC) :: dbc = SQL_NULL_HDBC
! old INTEGER (KIND=HSTMT) :: stmt = SQL_NULL_HSTMT
INTEGER (SQLRETURN) :: rtc
INTEGER (SQLHENV) :: env = SQL_NULL_HENV
INTEGER (SQLHDBC) :: dbc = SQL_NULL_HDBC
INTEGER (SQLHSTMT) :: stmt = SQL_NULL_HSTMT
END MODULE EDSR

PROGRAM T_ODBCAccessRd
! reads columns from datasource "ODBCTestAccess"
USE EDSR
USE qt_ODBC_Compiler ! FTN95: in qt_ODBC_FTN.f90; LF90: in qt_ODBC_LF90.f90: MSF Powerst.4.0: in qt_ODBC_MsF.f90

IMPLICIT NONE

INTEGER*2 Id
INTEGER*4 I4
DOUBLE PRECISION DP
CHARACTER (LEN=30) :: Str = ' '
! old INTEGER (KIND=SDWORD) :: LENStr = 30
! old INTEGER (KIND=SDWORD) :: cbStr, cbFixed
INTEGER (SQLINTEGER) :: LENStr = 30
INTEGER (SQLINTEGER) :: cbStr, cbFixedId, cbFixedI4, cbFixedDP

INTEGER, PARAMETER :: I2Missing = -9999
INTEGER, PARAMETER :: I4Missing = -99999999
DOUBLE PRECISION, PARAMETER :: DPMissing = -0.999999999999D99
CHARACTER (LEN=*), PARAMETER :: StrMissing = 'missing value'
INTEGER :: icol ! changing type into I4 helps

! establish environment, connection ...
rtc = SQLAllocEnv( env )
CALL CheckSQLReturnCode (*999)
PRINT*,'Environment Handle =', env

rtc = SQLAllocConnect ( env, dbc )
CALL CheckSQLReturnCode (*998)
PRINT*,'Connection Handle =', dbc

rtc = SQLConnect( dbc, "ODBCTestAccess"//CHAR(0), SQL_NTS, &
CHAR(0), SQL_NTS, CHAR(0), SQL_NTS ) ! note: strings are zero terminated ("//CHAR(0) appended")

CALL CheckSQLReturnCode (*997)
PRINT*,'Connect successful'

! old rtc = SQLSetConnectOption ( dbc, SQL_AUTOCOMMIT, FALSE)
rtc = SQLSetConnectOption ( dbc, SQL_ATTR_AUTOCOMMIT, FALSE)
CALL CheckSQLReturnCode (*997)
PRINT*,'Connect option set'

! set up SQL statement
rtc = SQLAllocStmt (dbc, stmt)
CALL CheckSQLReturnCode (*996)
PRINT*,'Memory for statement allocated'

rtc = SQLExecDirect ( stmt, &
"SELECT id, i4, dp, str FROM Tabelle1"//CHAR(0), SQL_NTSL )
CALL CheckSQLReturnCode (*995)
PRINT*,'SELECT Statement successfully executed'

! bind result columns
icol = 1
rtc = SQLBindColI2 (stmt, icol, SQL_C_SSHORT, Id, 0, cbFixedId )
CALL CheckSQLReturnCode (*995)

icol = 2
rtc = SQLBindColI4 (stmt, icol, SQL_C_SLONG, I4, 0, cbFixedI4 )
CALL CheckSQLReturnCode (*995)

icol = 3
rtc = SQLBindColDP (stmt, icol, SQL_C_DOUBLE, DP, 0, cbFixedDP )
CALL CheckSQLReturnCode (*995)

icol = 4
rtc = SQLBindColChar (stmt, icol, SQL_C_CHAR, Str, LENStr, cbStr )
CALL CheckSQLReturnCode (*995)

PRINT*,'Bind successfull'

PRINT*,'SQL Fetch:'
PRINT*,' Id I4 DP Str cbStr'
! 123456789 1
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group