How to access an Oracle database from Perl?

后端 未结 2 582
挽巷
挽巷 2021-01-22 03:22

I\'m converting some shell scripts to perl. All the database access is done using sqlplus. With perl is that a better way to access an Oracle database or should I just stick to

2条回答
  •  南方客
    南方客 (楼主)
    2021-01-22 04:03

    DBI is the standard Perl database interface (unsurprisingly, it has an Oracle driver). DBIx::Class wraps it with a nice ORM interface.

    SQL Plus appears to be a command line interface to Oracle. To use it from Perl you would have to construct your queries by mashing strings together (a great way to introduce SQL injection problems), shell out to the command line client, then parse the text output. That is madness. Use an interface that gives you Perl data structures to work with.

提交回复
热议问题