Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sat Jul 21, 2018 2:12 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: ODBC Database Connection
PostPosted: Tue Feb 12, 2013 10:42 am 
Offline

Joined: Wed Aug 15, 2012 1:49 am
Posts: 7
Hi,

I am new to Real Studio and hope someone can help me.

I want my application to check whether the database server connection is available before I start any other processing.

The database I am connecting to is on an Informix IDS 11.5 server and I'm using the Informix ODBC driver on windows.

oDB = New ODBCDatabase
oDB.DataSource = rs.IdxField(3).value
oDB.UserName = rs.IdxField(5).value
oDB.Password = rs.IdxField(6).value
oDB.Timeout = 3


if oDB.Connect = False then
MsgBox "Failed to connect to " + rs.IdxField(1).value + EndOfLine + oDB.ErrorMessage
CurrentOpenConnection = 0
oDB = nil
return false
end if


The above code only shows the msgbox about the failure after I have pressed cancel on an ODBC settings window.

Does anyone know if it is possible to stop the ODBC settings window coming up if a connection can not be made by the connect command?

_________________
Regards

Andy


Top
 Profile  
Reply with quote  
 Post subject: Re: ODBC Database Connection
PostPosted: Thu Feb 14, 2013 4:22 am 
Offline

Joined: Sat Jul 16, 2011 7:15 pm
Posts: 7
Did you check the value or contents of rs.IdxField(3).value to see if is correct?


Top
 Profile  
Reply with quote  
 Post subject: Re: ODBC Database Connection
PostPosted: Thu Feb 14, 2013 3:32 pm 
Offline

Joined: Wed Aug 15, 2012 1:49 am
Posts: 7
Hi,

I should have also said that I only noticed this behaviour when I was doing some testing and had taken the database offline. When it is online then the connection works as expected.

_________________
Regards

Andy


Top
 Profile  
Reply with quote  
 Post subject: Re: ODBC Database Connection
PostPosted: Wed Mar 20, 2013 12:15 pm 
Offline

Joined: Wed Aug 15, 2012 1:49 am
Posts: 7
Hi,

192 views and no one has an answer. :(

Surely I can't be the only one who has encountered this problem.

Any of the RealStudio team have any ideas?

_________________
Regards

Andy


Top
 Profile  
Reply with quote  
 Post subject: Re: ODBC Database Connection
PostPosted: Thu Mar 21, 2013 9:11 am 
Offline

Joined: Tue Jan 26, 2010 12:54 pm
Posts: 29
Where are you getting your recordset values from? Another database?


Top
 Profile  
Reply with quote  
 Post subject: Re: ODBC Database Connection
PostPosted: Thu Mar 21, 2013 9:18 am 
Offline

Joined: Wed Aug 15, 2012 1:49 am
Posts: 7
Hi,

Yes that is correct. I have a configuration database that holds the connection details.

The issue only arises when the database or database server is not available at the time the connection is made. There is a delay of a few seconds and then the odbc manager window appears. If I then press cancel my message box saying the connection failed appears.

I just don't know whether it is Realbasic's connect method or something specific with the Informix odbc driver.

_________________
Regards

Andy


Top
 Profile  
Reply with quote  
 Post subject: Re: ODBC Database Connection
PostPosted: Thu Mar 21, 2013 10:15 am 
Offline

Joined: Tue Jan 26, 2010 12:54 pm
Posts: 29
Could you perhaps ping the server before trying to connect?

I know using ODBC and the MSSQLServerDatabase plugin with MSSQL databases I don't get that connection window if my server goes offline or is for whatever reason unavailable. I'm going to guess it is in the Informix ODBC.


Top
 Profile  
Reply with quote  
 Post subject: Re: ODBC Database Connection
PostPosted: Thu Mar 21, 2013 10:31 am 
Offline

Joined: Wed Aug 15, 2012 1:49 am
Posts: 7
Hi,

I did think of that one a while back but in most cases the server will be up and running but the database server instance may not.

I guess for now I will just have to live with it.

Thanks for the help jdorsey.

_________________
Regards

Andy


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 5 hours


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

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group