mssql server 2012 express

HMG en Español

Moderator: Rathinagiri

User avatar
jairpinho
Posts: 344
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Has thanked: 3 times
Been thanked: 11 times
Contact:

mssql server 2012 express

Post by jairpinho » Sun Apr 14, 2019 12:08 am

alguien podría proporcionar un ejemplo de conexión mssql express 2012 que funcione con hmg ide. las pruebas se realizaron con el controlador odbc en windows. La prueba fue hecha con todos los ejemplos del foro pero no hace conexión. ¿existe una manera de conectar directamente en el banco sin usar origen de datos odbc de windows?


english
could anyone provide an example of connection mssql express 2012 that works with hmg ide. Tests were done with odbc driver on windows. test were done with all examples of the forum but does not make connection. is there a way to connect directly to the database without using windows odbc data source?
Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br

User avatar
bpd2000
Posts: 1088
Joined: Sat Sep 10, 2011 4:07 am
Location: India
Has thanked: 197 times
Been thanked: 102 times

Post by bpd2000 » Mon Apr 15, 2019 5:18 am

Hi,
Try to connect sql server with utility, if success I will guide you further
Note : [1] Provide IP address of server when default instance, or provide full address like "192.168.1.25\mydata"
[2] user nage will be used as "SA" [SQL must be installed in mixed mode], [3] Provide SA user password
refer
http://expresstechnology.com/knowledgeb ... ql-server/

Use this utility at your own risk, This is for checking connectivity only, do not change any data through this utility.
Attachments
view_sqldatabase.rar
(1.23 MiB) Downloaded 74 times
BPD
Convert Dream into Reality through HMG

jorge.posadas
Posts: 89
Joined: Mon May 19, 2014 7:43 pm
DBs Used: DBF, SQLite, MS-SQL, ACCESS, MariaDB (en proceso)
Location: Tizayuca, Hgo. México
Been thanked: 6 times
Contact:

Post by jorge.posadas » Mon Apr 15, 2019 3:00 pm

Jair,

Yo probé tu EXE y si me da resultado, es decir me conecto al server, selecciono una base de datos y luego selecciono la tabla y me muestra todos los datos, asi que todo funciona bien
Cordialmente

Jorge Posadas Ch
Tizayuca, Hgo.
M é x i c o .
Movil +52 55 1427 2013
SKYPE: jorge.posadasch
Email: jorge.posadas@gmail.com

User avatar
jairpinho
Posts: 344
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Has thanked: 3 times
Been thanked: 11 times
Contact:

Post by jairpinho » Mon Apr 15, 2019 10:02 pm

bpd2000 wrote:
Mon Apr 15, 2019 5:18 am
Hi,
Try to connect sql server with utility, if success I will guide you further
Note : [1] Provide IP address of server when default instance, or provide full address like "192.168.1.25\mydata"
[2] user nage will be used as "SA" [SQL must be installed in mixed mode], [3] Provide SA user password
refer
http://expresstechnology.com/knowledgeb ... ql-server/

Use this utility at your own risk, This is for checking connectivity only, do not change any data through this utility.

hi, I already do the connection and visualization with third party software, I would like to do with hmg without depending on third party applications, I need connection examples and sqlserver database visualization with odbc or native
Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br

User avatar
bpd2000
Posts: 1088
Joined: Sat Sep 10, 2011 4:07 am
Location: India
Has thanked: 197 times
Been thanked: 102 times

Post by bpd2000 » Tue Apr 16, 2019 3:53 am

Hi Jair Pinho,
FYI, Utility provided is compiled in Harbour
It is require to prepare similar application in HMG+Harbour
Connection can be done through HMG
BPD
Convert Dream into Reality through HMG

User avatar
mol
Posts: 3247
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 230 times
Been thanked: 132 times
Contact:

Post by mol » Tue Apr 16, 2019 11:52 am

Hi!
I don't know if it help you, few years ago I wrote application working with MS SQL:

Code: Select all

