|
| |
| ODBC. | |
Puis-je utiliser des liens ODBC pour les accès à ma base de données ?
|
|
|
Réponse : Oui bien sur, vous pouvez creer vos liens ODBC sur votre interface de gestion .
|
|
Puis je utiliser les DSN LESS ?
|
|
|
Réponse : Oui, sans problème, nous vous suggerons de consulter la fiche suivante : Détail
|
|
Comment connecter ma base MYSQL sur un script ASP ?
|
|
|
Réponse : Voici la syntaxe de connexion : < % ' Déclaration des variables Dim LE_DSN Dim MaConnexion Dim ServerAddress Dim DBName Dim UID Dim Password ' IP ou Nom du serveur mySQL ServerAddress = "adresse_ip_du_serveur_mysql" 'localhost si c'est sur la même machine ' Nom de la base de données DBName = "nom_de_la_base" ' Login pour la base UID = "login_mysql" ' Mot de passe pour la base Password = "mot_de_passe_mysql" ' Ici on construit la chaine de connexion ODBC LE_DSN = "driver={MySQL ODBC 3.51 Driver};server=" & ServerAddress & ";db=" & DBName & ";user id=" & UID & ";pwd=" & Password & ";option=16386" ' Paramètre de connexion + connexion Set MaConnexion = Server.CreateObject("ADODB.Connection") MaConnexion.ConnectionTimeout = 30 MaConnexion.CommandTimeout = 30 MaConnexion.Open LE_DSN ' Ci dessous la liste des options de connexion pour MyODBC ' The Option argument is used to tell MyODBC that the client isn't 100% ODBC compliant. ' The following options are listed in the same order as they appear in the MyODBC connect screen: ' 1 The client can't handle that MyODBC returns the real width of a column. ' 2 The client can't handle that MySQL returns the true value of affected rows. ' If this flag is set then MySQL returns 'found rows' instead. ' One must have MySQL 3.21.14 or newer to get this to work. ' 4 Make a debug log in c:\myodbc.log. This is the same as putting MYSQL_DEBUG=d:t:O,c::\myodbc.log in AUTOEXEC.BAT ' 8 Don't set any packet limit for results and parameters. ' 16 Don't prompt for questions even if driver would like to prompt ' 32 Simulate a ODBC 1.0 driver in some context. ' 64 Ignore use of database name in 'database.table.column'. (MySQL 3.22) ' 128 Force use of ODBC manager cursors (experimental) ' 256 Remove use of extended fetch (experimental) ' 512 Pad CHAR fields to full column length. ' 1024 SQLDescribeCol() will return fully qualifed column names ' 2048 Use compressed protocol (if server supports it) ' 4096 Tell server to ignore space after function name and before '(' (needed by PowerBuilder). This will make all function names keywords! ' 8192 Connect with named pipes to a mysqld server running on NT. ' 16384 Change LONGLONG columns to INT columns, as some applications can't handle LONGLONG. ' 32768 Return 'user' as Table_qualifier and Table_owner from SQLTables (test) ' 65536 Read my.cnf ' 131072 Add some extra safety checks (should not bee needed but...) % > |
|
Comment connecter ma base SQL SERVEUR 2000 sur un script ASP ?
|
|
|
Réponse : Voici la syntaxe de connexion : < % Dim objConnexion, chaineConn ' Créer l'objet ADO Set objConnexion = Server.CreateObject("ADODB.Connection") ' Ouvrir la base sans DSN avec chaîne de connexion chaineConn = "provider=SQLOLEDB.1;DataSource=adresse_ip_sql;Initial Catalog=nom_de_la_base_sql;User ID=user_sql;Password=password_sql; " objConnexion.open chaineConn ' Traitement... ' Fermer la connexion et détruire l'objet objConnexion.close set objConnexion=nothing % > Oui bien : < % Set objConnexion = Server.CreateObject("ADODB.Connection") objConnexion.open "Driver={SQL Server};" & _ "Server=adresse_ip_sql;" & _ "Database=nom_de_la_base_sql;" & _ "Uid=user_sql;" & _ "Pwd=password_sql" ' Traitement... ' Fermer la connexion et détruire l'objet objConnexion.close set objConnexion=nothing % > |
|