Subject Re: [firebird-support] Re: Can I use FB Embedded with VB6?
Author Ivan Grozny
There were some formatting issues (quotes/spaces/newlines got munged) so I thought I'd post my final result in case anybody else has this question in the future.

Dim fbConn As ADODB.Connection
Dim fbRS As ADODB.Recordset
Dim fbDataBase As String, fbUser As String, fbPassword As String
fbDataBase = "C:\Ridiculous\Path\to\My\Database.FDB"
fbUser = "FOO"
fbPassword = "BAR"

Set fbConn = New ADODB.Connection
fbConn.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;" _
& "Extended Properties=" _
& "DSN=MyDSN;Driver=Firebird/InterBase(r) driver;" _
& "Dbname=" & fbDataBase & ";CHARSET=NONE;" _
& "UID=" & fbUser & ";PASSWORD=" & fbPassword & ";" _
& "Role=admin;Client=" & App.Path & "\fbembed.dll "
fbConn.Open

Set fbRS = New ADODB.Recordset
Set fbRS = fbConn.OpenSchema(adSchemaTables) 'show all tables in the grid
Set DataGrid1.DataSource = fbRS

By the way, it turns out that the secret ingredient that was missing from all the connection strings I Googled... was "Client=fbembed.dll"
I couldn't see how VB and ODBC were making the connection to the embedded server, or even how it could be running... and my instinct was good: they weren't and it wasn't. Thanks again for the heads-up, everybody!


----- Original Message ----
From: Ivan Grozny <mt_headed99@...>
To: firebird-support@yahoogroups.com
Sent: Wednesday, November 22, 2006 8:45:31 PM
Subject: Re: [firebird-support] Re: Can I use FB Embedded with VB6?













Thank you, thank you! I'll be trying that in a few hours (right now I'm preparing the brine for my turkey and making my cranberry sauce.)



I realized (after I posted my message and as I was reading the auto-response from the moderator) that I might not have posted my question in the right group; perhaps I should have joined the ODBC group instead. Thank you very much for helping me instead of pointing that out!



Sincerely,

Seeing the Light at the End of the Tunnel



----- Original Message ----

From: Javier Soques <jsoques@yahoo. com>

To: firebird-support@ yahoogroups. com

Sent: Wednesday, November 22, 2006 6:00:01 PM

Subject: [firebird-support] Re: Can I use FB Embedded with VB6?



Answer at the end...



--- In firebird-support@ yahoogroups. com, "mt_headed99"



<mt_headed99@ ...> wrote:



>



> Greetings!



>



> I have a legacy app that I need to keep upgrading while I work on its



> successor... I'm planning to move to all open-source and



> cross-platform; at this point I'm actually favoring Python. But



> meanwhile, I need to make the thing database-aware.



>



> I know from experience that, if anyone responds to this message, 95%



> of the responses will simply tell me not to use VB6. I'm working on



> that...



>



> I've been trying to RTFM on this, but I can't seem to find an answer -



> VB6 won't let me create a reference to fbembed/fbclient. dll; the ODBC



> driver on the Firebird website appears to be .NET only... am I out of



> luck? Or can I use the Microsoft ADO ver 2.8 that I _do_ have a



> reference for, and in that case what sort of connection string do I



> use? (And how the heck does the embedded server run if I can't



> reference the DLL?)



>



> I'd prefer to use the embedded server 'cause it's so tiny, but it's



> not a deal-breaker if I can't. If I can't, however, would someone



> please help me construct a working connection string for CS or SS? I



> can't find any working examples for VB6, and I'm flummoxed trying to



> translate the .NET examples.



>



> Many thanks, sincerely -



> Stuck in the Dark Ages



>



Here is what I did, downloaded latest version of FB Embedded and ODBC



driver. I assume you know how to use ADO so here is an example



connection string:



Provider=MSDASQL. 1;Persist Security Info=False;Extended



Properties=" DSN=MyERP; Driver=Firebird/ InterBase( r)



driver;Dbname= C:\data\firebird \MYERP.FDB; CHARSET=NONE; UID=SYSDBA; Role=admin; Client=C: \fbembedded\ fbembed.dll"



