Little Pieces. ORA TNS:could not resolve service name The most common problem associated with this error code is that the connect string is incorrect. Share this: Twitter Facebook. Like this: Like Loading Posted in Oracle , VB Scripts. Leave a Comment ». Leave a Reply Cancel reply Enter your comment here Fill in your details below or click an icon to log in:. Email required Address never made public. Name required. Perl Sockets ». A script running in the 64bit host won't see registered 32bit libraries.
Why are there spaces in User ID in the line of strConnect? Is it a typo? Show 2 more comments. Active Oldest Votes. Correct me guys if I am wrong anywhere, as I am still learning. Srekk Srekk 3 3 silver badges 14 14 bronze badges. Add a comment. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Making Agile work for data science.
Stack Gives Back Featured on Meta. VBscript makes this fairly easy. Note: Some of the lines have been artificially word wrapped for formatting purposes in this blog. Be sure to refer to the complete script in the above link for the actual source code. This connection string may vary a bit depending on what version of Oracle you are trying to access, but it should be fairly similar overall.
The CodeProject site has an article that describes an alternative connection string method that does not rely on an entry in the tnsnames. This section creates the connection object as well as the rows object which will be the container recordset for the data we retrieve from the database.
This set of statements creates the Windows Script and file handling objects. This section shows just how easy it is to create a log file for your scripts. By default it will create the log file in the same directory as the script you can change this if you wish.
The log file will be over written each time the script is executed. The loop then steps through each row returned and processes it. In this case only a single row containing the date and time is returned, which is then parsed into separate variables. The script also writes this information to the log file. As you can see, it would be fairly easy to process a result set that had many rows, using the rows object.
I may explore more complicated queries in a future article. This section of the script takes the values retrieved from the database and executes the date and time commands using the Windows Script object.
If an error occurs for one of these commands, a line is written to the log file. The remainder of the script finishes up the log file and then destroys all of the objects created within the script.
0コメント