Hoasca,
A really good (generic) way to figure out the syntax of connection strings is to just drop an ADODC (ADO Data Control) on your form, then use the built-in wizard to make a connection to your data source.
Once you've done that, you can just copy the connection string from the properties window, an paste it into your code then delete the ADODC.
you can either connect using a dsn or without dsn.
dsn-less connection is
Set conn = New adodb.Connection
Let conn.ConnectionString = "Driver={Microsoft ODBC for Oracle};server=myservername;Uid=myuid";Pwd=mypwd"
conn.Open
Set rs1 = New adodb.Recordset
rs1.Open "select * from mytable", conn, adOpenDynamic, adLockOptimistic
myservername = the host string you use to connect to oracle server thru sql*plus.
uid = oracle sql*plus user name
pwd = oracle sql* plus password
for dsn connection you need to first create a system dsn thru the ODBC data sources in the control panel. suppose the created dsn is "mydsn", the connection string becomes
Set conn = New adodb.Connection
Let conn.ConnectionString = "dsn=mydsn;Uid=myuid";Pwd=mypwd"
conn.Open
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.