If you don't put the full path to the client DLL (fbembed.dll) then



your VB6 app exe has to be in the same directory where you extracted



the FB embedded Zip, or put fbembed.dll in your search path (haven't



tried that though).



Example code:



Private Sub Command1_Click( )



Dim conn As ADODB.Connection



Dim rs As ADODB.Recordset



Set conn = New ADODB.Connection



conn.ConnectionStri ng = "Provider=MSDASQL. 1;Persist Security



Info=False;Extended Properties=' DSN=MyERP; Driver=Firebird/ InterBase( r)



driver;Dbname= C:\data\firebird \MYERP.FDB; CHARSET=NONE; UID=SYSDBA; Role=admin; Client=C: \fbembedded\ fbembed.dll' "



conn.Open



Set rs = New ADODB.Recordset



Set rs = conn.OpenSchema( adSchemaTables) 'show all tables in the grid



Set DataGrid1.DataSourc e = rs



End Sub



That`s all there is to it.



HTH



Javier



<!--



#ygrp-mlmsg {font-size:13px; font-family: arial,helvetica, clean,sans- serif;}

#ygrp-mlmsg table {font-size:inherit; font:100% ;}

#ygrp-mlmsg select, input, textarea {font:99% arial,helvetica, clean,sans- serif;}

#ygrp-mlmsg pre, code {font:115% monospace;}

#ygrp-mlmsg * {line-height: 1.22em;}

#ygrp-text{

font-family: Georgia;

}

#ygrp-text p{

margin:0 0 1em 0;

}

#ygrp-tpmsgs{

font-family: Arial;

clear:both;

}

#ygrp-vitnav{

padding-top: 10px;

font-family: Verdana;

font-size:77% ;

margin:0;

}

#ygrp-vitnav a{

padding:0 1px;

}

#ygrp-actbar{

clear:both;

margin:25px 0;

white-space: nowrap;

color:#666;

text-align:right;

}

#ygrp-actbar .left{

float:left;

white-space: nowrap;

}

.bld{font-weight: bold;}

#ygrp-grft{

font-family: Verdana;

font-size:77% ;

padding:15px 0;

}

#ygrp-ft{

font-family: verdana;

font-size:77% ;

border-top:1px solid #666;

padding:5px 0;

}

#ygrp-mlmsg #logo{

padding-bottom: 10px;

}



#ygrp-vital{

background-color: #e0ecee;

margin-bottom: 20px;

padding:2px 0 8px 8px;

}

#ygrp-vital #vithd{

font-size:77% ;

font-family: Verdana;

font-weight: bold;

color:#333;

text-transform: uppercase;

}

#ygrp-vital ul{

padding:0;

margin:2px 0;

}

#ygrp-vital ul li{

list-style-type: none;

clear:both;

border:1px solid #e0ecee;

}

#ygrp-vital ul li .ct{

font-weight: bold;

color:#ff7900;

float:right;

width:2em;

text-align:right;

padding-right: .5em;

}

#ygrp-vital ul li .cat{

font-weight: bold;

}

#ygrp-vital a {

text-decoration: none;

}



#ygrp-vital a:hover{

text-decoration: underline;

}



#ygrp-sponsor #hd{

color:#999;

font-size:77% ;

}

#ygrp-sponsor #ov{

padding:6px 13px;

background-color: #e0ecee;

margin-bottom: 20px;

}

#ygrp-sponsor #ov ul{

padding:0 0 0 8px;

margin:0;

}

#ygrp-sponsor #ov li{

list-style-type: square;

padding:6px 0;

font-size:77% ;

}

#ygrp-sponsor #ov li a{

text-decoration: none;

font-size:130% ;

}

#ygrp-sponsor #nc {

background-color: #eee;

margin-bottom: 20px;

padding:0 8px;

}

#ygrp-sponsor .ad{

padding:8px 0;

}

#ygrp-sponsor .ad #hd1{

font-family: Arial;

font-weight: bold;

color:#628c2a;

font-size:100% ;

line-height: 122%;

}

#ygrp-sponsor .ad a{

text-decoration: none;

}

#ygrp-sponsor .ad a:hover{

text-decoration: underline;

}

#ygrp-sponsor .ad p{

margin:0;

}

o {font-size:0; }

.MsoNormal {

margin:0 0 0 0;

}

#ygrp-text tt{

font-size:120% ;

}

blockquote{margin: 0 0 0 4px;}

.replbq {margin:4;}

-->



____________ _________ _________ _________ _________ _________ _

Do you Yahoo!?

Everyone is raving about the all-new Yahoo! Mail beta.

http://new.mail yahoo.com



[Non-text portions of this message have been removed]














<!--

#ygrp-mlmsg {font-size:13px;font-family:arial,helvetica,clean,sans-serif;}
#ygrp-mlmsg table {font-size:inherit;font:100%;}
#ygrp-mlmsg select, input, textarea {font:99% arial,helvetica,clean,sans-serif;}
#ygrp-mlmsg pre, code {font:115% monospace;}
#ygrp-mlmsg * {line-height:1.22em;}
#ygrp-text{
font-family:Georgia;
}
#ygrp-text p{
margin:0 0 1em 0;
}
#ygrp-tpmsgs{
font-family:Arial;
clear:both;
}
#ygrp-vitnav{
padding-top:10px;
font-family:Verdana;
font-size:77%;
margin:0;
}
#ygrp-vitnav a{
padding:0 1px;
}
#ygrp-actbar{
clear:both;
margin:25px 0;
white-space:nowrap;
color:#666;
text-align:right;
}
#ygrp-actbar .left{
float:left;
white-space:nowrap;
}
.bld{font-weight:bold;}
#ygrp-grft{
font-family:Verdana;
font-size:77%;
padding:15px 0;
}
#ygrp-ft{
font-family:verdana;
font-size:77%;
border-top:1px solid #666;
padding:5px 0;
}
#ygrp-mlmsg #logo{
padding-bottom:10px;
}

#ygrp-vital{
background-color:#e0ecee;
margin-bottom:20px;
padding:2px 0 8px 8px;
}
#ygrp-vital #vithd{
font-size:77%;
font-family:Verdana;
font-weight:bold;
color:#333;
text-transform:uppercase;
}
#ygrp-vital ul{
padding:0;
margin:2px 0;
}
#ygrp-vital ul li{
list-style-type:none;
clear:both;
border:1px solid #e0ecee;
}
#ygrp-vital ul li .ct{
font-weight:bold;
color:#ff7900;
float:right;
width:2em;
text-align:right;
padding-right:.5em;
}
#ygrp-vital ul li .cat{
font-weight:bold;
}
#ygrp-vital a {
text-decoration:none;
}

#ygrp-vital a:hover{
text-decoration:underline;
}

#ygrp-sponsor #hd{
color:#999;
font-size:77%;
}
#ygrp-sponsor #ov{
padding:6px 13px;
background-color:#e0ecee;
margin-bottom:20px;
}
#ygrp-sponsor #ov ul{
padding:0 0 0 8px;
margin:0;
}
#ygrp-sponsor #ov li{
list-style-type:square;
padding:6px 0;
font-size:77%;
}
#ygrp-sponsor #ov li a{
text-decoration:none;
font-size:130%;
}
#ygrp-sponsor #nc {
background-color:#eee;
margin-bottom:20px;
padding:0 8px;
}
#ygrp-sponsor .ad{
padding:8px 0;
}
#ygrp-sponsor .ad #hd1{
font-family:Arial;
font-weight:bold;
color:#628c2a;
font-size:100%;
line-height:122%;
}
#ygrp-sponsor .ad a{
text-decoration:none;
}
#ygrp-sponsor .ad a:hover{
text-decoration:underline;
}
#ygrp-sponsor .ad p{
margin:0;
}
o {font-size:0;}
.MsoNormal {
margin:0 0 0 0;
}
#ygrp-text tt{
font-size:120%;
}
blockquote{margin:0 0 0 4px;}
.replbq {margin:4;}
-->









____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com

[Non-text portions of this message have been removed]