Go Back   Rhinocerus > Newsgroup > Newsgroup comp.lang.* 1 > Newsgroup comp.lang.xharbour

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 04-01-2008, 12:57 PM
Gerard
Guest
 
Posts: n/a
Default Connecting to a MS SQL server.

Hi,

Recently I've started converting our xharbour applications so that they will
use a MS SQL database rather than dbf's. On my laptop everything works fine
so far, I use the Microsoft SQL server management studio express (2005).
Setting up an ODBC connection was relatively easy.

However, if I try to connect to our main MS SQL server (SBS 2003) via TCP
IP, I seem to be unable to even set up an ODBC connection. Does anybody have
an example of setting for both client and server side that have to be used
to accomplish this task? Thanks in advance.

Gerard


Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 04-01-2008, 01:59 PM
Massimo Belgrano
Guest
 
Posts: n/a
Default Re: Connecting to a MS SQL server.

On 1 Apr, 14:57, "Gerard" <codg...@yahoo.com> wrote:
> Hi,
>
> Recently I've started converting our xharbour applications so that they will
> use a MS SQL database rather than dbf's. On my laptop everything works fine
> so far, I use the Microsoft SQL server management studio express (2005).
> Setting up an ODBC connection was relatively easy.
>
> However, if I try to connect to our main MS SQL server (SBS 2003) via TCP
> IP, I seem to be unable to even set up an ODBC connection. Does anybody have
> an example of setting for both client and server side that have to be used
> to accomplish this task? Thanks in advance.
>
> Gerard

