Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Conexión con bases de datos
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Conexión con bases de datos

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 11-08-2003
VOR VOR is offline
Registrado
 
Registrado: jul 2003
Ubicación: CORREGIDORA, QUERETARO, QRO. MEXICO
Posts: 9
Poder: 0
VOR Va por buen camino
Question Se puede crear un System DSN (ODBC) mediante programacion en delphi?

Que tal

Necesito crear un system dsn en el ODBC al ejecutar un programa en delphi, no se si se pueda hecer esto mediante programacion en delphi.

de antemano muchas Gracias....
Responder Con Cita
  #2  
Antiguo 11-08-2003
Avatar de delphi.com.ar
delphi.com.ar delphi.com.ar is offline
Federico Firenze
 
Registrado: may 2003
Ubicación: Buenos Aires, Argentina *
Posts: 5.932
Poder: 27
delphi.com.ar Va por buen camino
Te recomiendo buscar información en la web sobre la ODBC API SQLConfigDataSource.

Saludos!
__________________
delphi.com.ar

Dedique el tiempo suficiente para formular su pregunta si pretende que alguien dedique su tiempo en contestarla.
Responder Con Cita
  #3  
Antiguo 13-08-2003
Lmas Lmas is offline
Miembro
 
Registrado: jul 2003
Ubicación: España
Posts: 27
Poder: 0
Lmas Va por buen camino
Hola VOR.

...marchando truco del almendruco.

Lo mejor para crearlo es... ¡que le crees tu mismo a mano!

.
.
.



.
.
.

Vale, vale.

Una vez que hayas creado el DSN, con el RegEdit o editor del registro, ve a la clave HKEY_LOCAL_MACHINE\Software\ODBC\ODBC.INI\ y ahí te aparecerá una clave con toda la información del DSN que hayas creado a mano.

Entonces, tu programa lo único que tendrá que hacer es crear todas esas entradas con sus correspondientes valores.
__________________
Una cosa es una cosa, y otra cosa es otra cosa...
Responder Con Cita
  #4  
Antiguo 05-09-2003
tamara tamara is offline
Miembro
 
Registrado: sep 2003
Posts: 12
Poder: 0
tamara Va por buen camino
El otro dia lo hize asi y funciono:

Pones Registry en el uses

procedure TForm1.Button1Click(Sender: TObject);
var
R1:TRegistry;
begin
R1:=TRegistry.create;
R1.RootKey := HKEY_LOCAL_MACHINE;
if R1.OpenKey('SOFTWARE\ODBC\ODBC.INI',FALSE)
then R1.CreateKey(nombre.Text);
R1.Destroy;
R1:=TRegistry.create;
R1.RootKey := HKEY_LOCAL_MACHINE;
if R1.OpenKey('SOFTWARE\ODBC\ODBC.INI\'+nombre.Text,FALSE) then
begin
R1.WriteString('DBQ',Path.Text);
R1.WriteString('Driver',PathDll.Text);
R1.WriteInteger('DriverId', 25);
R1.WriteString('FIL','MS Access;');
R1.WriteString('PWD',clave.text);
R1.WriteInteger('SafeTransactions', 0);
R1.WriteString('UID',usr.text);
R1.CreateKey('Engines');
R1.Destroy;
R1:=TRegistry.create;
R1.RootKey := HKEY_LOCAL_MACHINE;
if R1.OpenKey('SOFTWARE\ODBC\ODBC.INI\'+nombre.Text+'\Engines',FALSE) then
begin
R1.CreateKey('Jet');
R1.Destroy;
R1:=TRegistry.create;
R1.RootKey := HKEY_LOCAL_MACHINE;
if R1.OpenKey('SOFTWARE\ODBC\ODBC.INI\'+nombre.Text+'\Engines\Jet',FALSE) then
begin
R1.WriteString('ImplicitCommitSync','');
R1.WriteInteger('MaxBufferSize', 2048);
R1.WriteInteger('PageTimeout', 5);
R1.WriteInteger('Threads', 3);
R1.WriteString('UserCommitSync','Yes');
R1.Destroy;
R1:=TRegistry.create;
R1.RootKey := HKEY_LOCAL_MACHINE;
if R1.OpenKey('SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources',FALSE) then
begin
R1.WriteString(nombre.text, driver2.text);
R1.Destroy;
ShowMessage(' ALIAS CREADO. ');
end;
end;
end;
end;
end;
Responder Con Cita
  #5  
Antiguo 05-09-2003
tamara tamara is offline
Miembro
 
Registrado: sep 2003
Posts: 12
Poder: 0
tamara Va por buen camino
El otro dia lo hize asi y funciono:

Pones Registry en el uses

procedure TForm1.Button1Click(Sender: TObject);
var
R1:TRegistry;
begin
R1:=TRegistry.create;
R1.RootKey := HKEY_LOCAL_MACHINE;
if R1.OpenKey('SOFTWARE\ODBC\ODBC.INI',FALSE)
then R1.CreateKey(nombre.Text);
R1.Destroy;
R1:=TRegistry.create;
R1.RootKey := HKEY_LOCAL_MACHINE;
if R1.OpenKey('SOFTWARE\ODBC\ODBC.INI\'+nombre.Text,FALSE) then
begin
R1.WriteString('DBQ',Path.Text);
R1.WriteString('Driver',PathDll.Text);
R1.WriteInteger('DriverId', 25);
R1.WriteString('FIL','MS Access;');
R1.WriteString('PWD',clave.text);
R1.WriteInteger('SafeTransactions', 0);
R1.WriteString('UID',usr.text);
R1.CreateKey('Engines');
R1.Destroy;
R1:=TRegistry.create;
R1.RootKey := HKEY_LOCAL_MACHINE;
if R1.OpenKey('SOFTWARE\ODBC\ODBC.INI\'+nombre.Text+'\Engines',FALSE) then
begin
R1.CreateKey('Jet');
R1.Destroy;
R1:=TRegistry.create;
R1.RootKey := HKEY_LOCAL_MACHINE;
if R1.OpenKey('SOFTWARE\ODBC\ODBC.INI\'+nombre.Text+'\Engines\Jet',FALSE) then
begin
R1.WriteString('ImplicitCommitSync','');
R1.WriteInteger('MaxBufferSize', 2048);
R1.WriteInteger('PageTimeout', 5);
R1.WriteInteger('Threads', 3);
R1.WriteString('UserCommitSync','Yes');
R1.Destroy;
R1:=TRegistry.create;
R1.RootKey := HKEY_LOCAL_MACHINE;
if R1.OpenKey('SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources',FALSE) then
begin
R1.WriteString(nombre.text, driver2.text);
R1.Destroy;
ShowMessage(' ALIAS CREADO. ');
end;
end;
end;
end;
end;
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 22:15:31.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi