|
juki918 Newbie
Joined: 02 Sep 2011 Posts: 1
|
Posted: Sat Oct 08, 2011 9:48 am
Connect to oracle database and run plsql block |
Hi there,
im trying to connect to local oracle database (XE) from CMUD, i coppied oci.dll from my oracle installation to CMUD directory and tried commands lide #SQLDB and %sqldb but with no success.
Can somebody please write simple CMUD script that connects to local oracle database ( listener on 127.0.0.1 port 1521 SID=XE) and run plsql block:
BEGIN
proc1('Hello');
END;
and closes connection? thanks
PS:
currently im trying to use
#SQLDB "dbConnection" "XE" "oracle" "127.0.0.1" "1521" "muduser" "mudpassword"
#CALL @dbConnection.Open
#CALL @dbConnection.Execute("BEGIN proc1('Hello');END;")
#CALL @dbConnection.Commit
#CALL @dbConnection.Close
it gives no error but also does not do anything |
|
|
|
ins0mnia Novice
Joined: 23 Jan 2011 Posts: 42 Location: United States
|
Posted: Sat Oct 08, 2011 10:03 am |
Cmud Pro is required for 'remote' databases, I know that's local but I think the entire syntax is restricted
Other than that, I can't help much.. typing #SQLDB alone will show if a connection was made at all. |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sat Oct 08, 2011 5:13 pm |
Regular CMud only allows you to connect to SQLite databases. CMud Pro lets you also connect to any other type of DB format.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
juki919 Newbie
Joined: 08 Oct 2011 Posts: 6
|
Posted: Sat Oct 08, 2011 7:26 pm |
sorry my accout juki918 was banned for some reason (???) waiting to be recovered.
Yes, im using CMud Pro Version 3.33a purchased and with licence.
It appeares that i can connect using those #SQLDB command (simple #SQLDB shows dbConnection -> XE [oracle] (127.0.0.1:1521) connected).
I can also retrieve some data from SQL query using %sql function. Problem is that im not sure how to execute plsql block or run database procedure.
Is #CALL @dbConnection.Execute ("...") the right command for executing nonresultset command on database? |
|
|
|
Daern Sorcerer
Joined: 15 Apr 2011 Posts: 809
|
Posted: Sat Oct 08, 2011 7:47 pm |
I believe the problem is that the #SQLDB command doesn't actually set a dbConnection variable, dbConnection just becomes the name of the connection. Try something like this instead:
Code: |
dbConnection = %sqldb( "XE", "oracle", "127.0.0.1", "1521", "muduser", "mudpassword")
#CALL @dbConnection.Open
#CALL @dbConnection.Execute("BEGIN proc1('Hello');END;")
#CALL @dbConnection.Commit
#CALL @dbConnection.Close |
|
|
|
|
juki919 Newbie
Joined: 08 Oct 2011 Posts: 6
|
Posted: Sat Oct 08, 2011 9:04 pm |
thank you guys, finaly it works as follows:
Code: |
dbConnection = %sqldb( "dbConnection", "XE", "oracle", "127.0.0.1", "1521", "muduser", "mudpassword")
#CALL @dbConnection.Open
#CALL @dbConnection.Execute("BEGIN proc1('Hello');END;")
#CALL @dbConnection.Close |
|
|
|
|
|
|