Are you using sqlrdd?
either Mediator and sqlrdd have a good product for convert an existing
application
sqlrdd is royaltyfree but require a subscription for update the
product
Imo sqlrdd is more good product because non require a server compoment
(
require your app linked with slrdd and your database server(mssql)
mediator require mediator server


either will run with an -ASP .NET WEB but must uderstand the layer of
emulation of sqlrdd/mediator
for example you need a recno() in clipper application and it must be
made on server side but you must understand how if you wand add valid
record
i suggest you convert one application with this product
http://www.xharbour.com/index.asp?pa...addon_sqlrdd_1
http://www.otc.pl/download/default.aspx?l=2
basically with sqlrdd i have add in top of my source
#ifdef __SQLRDD__
#include "sqlrdd.ch"
#include "dbinfo.ch"
RddSetDefault("SQLRDD" )
G_RDDACT := "SQLRDD"
G_RDDACT2:="DBFCDX"
cConnString=MEMOREAD("SQL.DB")
nCnn := SR_AddConnection( 1, cConnString )
If nCnn < 0
? "Connection error. See SQL1.LOG for details."
QUIT
ENDIF
? "Connected to :", SR_GetConnectionInfo(,17 ),
SR_GetConnectionInfo(, 18 )
#ENDIF

sql.db is where is myexe and containt for sql2005 express
Driver={SQL Server};Network Library=dbmssocn;server=MYSRV
\SQLEXPRESS;database=test;uid=sa;pwd=Mypwd;
Reply With Quote
  #3 (permalink)  
Old 04-01-2008, 02:55 PM
Gerard
Guest
 
Posts: n/a
Default Re: Connecting to a MS SQL server.

Hi Massimo,

Thanks. My problem is not so much connecting to a MS SQL server from
xharbour, cause that works fine with a local server.

I just have trouble setting up an ODBC connection with a remote server. I
really have no clue what I'm doing wrong, and I wondered if there was
anybody that could provide me with an example. Thanks again.

Gerard
"Massimo Belgrano" <massimo.belgrano@gmail.com> schreef in bericht
news:c15564ad-63cf-4d60-a3fa-2d9c0db0be9a@y24g2000hsd.googlegroups.com...
> On 1 Apr, 14:57, "Gerard" <codg...@yahoo.com> wrote:
>> Hi,
>>
>> Recently I've started converting our xharbour applications so that they
>> will
>> use a MS SQL database rather than dbf's. On my laptop everything works
>> fine
>> so far, I use the Microsoft SQL server management studio express (2005).
>> Setting up an ODBC connection was relatively easy.
>>
>> However, if I try to connect to our main MS SQL server (SBS 2003) via TCP
>> IP, I seem to be unable to even set up an ODBC connection. Does anybody
>> have
>> an example of setting for both client and server side that have to be
>> used
>> to accomplish this task? Thanks in advance.
>>
>> Gerard

> Are you using sqlrdd?
> either Mediator and sqlrdd have a good product for convert an existing
> application
> sqlrdd is royaltyfree but require a subscription for update the
> product
> Imo sqlrdd is more good product because non require a server compoment
> (
> require your app linked with slrdd and your database server(mssql)
> mediator require mediator server
>
>
> either will run with an -ASP .NET WEB but must uderstand the layer of
> emulation of sqlrdd/mediator
> for example you need a recno() in clipper application and it must be
> made on server side but you must understand how if you wand add valid
> record
> i suggest you convert one application with this product
> http://www.xharbour.com/index.asp?pa...addon_sqlrdd_1
> http://www.otc.pl/download/default.aspx?l=2
> basically with sqlrdd i have add in top of my source
> #ifdef __SQLRDD__
> #include "sqlrdd.ch"
> #include "dbinfo.ch"
> RddSetDefault("SQLRDD" )
> G_RDDACT := "SQLRDD"
> G_RDDACT2:="DBFCDX"
> cConnString=MEMOREAD("SQL.DB")
> nCnn := SR_AddConnection( 1, cConnString )
> If nCnn < 0
> ? "Connection error. See SQL1.LOG for details."
> QUIT
> ENDIF
> ? "Connected to :", SR_GetConnectionInfo(,17 ),
> SR_GetConnectionInfo(, 18 )
> #ENDIF
>
> sql.db is where is myexe and containt for sql2005 express
> Driver={SQL Server};Network Library=dbmssocn;server=MYSRV
> \SQLEXPRESS;database=test;uid=sa;pwd=Mypwd;



Reply With Quote
  #4 (permalink)  
Old 04-01-2008, 05:13 PM
Massimo Belgrano
Guest
 
Posts: n/a
Default Re: Connecting to a MS SQL server.

On 1 Apr, 16:55, "Gerard" <codg...@yahoo.com> wrote:
> Hi Massimo,
>
> Thanks. My problem is not so much connecting to a MS SQL server from
> xharbour, cause that works fine with a local server.
>
> I just have trouble setting up an ODBC connection with a remote server. I
> really have no clue what I'm doing wrong, and I wondered if there was
> anybody that could provide me with an example. Thanks again.
>
> Gerard
> "Massimo Belgrano" <massimo.belgr...@gmail.com> schreef in berichtnews:c15564ad-63cf-4d60-a3fa-2d9c0db0be9a@y24g2000hsd.googlegroups.com...
>
>
>
> > On 1 Apr, 14:57, "Gerard" <codg...@yahoo.com> wrote:
> >> Hi,

>
> >> Recently I've started converting our xharbour applications so that they
> >> will
> >> use a MS SQL database rather than dbf's. On my laptop everything works
> >> fine
> >> so far, I use the Microsoft SQL server management studio express (2005)..
> >> Setting up an ODBC connection was relatively easy.

>
> >> However, if I try to connect to our main MS SQL server (SBS 2003) via TCP
> >> IP, I seem to be unable to even set up an ODBC connection. Does anybody
> >> have
> >> an example of setting for both client and server side that have to be
> >> used
> >> to accomplish this task? Thanks in advance.

>
> >> Gerard

> > Are you using sqlrdd?
> > either Mediator and sqlrdd have a good product for convert an existing
> > application
> > sqlrdd is royaltyfree but require a subscription for update the
> > product
> > Imo sqlrdd is more good product because non require a server compoment
> > (
> > require your app linked with slrdd and your database server(mssql)
> > mediator require mediator server

>
> > either will run with an -ASP .NET WEB but must uderstand the layer of
> > emulation of sqlrdd/mediator
> > for example you need a recno() in clipper application and it must be
> > made on server side but you must understand how if you wand add valid
> > record
> > i suggest you convert one application with this product
> >http://www.xharbour.com/index.asp?pa...addon_sqlrdd_1
> >http://www.otc.pl/download/default.aspx?l=2
> > basically with sqlrdd i have add in top of my source
> > * *#ifdef __SQLRDD__
> > * * *#include "sqlrdd.ch"
> > * * *#include "dbinfo.ch"
> > * * *RddSetDefault("SQLRDD" )
> > * * *G_RDDACT := "SQLRDD"
> > * * *G_RDDACT2:="DBFCDX"
> > * * *cConnString=MEMOREAD("SQL.DB")
> > * * *nCnn := SR_AddConnection( 1, cConnString )
> > * * *If nCnn < 0
> > * * * * *? "Connection error. See SQL1.LOG for details."
> > * * * * *QUIT
> > * * * ENDIF
> > * * * *? "Connected to * * * *:", SR_GetConnectionInfo(,17 ),
> > SR_GetConnectionInfo(, 18 )
> > * *#ENDIF

>
> > sql.db is where is myexe and containt for sql2005 express
> > Driver={SQL Server};Network Library=dbmssocn;server=MYSRV
> > \SQLEXPRESS;database=test;uid=sa;pwd=Mypwd;- Nascondi testo tra virgolette -

>
> - Mostra testo tra virgolette -


Please post an example of your code so i better understand
Can help a connection string?
Driver={SQL Server};Network
Library=dbmssocn;server=192.168.0.1\SQLEXPRESS;dat abase=test;uid=sa;pwd=Mypwd;-
Nascondi testo tra virgolette -
http://www.connectionstrings.com/?carrier=sqlserver2005
Reply With Quote
  #5 (permalink)  
Old 04-01-2008, 05:29 PM
Massimo Belgrano
Guest
 
Posts: n/a
Default Re: Connecting to a MS SQL server.

> I just have trouble setting up an ODBC connection with a remote server. I
> really have no clue what I'm doing wrong, and I wondered if there was
> anybody that could provide me with an example. Thanks again.


http://www.depts.ttu.edu/helpcentral.../ODBCSetup.php
Reply With Quote
  #6 (permalink)  
Old 04-01-2008, 11:34 PM
Rick Lipkin
Guest
 
Posts: n/a
Default Re: Connecting to a MS SQL server.

My My ... ODBC, no way ... you can use ADO without any ODBC or client
configuration. xHarbour has OLE cability built in .. use the associated
syntax to connect to your MS Sql database.

Rick Lipkin


xPROVIDER := "SQLOLEDB"
xSOURCE := "MSSQL01"
xCATALOG := "PCAS"
xUSERID := "pcasuser"
xPASSWORD := "pcas"


oRs := TOleAuto():New( "ADODB.Recordset" )
oRs:CursorType := 1 // opendkeyset
oRs:CursorLocation := 3 // local cache
oRs:LockType := 3 // lockoportunistic

cSQL := "SELECT * FROM utility WHERE progid ='"+xPROGID+"'"
TRY
oRS:Open(cSQL,'Provider='+xPROVIDER+';Data Source='+xSOURCE+';Initial
Catalog='+xCATALOG+';User Id='+xUSERID+';Password='+xPASSWORD )
CATCH oErr
RETURN( NIL)
END TRY

IF oRs:eof
SAYING := "SORRY .. Could not find PROGID "+xPROGID+" associated with
this location"
MsgInfo( SAYING )
oRs:Close()
RETURN(NIL)
ENDIF



"Gerard" <codgy63@yahoo.com> wrote in message news:fsthqr$1o1$1@aioe.org...
> Hi Massimo,
>
> Thanks. My problem is not so much connecting to a MS SQL server from
> xharbour, cause that works fine with a local server.
>
> I just have trouble setting up an ODBC connection with a remote server. I
> really have no clue what I'm doing wrong, and I wondered if there was
> anybody that could provide me with an example. Thanks again.
>
> Gerard
> "Massimo Belgrano" <massimo.belgrano@gmail.com> schreef in bericht
> news:c15564ad-63cf-4d60-a3fa-2d9c0db0be9a@y24g2000hsd.googlegroups.com...
>> On 1 Apr, 14:57, "Gerard" <codg...@yahoo.com> wrote:
>>> Hi,
>>>
>>> Recently I've started converting our xharbour applications so that they
>>> will
>>> use a MS SQL database rather than dbf's. On my laptop everything works
>>> fine
>>> so far, I use the Microsoft SQL server management studio express (2005).
>>> Setting up an ODBC connection was relatively easy.
>>>
>>> However, if I try to connect to our main MS SQL server (SBS 2003) via
>>> TCP
>>> IP, I seem to be unable to even set up an ODBC connection. Does anybody
>>> have
>>> an example of setting for both client and server side that have to be
>>> used
>>> to accomplish this task? Thanks in advance.
>>>
>>> Gerard

>> Are you using sqlrdd?
>> either Mediator and sqlrdd have a good product for convert an existing
>> application
>> sqlrdd is royaltyfree but require a subscription for update the
>> product
>> Imo sqlrdd is more good product because non require a server compoment
>> (
>> require your app linked with slrdd and your database server(mssql)
>> mediator require mediator server
>>
>>
>> either will run with an -ASP .NET WEB but must uderstand the layer of
>> emulation of sqlrdd/mediator
>> for example you need a recno() in clipper application and it must be
>> made on server side but you must understand how if you wand add valid
>> record
>> i suggest you convert one application with this product
>> http://www.xharbour.com/index.asp?pa...addon_sqlrdd_1
>> http://www.otc.pl/download/default.aspx?l=2
>> basically with sqlrdd i have add in top of my source
>> #ifdef __SQLRDD__
>> #include "sqlrdd.ch"
>> #include "dbinfo.ch"
>> RddSetDefault("SQLRDD" )
>> G_RDDACT := "SQLRDD"
>> G_RDDACT2:="DBFCDX"
>> cConnString=MEMOREAD("SQL.DB")
>> nCnn := SR_AddConnection( 1, cConnString )
>> If nCnn < 0
>> ? "Connection error. See SQL1.LOG for details."
>> QUIT
>> ENDIF
>> ? "Connected to :", SR_GetConnectionInfo(,17 ),
>> SR_GetConnectionInfo(, 18 )
>> #ENDIF
>>
>> sql.db is where is myexe and containt for sql2005 express
>> Driver={SQL Server};Network Library=dbmssocn;server=MYSRV
>> \SQLEXPRESS;database=test;uid=sa;pwd=Mypwd;

>
>



Reply With Quote
  #7 (permalink)  
Old 04-02-2008, 11:13 AM
Gerard
Guest
 
Posts: n/a
Default Re: Connecting to a MS SQL server.

Thanks Rick,

I tried to use ODBC because that was used in the manuals we got when we
bought xBuilder.

I'll try ADO. Maybe a stupid question, but in the example you provided,
where do you define which SQL database to use? And in case it's a remote
database, do you have to do anything extra to access it? (settings, etc.)

Gerard
"Rick Lipkin" <lipkinrm29063@yahoo.com> schreef in bericht
news:47f2c869$0$1341$834e42db@reader.greatnowhere. com...
> My My ... ODBC, no way ... you can use ADO without any ODBC or client
> configuration. xHarbour has OLE cability built in .. use the associated
> syntax to connect to your MS Sql database.
>
> Rick Lipkin
>
>
> xPROVIDER := "SQLOLEDB"
> xSOURCE := "MSSQL01"
> xCATALOG := "PCAS"
> xUSERID := "pcasuser"
> xPASSWORD := "pcas"
>
>
> oRs := TOleAuto():New( "ADODB.Recordset" )
> oRs:CursorType := 1 // opendkeyset
> oRs:CursorLocation := 3 // local cache
> oRs:LockType := 3 // lockoportunistic
>
> cSQL := "SELECT * FROM utility WHERE progid ='"+xPROGID+"'"
> TRY
> oRS:Open(cSQL,'Provider='+xPROVIDER+';Data Source='+xSOURCE+';Initial
> Catalog='+xCATALOG+';User Id='+xUSERID+';Password='+xPASSWORD )
> CATCH oErr
> RETURN( NIL)
> END TRY
>
> IF oRs:eof
> SAYING := "SORRY .. Could not find PROGID "+xPROGID+" associated with
> this location"
> MsgInfo( SAYING )
> oRs:Close()
> RETURN(NIL)
> ENDIF
>
>
>
> "Gerard" <codgy63@yahoo.com> wrote in message
> news:fsthqr$1o1$1@aioe.org...
>> Hi Massimo,
>>
>> Thanks. My problem is not so much connecting to a MS SQL server from
>> xharbour, cause that works fine with a local server.
>>
>> I just have trouble setting up an ODBC connection with a remote server. I
>> really have no clue what I'm doing wrong, and I wondered if there was
>> anybody that could provide me with an example. Thanks again.
>>
>> Gerard
>> "Massimo Belgrano" <massimo.belgrano@gmail.com> schreef in bericht
>> news:c15564ad-63cf-4d60-a3fa-2d9c0db0be9a@y24g2000hsd.googlegroups.com...
>>> On 1 Apr, 14:57, "Gerard" <codg...@yahoo.com> wrote:
>>>> Hi,
>>>>
>>>> Recently I've started converting our xharbour applications so that they
>>>> will
>>>> use a MS SQL database rather than dbf's. On my laptop everything works
>>>> fine
>>>> so far, I use the Microsoft SQL server management studio express
>>>> (2005).
>>>> Setting up an ODBC connection was relatively easy.
>>>>
>>>> However, if I try to connect to our main MS SQL server (SBS 2003) via
>>>> TCP
>>>> IP, I seem to be unable to even set up an ODBC connection. Does anybody
>>>> have
>>>> an example of setting for both client and server side that have to be
>>>> used
>>>> to accomplish this task? Thanks in advance.
>>>>
>>>> Gerard
>>> Are you using sqlrdd?
>>> either Mediator and sqlrdd have a good product for convert an existing
>>> application
>>> sqlrdd is royaltyfree but require a subscription for update the
>>> product
>>> Imo sqlrdd is more good product because non require a server compoment
>>> (
>>> require your app linked with slrdd and your database server(mssql)
>>> mediator require mediator server
>>>
>>>
>>> either will run with an -ASP .NET WEB but must uderstand the layer of
>>> emulation of sqlrdd/mediator
>>> for example you need a recno() in clipper application and it must be
>>> made on server side but you must understand how if you wand add valid
>>> record
>>> i suggest you convert one application with this product
>>> http://www.xharbour.com/index.asp?pa...addon_sqlrdd_1
>>> http://www.otc.pl/download/default.aspx?l=2
>>> basically with sqlrdd i have add in top of my source
>>> #ifdef __SQLRDD__
>>> #include "sqlrdd.ch"
>>> #include "dbinfo.ch"
>>> RddSetDefault("SQLRDD" )
>>> G_RDDACT := "SQLRDD"
>>> G_RDDACT2:="DBFCDX"
>>> cConnString=MEMOREAD("SQL.DB")
>>> nCnn := SR_AddConnection( 1, cConnString )
>>> If nCnn < 0
>>> ? "Connection error. See SQL1.LOG for details."
>>> QUIT
>>> ENDIF
>>> ? "Connected to :", SR_GetConnectionInfo(,17 ),
>>> SR_GetConnectionInfo(, 18 )
>>> #ENDIF
>>>
>>> sql.db is where is myexe and containt for sql2005 express
>>> Driver={SQL Server};Network Library=dbmssocn;server=MYSRV
>>> \SQLEXPRESS;database=test;uid=sa;pwd=Mypwd;

>>
>>

>
>



Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: SAS OLAP Cubes creation on SQL Server Database Alan Churchill Newsgroup comp.soft-sys.sas 0 05-16-2006 12:16 PM
Re: loading sas dates into sql server Michael Raithel Newsgroup comp.soft-sys.sas 0 12-29-2005 01:50 PM
Re: SAS 9.1.3 on AIX and ACCESS to SQL Server Nigel Pain Newsgroup comp.soft-sys.sas 0 05-13-2005 04:33 PM
updating SQL server data using Proc SQL via ODBC ekwan@sfcc-cpmc.net Newsgroup comp.soft-sys.sas 0 02-28-2005 10:56 PM
Re: Update data to Ms sql server by sas code Sigurd Hermansen Newsgroup comp.soft-sys.sas 0 12-14-2004 02:16 PM



All times are GMT. The time now is 05:13 AM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.