A bug on TSQLServer at Mac os platfrom


Please read tips for efficient and successful posting and posting code

_ROOT Version: 6.22/02
_Platform: macOS
_Compiler: macosx64


I wang to connect to my MySQL database, so I need to use TSQLServer class. But If I define

TSQLServer *db = TSQLServer::Connect("mysql://xxxx:3306/my_database","username","password");

and use db->Query("show tables");

I will meet these bug information, how to fix it? I test in Linux server, same command all fine.

[/Applications/root_v6.22.02/lib/libCling.6.22.02.so] cling_runtime_internal_throwIfInvalidPointer (no debug info)
[<unknown binary>] (no debug info)
[/Applications/root_v6.22.02/lib/libCling.6.22.02.so] cling::IncrementalExecutor::executeWrapper(llvm::StringRef, cling::Value*) const (no debug info)
[/Applications/root_v6.22.02/lib/libCling.6.22.02.so] cling::Interpreter::RunFunction(clang::FunctionDecl const*, cling::Value*) (no debug info)
[/Applications/root_v6.22.02/lib/libCling.6.22.02.so] cling::Interpreter::EvaluateInternal(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, cling::CompilationOptions, cling::Value*, cling::Transaction**, unsigned long) (no debug info)
[/Applications/root_v6.22.02/lib/libCling.6.22.02.so] cling::Interpreter::process(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, cling::Value*, cling::Transaction**, bool) (no debug info)
[/Applications/root_v6.22.02/lib/libCling.6.22.02.so] cling::MetaProcessor::process(llvm::StringRef, cling::Interpreter::CompilationResult&, cling::Value*, bool) (no debug info)
[/Applications/root_v6.22.02/lib/libCling.6.22.02.so] HandleInterpreterException(cling::MetaProcessor*, char const*, cling::Interpreter::CompilationResult&, cling::Value*) (no debug info)
[/Applications/root_v6.22.02/lib/libCling.6.22.02.so] TCling::ProcessLine(char const*, TInterpreter::EErrorCode*) (no debug info)
[/Applications/root_v6.22.02/lib/libRint.6.22.02.so] TRint::ProcessLineNr(char const*, char const*, int*) (no debug info)
[/Applications/root_v6.22.02/lib/libRint.6.22.02.so] TRint::HandleTermInput() (no debug info)
[/Applications/root_v6.22.02/lib/libCore.6.22.02.so] TUnixSystem::CheckDescriptors() (no debug info)
[/Applications/root_v6.22.02/lib/libCore.6.22.02.so] TMacOSXSystem::DispatchOneEvent(bool) (no debug info)
[/Applications/root_v6.22.02/lib/libCore.6.22.02.so] TSystem::InnerLoop() (no debug info)
[/Applications/root_v6.22.02/lib/libCore.6.22.02.so] TSystem::Run() (no debug info)
[/Applications/root_v6.22.02/lib/libCore.6.22.02.so] TApplication::Run(bool) (no debug info)
[/Applications/root_v6.22.02/lib/libRint.6.22.02.so] TRint::Run(bool) (no debug info)
[/Applications/root_v6.22.02/bin/root.exe] main (no debug info)
[/usr/lib/system/libdyld.dylib] start (no debug info)
[<unknown binary>] (no debug info)
Error in <HandleInterpreterException>: Trying to dereference null pointer or trying to call routine taking non-null arguments.
Execution of your code was aborted.
ROOT_prompt_1:1:1: warning: null passed to a callee that requires a non-null argument [-Wnonnull]
db->IsConnected ();
^~

Hi,

Can you check that TSQLServer::Connect returns non-null pointer?

Sergey

root [0] TSQLServer *db = TSQLServer::Connect("mysql://xxxx:3306/my_db","my_name","my_passw");
root [1] db
(TSQLServer *) nullptr
root [2]

so, I think it is a null pointer.

Means, you did not get connection to your mysql server.
Try to set gDebug=1; to see more debug output why it could happen.
Do you have at all mysql component compiled?