function 	SetDatabaseConnection
	
	do while .t.

		// sddodbc
		RDDSETDEFAULT( "SQLMIX" )
		SET( 4, "yyyy-mm-dd" )
		WAIT WINDOW "Trying to connect..." NOWAIT
		nConnection := RDDINFO( 1001, { "ODBC", cConStr }, 'SQLMIX' )
		WAIT CLEAR
		//msgbox("Connect: "+str(nConnection))
		If nConnection == 0
			MsgStop("Error with connection: " + cSQLBase)
			if MsgYesNo("Try to make new database: " + cSQLBase + "?")
				cConStr := "Driver={SQL Server};Server=" + cSQLSerwer + ";Database="+ "master" + ";Trusted_Connection=yes;Uid=" + cSQLUser + ";Pwd="+ cSQLPassword +";"
				nConnection := RDDINFO( 1001, { "ODBC", cConStr }, 'SQLMIX' )
				if nConnection == 0
					MsgStop("Error while making new DB: "+ cSQLBase)
					Release Window ALL
					Quit
				else
					if SQL_DowolnySQL("CREATE DATABASE " + cSQLBase)
						loop
					else
						MsgStop("Error while making new DB: "+ cSQLBase)
						quit
					endif
				endif
			else
				Release Window ALL
				Quit
			endif
		else
			exit
		Endif               	
	enddo
	// czy jest już tabela?
	aTables := SQL_GetColumn("information_schema.tables","Table_name","Table_name='PISMA'")
	if ascan(aTables, {|x| upper(x) == "PISMA"}) = 0
		SQL_CreateTables()
	endif
return

function SQL_DowolnySQL
	param cSQL
	local lOdp := .f.

	local xFormatDaty
	
	xFormatDaty := SET( _SET_DATEFORMAT, "yyyy-mm-dd" )
	lodp := RDDINFO(RDDI_EXECUTE, cSQL)
	SET( _SET_DATEFORMAT, xFormatDaty)	
 return lOdp

User avatar
Ismach
Posts: 110
Joined: Wed Nov 28, 2012 5:55 pm
DBs Used: DBF, mySQL, Mariadb, postgreSQL, Oracle, Db2, Interbase, Firebird, and SQLite
Location: Buenos Aires - Argentina
Been thanked: 7 times

Post by Ismach » Tue Apr 16, 2019 2:30 pm

Yo uso ADODB de winole y funciona de maravillas

Code: Select all

// Provider=SQLOLEDB; Data Source=A31ServerGenoa\dbMelloa;Initial Catalog=dbMelloa;User ID=genoa;Password=A13genoa;

// USUARIO
static ccUser  := "genoa"

// PASSWORD
static ccPass  := "A13genoa"

// NOMBRE DEL HOST + NOMBREDE LA BASE DE DATOS
static ccHost_NomBase  := "A31ServerGenoa\dbMelloa;Initial Catalog=dbMelloa;"

// PROVEEDOR DEL API CONNECTOR
static ccProvider  := "SQLOLEDB;"

en el main defino el objeto de conexion de dominio Publico

Code: Select all

PUBLIC oServer   AS OBJECT
y esta funcion

Code: Select all

FUNCTION Gus_ConectaSQLServer()

     Local ccConnector := "Provider=" + ccProvider + ";" + ;
                          "Data Source= " + ccHost_NomBase + ";" + ;
                          "User ID=" + ccUser + ";" + ;
                          "Password=" + ccPass + ";"
     // msginfo(ccConnector)
     oServer := TOLEAuto():New('ADODB.Connection')
     oServer:Open( ccConnector )

RETURN NIL

User avatar
jairpinho
Posts: 344
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Has thanked: 3 times
Been thanked: 11 times
Contact:

Post by jairpinho » Wed Apr 17, 2019 12:45 am

mol wrote:
Tue Apr 16, 2019 11:52 am
Hi!
I don't know if it help you, few years ago I wrote application working with MS SQL:

Code: Select all

