|
Connection to MS SQLSERVER |
Débuté par Walter CELERIER, 21 oct. 2024 15:20 - 1 réponse |
| |
| | | |
|
| |
Membre enregistré 1 message |
|
Posté le 21 octobre 2024 - 15:20 |
Hello everyone,
We just installed the native SQLSERVER connector (Windev28). The windev dll's are present, but we do not manage to establisch a connection. Our MS SQLSERVER (version 2022) is running on a server with ip-address 192.168.2.16 (internal) and listening on port 5306. The firewall passes through this port (5306) We use the sentences IF DescribeConnection("connectie","username","password","192.168.2.16:5306",Edit4,hNativeAccessSQLServer,hOReadWrite,"") = False THEN Error(ErrorInfo()) Error("Kan geen verbinding beschrijven met de databaseserver") EndProgram() END IF HOpenConnection("connectie") = False THEN Error(ErrorInfo()) Error("Kan geen verbinding openen met de databaseserver") EndProgram() END
This is the error message we get on the hopenconnection: native SQLSERVER access error. Error Number = 1 17 Error 80004005 returned by SQL Server Description: Log imeout expired SQL State: HYTOO SQL Error Number: 0 Sub-error #1 Description: A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. SQL State: 08001 SQL Error Number: 87 Sub-error #2 Description: SQL Server Network Interfaces: Connection string is not valid [87]. SQL State: 08001 SQL Error Number: 87
Do we need to install(copy) additional dll's like we had to do with MySQL? For MySQL a libmysql.dll is needed in the exe-directory.
I hope on a quick response. Thanks in advance. |
| |
| |
| | | |
|
| | |
| |
Posté le 26 octobre 2024 - 19:13 |
Walter CELERIER wrote:
Hello everyone,
We just installed the native SQLSERVER connector (Windev28). The windev dll's are present, but we do not manage to establisch a connection. Our MS SQLSERVER (version 2022) is running on a server with ip-address 192.168.2.16 (internal) and listening on port 5306. The firewall passes through this port (5306) We use the sentences IF DescribeConnection("connectie","username","password","192.168.2.16:5306",Edit4,hNativeAccessSQLServer,hOReadWrite,"") = False THEN Error(ErrorInfo()) Error("Kan geen verbinding beschrijven met de databaseserver") EndProgram() END IF HOpenConnection("connectie") = False THEN Error(ErrorInfo()) Error("Kan geen verbinding openen met de databaseserver") EndProgram() END
This is the error message we get on the hopenconnection: native SQLSERVER access error. Error Number = 1 17 Error 80004005 returned by SQL Server Description: Log imeout expired SQL State: HYTOO SQL Error Number: 0 Sub-error #1 Description: A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. SQL State: 08001 SQL Error Number: 87 Sub-error #2 Description: SQL Server Network Interfaces: Connection string is not valid [87]. SQL State: 08001 SQL Error Number: 87
Do we need to install(copy) additional dll's like we had to do with MySQL? For MySQL a libmysql.dll is needed in the exe-directory.
I hope on a quick response. Thanks in advance.
HI we are using sqlserver since version 2008 and windev versio 20
here the way we use
I have a INI file with all parameters i need so in the code of the project
we have, see below
wsge_QtConexoes is int Wsge_BancodeDados is string Wsge_Servidor is string
LeIniOutraVez: IF fFileExist(fCurrentDir()+ "\CONEXAO.INI") = False THEN Open(WIN_Server) END
wsge_SqlUserRPT is string = "" wsge_SqlPasswordRPT is string = "" wsge_SqlUserRPT = Uncrypt(INIRead("CONFIGURACAO", "UserRPT" , "", fCurrentDir()+ "\CONEXAO.INI"),"17041991") wsge_SqlPasswordRPT = Uncrypt(INIRead("CONFIGURACAO", "PasswordRPT", "", fCurrentDir()+ "\CONEXAO.INI"),"17041991") Wsge_ConexaoCrystal is string = "DSN = powersql;UID = " + wsge_SqlUserRPT + ";PWD = " + wsge_SqlPasswordRPT + ";DSQ"
wsge_diretorioRpt is string = "" wsge_diretorioRpt = Uncrypt(INIRead("CONFIGURACAO","DiretorioRpt","", fCurrentDir()+ "\CONEXAO.INI"),"17041991") IF wsge_diretorioRpt = "" THEN Warning("Nao foi Possivel pegar o Diretorio Para Impressao, Relatorios nao serao Impressos") END
//DIRETÓRIO DO XML wsge_diretorioXml is string = "" wsge_diretorioXml = Uncrypt(INIRead("CONFIGURACAO","DiretorioXml","", fCurrentDir()+ "\CONEXAO.INI"),"17041991")
wsge_Permissao is ANSI string // vai receber as permissao do programa
EXTERN "KeyConst.WL" // para controlar as teclas de funcoes EXTERN "WinConst.WL"
// variaves para fazer Conexao de Acesso Nativo, Basicamente para rotinas especificas e chamadas a Stored Procedure sSqlProvider is string sSqlUser is string sSqlPassword is string sSqlServer is string sSqlDatabase is string sSqlAccess is string sTrusted_Connection is string sMarsConn is string sTimeoutConnection is int sTimeoutCommand is int sLogAudit is int
// sSqlProvider = Uncrypt(INIRead("CONFIGURACAO", "Provider", "", fCurrentDir()+ "\CONEXAO.INI"),"17041991") sSqlUser = Uncrypt(INIRead("CONFIGURACAO", "User" , "", fCurrentDir()+ "\CONEXAO.INI"),"17041991") sSqlPassword = Uncrypt(INIRead("CONFIGURACAO", "Password", "", fCurrentDir()+ "\CONEXAO.INI"),"17041991") sSqlServer = Uncrypt(INIRead("CONFIGURACAO", "Server", "", fCurrentDir()+ "\CONEXAO.INI"),"17041991") sSqlDatabase = Uncrypt(INIRead("CONFIGURACAO", "DataBase", "", fCurrentDir()+ "\CONEXAO.INI"),"17041991") sSqlAccess = Uncrypt(INIRead("CONFIGURACAO", "Access", "", fCurrentDir()+ "\CONEXAO.INI"),"17041991") sTrusted_Connection = Uncrypt(INIRead("CONFIGURACAO","Trusted_Connection","",fCurrentDir()+"\CONEXAO.INI"),"17041991") sMarsConn = Uncrypt(INIRead("CONFIGURACAO","MARS_Connection","",fCurrentDir()+"\CONEXAO.INI"),"17041991") sTimeoutCommand = Uncrypt(INIRead("CONFIGURACAO","TimeoutCommand","",fCurrentDir()+"\CONEXAO.INI"),"17041991") sTimeoutConnection = Uncrypt(INIRead("CONFIGURACAO","TimeoutConnection","",fCurrentDir()+"\CONEXAO.INI"),"17041991")
// // Parameters of the connection Dec..Provider = sSqlProvider //se for passar via variavel tem que estar como WinDevSQLServer = hNativeAccessSQLServer Dec..User = sSqlUser Dec..Password = sSqlPassword Dec..Server = sSqlServer Dec..Database = sSqlDatabase Dec..Access = sSqlAccess //se for passar via variavel tem que estar como 3 = hOReadWrite Dec..ExtendedInfo = "WD Connection Timeout = " + sTimeoutConnection + ";WD Command Timeout = " + sTimeoutCommand + ";Trusted_Connection=" + sTrusted_Connection + ";MARS_Connection=" + sMarsConn Dec..CursorOptions = hClientCursor+hForwardOnlyCursor
IF Ping(sSqlServer) = False THEN Error("Servidor " + sSqlServer + " está Inacessível, Contate o suporte da Rede.") IF YesNo(No,"Abrir configurações de Acesso?(Sim/Não)") = Yes THEN Open(WIN_Server) GOTO LeIniOutraVez ELSE EndProgram() END END // Opening the connxection
IF HOpenConnection(Dec) = False THEN Error("Sql Error :" + HErrorInfo()) Error("The connection to the data source " + sSqlServer + " failed." + CR + "Error code: " + SQL.Error + CR + SQL.MesError) EndProgram() END
wsge_conexaoCubo is string = "Provider=SQLOLEDB.1;Password=" + wsge_SqlPasswordRPT + ";Persist Security Info=True;User ID=" + wsge_SqlUserRPT + ";Initial Catalog=" + "teste" + ";Data Source=" + NoSpace(sSqlServer) wsge_conexaoJanus is string = "Provider=SQLOLEDB.1;Password=" + wsge_SqlPasswordRPT + ";Persist Security Info=True;User ID=" + wsge_SqlUserRPT + ";Initial Catalog=" + "teste" + ";Data Source=" + NoSpace(sSqlServer) //Provider=SQLNCLI11.1;Persist Security Info=False;User ID=sa;Initial Catalog=Teste;Data Source=DEC-PC;Initial File Name="";Server SPN="" // MyProcedure is Data Source // MyProcedure.Database = " " MyProcedure.servername = " " WHEN EXCEPTION IN IF HExecuteSQLQuery(MyProcedure,Dec, hQueryWithoutCorrection , "Dec_Getserver @Database out ,@servername out" ) = False THEN Error("Erro Executando Dec_Getserver " + HErrorInfo(hErrFullDetails)) EndProgram() ELSE Wsge_Servidor = MyProcedure.servername Wsge_BancodeDados = MyProcedure.Database END DO Error(HErrorInfo(hErrFullDetails)) EndProgram() END HCancelDeclaration(MyProcedure) // libera da memoria |
| |
| |
| | | |
|
| | | | |
| | |
|