Looking for library to access MS SQL server
Looking for library to access MS SQL server
Hi,
Someone know a DLL or embeded LIB to access MS SQL server, using CallFunction() or CallCFunction()?.
I'm using libmysql.dll to access MySQL server, and it runs fine. I'm looking for some similar library.
Free, of course, I know already www.sqlapi.com by $299.
Best Regards
JOAQUIN
Someone know a DLL or embeded LIB to access MS SQL server, using CallFunction() or CallCFunction()?.
I'm using libmysql.dll to access MySQL server, and it runs fine. I'm looking for some similar library.
Free, of course, I know already www.sqlapi.com by $299.
Best Regards
JOAQUIN
- Fangbeast
- PureBasic Protozoa
- Posts: 4789
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
I seem to remember some code by Rings at purearea.net that would access any database. Try there or a link from there in the PBOSL libraries.jqn wrote:Thanks, Fangbeast. But I'm ALREADY accessing MySQL.
I'm need same access to MicroSoft SQL server 2000. I'm looking for a dll similar to libmysql.dll.
Amateur Radio/VK3HAF, (D-STAR/DMR and more), Arduino, ESP32, Coding, Crochet
Hi jqn,
I use MySQL without any additional library. Just created a SystemDSN to MySQL and used PB-code like this (3.94):
There is surely no library needed!
Kukulkan
I use MySQL without any additional library. Just created a SystemDSN to MySQL and used PB-code like this (3.94):
Code: Select all
If OpenDatabase(#MySQL, mysqlUseDB.s, Username.s, Password.s) = 0
MessageRequester("error", "MySQL-Database not available!" + #CR$ + #CR$ + DatabaseError(), #MB_ICONERROR)
ProcedureReturn #False
EndIf
Query.s = "SELECT * FROM Table WHERE Field = Value"
If DatabaseQuery(Query.s) = 0
MessageRequester("error", "MySQL-Error: " + DatabaseError() + " using query: '" + Query.s + "'", #MB_ICONERROR)
ProcedureReturn #False
EndIf
(...)
Kukulkan
I know a lot of high performance applications using ODBC like document management systems or enterprice ressource planning. Most time, the speed is a result of your programming skills, right indexes and good logic.Yes, but only if you dont mind the slow down.
But if you mean ODBC is to slow, you have to choose another method. There I can't help you. Sorry.
Kukulkan
My apologies, I should have explained myself better.
Some people takes to practice to connect - execute sql - disconnect. When doing this through odbc in PHP, it is slow. however, having a persistant connection, it is the same speed (afaik) as using the mysql native dll.
So I actually agree too
For persistant connections odbc and native dlls are definately compariable. but for the multiple connects/disconnects, I have found odbc slower ..
Thus is another reason why forums such as PHPBB, WWF, VB, etc have an option for persistant db connections. The speed increase is huge
Some people takes to practice to connect - execute sql - disconnect. When doing this through odbc in PHP, it is slow. however, having a persistant connection, it is the same speed (afaik) as using the mysql native dll.
So I actually agree too

Thus is another reason why forums such as PHPBB, WWF, VB, etc have an option for persistant db connections. The speed increase is huge

On another note, if you head over to the docs found @ ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.SQL.v2005.en/dataacc9/html/69889a98-7740-4667-aecd-adfc0b37f6f0.htm
It mentions the header files found @ %PROGRAM FILES%\Microsoft SQL Server\90\SDK can be used. Specifically .. sqlncli.h
I know there are some people here who have been successfull in converting over C headers to PB includes.
It mentions the header files found @ %PROGRAM FILES%\Microsoft SQL Server\90\SDK can be used. Specifically .. sqlncli.h

I had the same problem and run a vb script from Purebasic to make the DSN in the ODBC control panel. Then use standard Purebasic database commands.
I basically cut and paste the code from the following site into a file called dsn.vbs
http://www.microsoft.com/technet/script ... y1110.mspx
I just use something like
to call the script.
Phil
I basically cut and paste the code from the following site into a file called dsn.vbs
http://www.microsoft.com/technet/script ... y1110.mspx
I just use something like
Code: Select all
RunProgram("dsn.vbs","", "", 1 | 2)
Phil
Well, it can be easily done with purebasic.
Creating/Removing DSN:
http://msdn.microsoft.com/library/defau ... source.asp
Creating/Removing DSN:
http://msdn.microsoft.com/library/defau ... source.asp
Code: Select all
; flype, juil 2006
Enumeration 1
#ODBC_ADD_DSN ; Ajoute une source de données utilisateur.
#ODBC_CONFIG_DSN ; Configure/Modifie une source de données utilisateur existante.
#ODBC_REMOVE_DSN ; Supprime une source de données utilisateur existante.
#ODBC_ADD_SYS_DSN ; Ajoute une source de données système.
#ODBC_CONFIG_SYS_DSN ; Configure/Modifie une source de données système existante.
#ODBC_REMOVE_SYS_DSN ; Supprime une source de données système existante.
#ODBC_REMOVE_DEFAULT_DSN ; Supprime la source de données définies par défaut.
EndEnumeration
#ODBC_DRIVER_MSACCESS = "Microsoft Access Driver (*.mdb)"
Procedure.l MSAccess_AddConnection(name.s, database.s, hwnd.l = #Null)
Protected attrs.s
attrs + "UID=" + ";"
attrs + "PWD=" + ";"
attrs + "DSN=" + name + ";"
attrs + "DBQ=" + database + ";"
attrs + "FIL=" + "MS Access;"
attrs + "Driver=" + "ODBCJT32.DLL;"
attrs + "DefaultDir=" + GetPathPart(database) + ";"
attrs + "Description=" + FormatDate("Créé le %dd-%mm-%yyyy, %hh:%ii:%ss;", Date())
ReplaceString(attrs, ";", #NULL$, 2)
ProcedureReturn SQLConfigDataSource_(hWnd, #ODBC_ADD_DSN, #ODBC_DRIVER_MSACCESS, attrs)
EndProcedure
Procedure.l MSAccess_RemoveConnection(name.s, hwnd.l = #Null)
ProcedureReturn SQLConfigDataSource_(hWnd, #ODBC_REMOVE_DSN, #ODBC_DRIVER_MSACCESS, "DSN="+name)
EndProcedure
If InitDatabase()
DSN.s = "pbtest"
If MSAccess_AddConnection(DSN, "c:\test.mdb")
If OpenDatabase(0, DSN, "", "")
If DatabaseQuery(0, "SELECT NOW")
If NextDatabaseRow(0)
Debug GetDatabaseString(0, 0)
EndIf
EndIf
If DatabaseQuery(0, "SELECT * FROM personne")
While NextDatabaseRow(0)
Debug GetDatabaseString(0, 0)
Debug GetDatabaseString(0, 1)
Debug GetDatabaseString(0, 2)
Wend
EndIf
EndIf
MSAccess_RemoveConnection(DSN)
EndIf
EndIf
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
My 2 cents... this will not work unless the client has loaded MyODBC - which is what I primarily do when I build database driven PB apps. I usually make the connect string a registry setting so the final app could use any type of database - but I find MySQL quite capable for all the stuff I do.Kukulkan wrote:Hi jqn,
I use MySQL without any additional library. Just created a SystemDSN to MySQL and used PB-code like this (3.94):
(...)
There is surely no library needed!
Kukulkan
-Beach