1

I dont cant connect to Oracle database with dbi perl module.

If i use ORA type connection i can.

"ORA Profile connection:

let g:dbext_default_profile_myConnection= 'type=ORA:srvname=//myIP.IP.IP.IP\:myPORT/mySID:user=myUSER:passwd=myPASSWORD'

With DBI perl module It must be something like this:

let g:dbext_default_profile_myDBIConnection = 'type=DBI:user=myUSER:passwd=myPASSWORD:driver=Oracle:conn_parms=host=myHost;port=myPort'

But i dont know how to include the SID

Can anybody help me? Many thanks!!

brian d foy
  • 129,424
  • 31
  • 207
  • 592
Loopzen
  • 11
  • 1

1 Answers1

4

Did you try looking at the documentation for DBD::Oracle? That's the database driver module that DBI uses when it's connecting to an Oracle database. The documentation for DBDs often has useful tips on how to connect to a specific type of database. In this case, the second example in the synopsis shows how to connect using a SID.

$dbh = DBI->connect("dbi:Oracle:host=$host;sid=$sid", $user, $passwd);

Update: Looking at the documentation for dbext, I see an example of using a SID.

let g:dbext_default_profile_ORA_db2 = 'type=DBI:user=scott:passwd=tiger:driver=Oracle:conn_parms=SID_NAME'
Dave Cross
  • 68,119
  • 3
  • 51
  • 97
  • Many thanks for your answer. The solution is coming. Im want this to connect to database using VIM editor and dbext-plugin. Whitout perl DBI module i achived. Your answer help me to understand how the plugin works, but i can not make it work. `let g:dbext_default_profile_myDBIConnection = 'type=DBI:user=myUser:passwd=myPass:driver=Oracle:conn_parms=host=myHost;port=myPort;sid=mySid'` Its something very specific and i cant solve it. Many thanks for your answer. – Loopzen Jul 30 '18 at 20:03
  • @Loopzen: I'm sorry, but I have no idea what "dbext-plugin" is. Do you have a link? – Dave Cross Jul 30 '18 at 20:25
  • @Loopzen: Ok. I found dbext here - https://github.com/vim-scripts/dbext.vim. I'm not sure why you're using DBI here. It looks like dbext has native Oracle support. I think you only need to use DBI for database engines that don't have built-in support. – Dave Cross Jul 30 '18 at 20:29
  • the native support is limited. For example, natively it does autocommit. Really I could use other software like Oracle SQL Developer or TOAD and maybe it will be more easy and useful, but I am vim user and i would like work only with vim, but autocommit is very dangerous to me. I have read dbext documentation. Besides in internet i dont find the solution. The SID example doesnt work neither, besides i dont understand how it can connect this way it we dont indicate the host. – Loopzen Jul 30 '18 at 21:01
  • Doesn't the SID specify the hostname (in case you haven't noticed, I know almost nothing about Oracle). – Dave Cross Jul 30 '18 at 21:25