function 	SetDatabaseConnection
	
	do while .t.

		// sddodbc
		RDDSETDEFAULT( "SQLMIX" )
		SET( 4, "yyyy-mm-dd" )
		WAIT WINDOW "Trying to connect..." NOWAIT
		nConnection := RDDINFO( 1001, { "ODBC", cConStr }, 'SQLMIX' )
		WAIT CLEAR
		//msgbox("Connect: "+str(nConnection))
		If nConnection == 0
			MsgStop("Error with connection: " + cSQLBase)
			if MsgYesNo("Try to make new database: " + cSQLBase + "?")
				cConStr := "Driver={SQL Server};Server=" + cSQLSerwer + ";Database="+ "master" + ";Trusted_Connection=yes;Uid=" + cSQLUser + ";Pwd="+ cSQLPassword +";"
				nConnection := RDDINFO( 1001, { "ODBC", cConStr }, 'SQLMIX' )
				if nConnection == 0
					MsgStop("Error while making new DB: "+ cSQLBase)
					Release Window ALL
					Quit
				else
					if SQL_DowolnySQL("CREATE DATABASE " + cSQLBase)
						loop
					else
						MsgStop("Error while making new DB: "+ cSQLBase)
						quit
					endif
				endif
			else
				Release Window ALL
				Quit
			endif
		else
			exit
		Endif               	
	enddo
	// czy jest już tabela?
	aTables := SQL_GetColumn("information_schema.tables","Table_name","Table_name='PISMA'")
	if ascan(aTables, {|x| upper(x) == "PISMA"}) = 0
		SQL_CreateTables()
	endif
return

function SQL_DowolnySQL
	param cSQL
	local lOdp := .f.

	local xFormatDaty
	
	xFormatDaty := SET( _SET_DATEFORMAT, "yyyy-mm-dd" )
	lodp := RDDINFO(RDDI_EXECUTE, cSQL)
	SET( _SET_DATEFORMAT, xFormatDaty)	
 return lOdp
could i make an example in ide, because i test your example and nothing happens what lib should i use in ide libs =?
Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br

User avatar
jairpinho
Posts: 344
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Has thanked: 3 times
Been thanked: 11 times
Contact:

Post by jairpinho » Wed Apr 17, 2019 12:45 am

Ismach wrote:
Tue Apr 16, 2019 2:30 pm
Yo uso ADODB de winole y funciona de maravillas

Code: Select all

// Provider=SQLOLEDB; Data Source=A31ServerGenoa\dbMelloa;Initial Catalog=dbMelloa;User ID=genoa;Password=A13genoa;

// USUARIO
static ccUser  := "genoa"

// PASSWORD
static ccPass  := "A13genoa"

// NOMBRE DEL HOST + NOMBREDE LA BASE DE DATOS
static ccHost_NomBase  := "A31ServerGenoa\dbMelloa;Initial Catalog=dbMelloa;"

// PROVEEDOR DEL API CONNECTOR
static ccProvider  := "SQLOLEDB;"

en el main defino el objeto de conexion de dominio Publico

Code: Select all

PUBLIC oServer   AS OBJECT
y esta funcion

Code: Select all

FUNCTION Gus_ConectaSQLServer()

     Local ccConnector := "Provider=" + ccProvider + ";" + ;
                          "Data Source= " + ccHost_NomBase + ";" + ;
                          "User ID=" + ccUser + ";" + ;
                          "Password=" + ccPass + ";"
     // msginfo(ccConnector)
     oServer := TOLEAuto():New('ADODB.Connection')
     oServer:Open( ccConnector )

RETURN NIL
could i make an example in ide, because i test your example and nothing happens what lib should i use in ide libs =?
Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br

jorge.posadas
Posts: 89
Joined: Mon May 19, 2014 7:43 pm
DBs Used: DBF, SQLite, MS-SQL, ACCESS, MariaDB (en proceso)
Location: Tizayuca, Hgo. México
Been thanked: 6 times
Contact:

Post by jorge.posadas » Wed Apr 17, 2019 3:11 pm

jairpinho

This an example I hope help you
Attachments
Tracking.zip
HMG + ADO + MS-SQL
(1.71 MiB) Downloaded 68 times
Cordialmente

Jorge Posadas Ch
Tizayuca, Hgo.
M é x i c o .
Movil +52 55 1427 2013
SKYPE: jorge.posadasch
Email: jorge.posadas@gmail.com

Post Reply